Add manageDsaIt/NOOP control support to every tool.

Update NT build.
This commit is contained in:
Kurt Zeilenga 2002-08-29 21:52:45 +00:00
parent 96ae8aa2c3
commit 2de5c33ba7
7 changed files with 180 additions and 65 deletions

View File

@ -123,9 +123,6 @@ Package=<4>
Project_Dep_Name testavl
End Project Dependency
Begin Project Dependency
Project_Dep_Name ud
End Project Dependency
Begin Project Dependency
Project_Dep_Name slapcat
End Project Dependency
Begin Project Dependency
@ -155,6 +152,9 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name ftest
End Project Dependency
Begin Project Dependency
Project_Dep_Name ldapwhoami
End Project Dependency
}}}
###############################################################################
@ -354,6 +354,27 @@ Package=<4>
###############################################################################
Project: "ldapwhoami"=..\clients\tools\ldapwhoami.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name liblber
End Project Dependency
Begin Project Dependency
Project_Dep_Name libldap
End Project Dependency
Begin Project Dependency
Project_Dep_Name liblutil
End Project Dependency
}}}
###############################################################################
Project: "libavl"=..\libraries\libavl\libavl.dsp - Package Owner=<4>
Package=<5>
@ -777,27 +798,6 @@ Package=<4>
###############################################################################
Project: "ud"=..\clients\ud\ud.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name libldap
End Project Dependency
Begin Project Dependency
Project_Dep_Name liblber
End Project Dependency
Begin Project Dependency
Project_Dep_Name liblutil
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>

View File

@ -726,24 +726,37 @@ main( int argc, char **argv )
}
}
if ( manageDSAit ) {
int err;
LDAPControl c;
LDAPControl *ctrls[2];
ctrls[0] = &c;
ctrls[1] = NULL;
if ( manageDSAit || noop ) {
int err, i = 0;
LDAPControl c1, c2;
LDAPControl *ctrls[3];
c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c.ldctl_value.bv_val = NULL;
c.ldctl_value.bv_len = 0;
c.ldctl_iscritical = manageDSAit > 1;
if ( manageDSAit ) {
ctrls[i++] = &c1;
ctrls[i] = NULL;
c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c1.ldctl_value.bv_val = NULL;
c1.ldctl_value.bv_len = 0;
c1.ldctl_iscritical = manageDSAit > 1;
}
if ( noop ) {
ctrls[i++] = &c2;
ctrls[i] = NULL;
c2.ldctl_oid = LDAP_CONTROL_NOOP;
c2.ldctl_value.bv_val = NULL;
c2.ldctl_value.bv_len = 0;
c2.ldctl_iscritical = noop > 1;
}
err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
if( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
c.ldctl_iscritical ? "critical " : "" );
if( c.ldctl_iscritical ) {
fprintf( stderr, "Could not set %scontrols\n",
(c1.ldctl_iscritical || c2.ldctl_iscritical)
? "critical " : "" );
if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
return EXIT_FAILURE;
}
}

View File

@ -694,25 +694,38 @@ main( int argc, char **argv )
}
}
if ( manageDSAit ) {
int err;
LDAPControl c;
LDAPControl *ctrls[2];
ctrls[0] = &c;
ctrls[1] = NULL;
if ( manageDSAit || noop ) {
int err, i = 0;
LDAPControl c1, c2;
LDAPControl *ctrls[3];
c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c.ldctl_value.bv_val = NULL;
c.ldctl_value.bv_len = 0;
c.ldctl_iscritical = manageDSAit > 1;
if ( manageDSAit ) {
ctrls[i++] = &c1;
ctrls[i] = NULL;
c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c1.ldctl_value.bv_val = NULL;
c1.ldctl_value.bv_len = 0;
c1.ldctl_iscritical = manageDSAit > 1;
}
if ( noop ) {
ctrls[i++] = &c2;
ctrls[i] = NULL;
c2.ldctl_oid = LDAP_CONTROL_NOOP;
c2.ldctl_value.bv_val = NULL;
c2.ldctl_value.bv_len = 0;
c2.ldctl_iscritical = noop > 1;
}
err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
if( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
c.ldctl_iscritical ? "critical " : "" );
if( c.ldctl_iscritical ) {
exit( EXIT_FAILURE );
fprintf( stderr, "Could not set %scontrols\n",
(c1.ldctl_iscritical || c2.ldctl_iscritical)
? "critical " : "" );
if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
return EXIT_FAILURE;
}
}
}

View File

@ -729,25 +729,38 @@ main(int argc, char **argv)
}
}
if ( manageDSAit ) {
int err;
LDAPControl c;
LDAPControl *ctrls[2];
ctrls[0] = &c;
ctrls[1] = NULL;
if ( manageDSAit || noop ) {
int err, i = 0;
LDAPControl c1, c2;
LDAPControl *ctrls[3];
c.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c.ldctl_value.bv_val = NULL;
c.ldctl_value.bv_len = 0;
c.ldctl_iscritical = manageDSAit > 1;
if ( manageDSAit ) {
ctrls[i++] = &c1;
ctrls[i] = NULL;
c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c1.ldctl_value.bv_val = NULL;
c1.ldctl_value.bv_len = 0;
c1.ldctl_iscritical = manageDSAit > 1;
}
if ( noop ) {
ctrls[i++] = &c2;
ctrls[i] = NULL;
c2.ldctl_oid = LDAP_CONTROL_NOOP;
c2.ldctl_value.bv_val = NULL;
c2.ldctl_value.bv_len = 0;
c2.ldctl_iscritical = noop > 1;
}
err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
if( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not set ManageDSAit %scontrol\n",
c.ldctl_iscritical ? "critical " : "" );
if( c.ldctl_iscritical ) {
exit( EXIT_FAILURE );
fprintf( stderr, "Could not set %scontrols\n",
(c1.ldctl_iscritical || c2.ldctl_iscritical)
? "critical " : "" );
if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
return EXIT_FAILURE;
}
}
}

View File

@ -729,6 +729,42 @@ main( int argc, char *argv[] )
}
}
if ( manageDSAit || noop ) {
int err, i = 0;
LDAPControl c1, c2;
LDAPControl *ctrls[3];
if ( manageDSAit ) {
ctrls[i++] = &c1;
ctrls[i] = NULL;
c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c1.ldctl_value.bv_val = NULL;
c1.ldctl_value.bv_len = 0;
c1.ldctl_iscritical = manageDSAit > 1;
}
if ( noop ) {
ctrls[i++] = &c2;
ctrls[i] = NULL;
c2.ldctl_oid = LDAP_CONTROL_NOOP;
c2.ldctl_value.bv_val = NULL;
c2.ldctl_value.bv_len = 0;
c2.ldctl_iscritical = noop > 1;
}
err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
if( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not set %scontrols\n",
(c1.ldctl_iscritical || c2.ldctl_iscritical)
? "critical " : "" );
if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
return EXIT_FAILURE;
}
}
}
if( user != NULL || oldpw != NULL || newpw != NULL ) {
/* build change password control */
BerElement *ber = ber_alloc_t( LBER_USE_DER );

View File

@ -662,6 +662,42 @@ main( int argc, char *argv[] )
goto skip;
}
if ( manageDSAit || noop ) {
int err, i = 0;
LDAPControl c1, c2;
LDAPControl *ctrls[3];
if ( manageDSAit ) {
ctrls[i++] = &c1;
ctrls[i] = NULL;
c1.ldctl_oid = LDAP_CONTROL_MANAGEDSAIT;
c1.ldctl_value.bv_val = NULL;
c1.ldctl_value.bv_len = 0;
c1.ldctl_iscritical = manageDSAit > 1;
}
if ( noop ) {
ctrls[i++] = &c2;
ctrls[i] = NULL;
c2.ldctl_oid = LDAP_CONTROL_NOOP;
c2.ldctl_value.bv_val = NULL;
c2.ldctl_value.bv_len = 0;
c2.ldctl_iscritical = noop > 1;
}
err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );
if( err != LDAP_OPT_SUCCESS ) {
fprintf( stderr, "Could not set %scontrols\n",
(c1.ldctl_iscritical || c2.ldctl_iscritical)
? "critical " : "" );
if ( c1.ldctl_iscritical && c2.ldctl_iscritical ) {
return EXIT_FAILURE;
}
}
}
rc = ldap_extended_operation( ld,
LDAP_EXOP_X_WHO_AM_I, NULL,
NULL, NULL, &id );

View File

@ -204,6 +204,10 @@ SOURCE=.\ntservice.c
# End Source File
# Begin Source File
SOURCE=.\passfile.c
# End Source File
# Begin Source File
SOURCE=.\passwd.c
# End Source File
# Begin Source File