From: Kurt Zeilenga Date: Thu, 29 Aug 2002 21:52:45 +0000 (+0000) Subject: Add manageDsaIt/NOOP control support to every tool. X-Git-Tag: NO_SLAP_OP_BLOCKS~1096 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2de5c33ba769e130ba340ff248a11bbd139d839b;p=openldap Add manageDsaIt/NOOP control support to every tool. Update NT build. --- diff --git a/build/main.dsw b/build/main.dsw index f198bf3c05..b5d01bfcb8 100644 --- a/build/main.dsw +++ b/build/main.dsw @@ -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> diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index 1f01d7e74e..4786bd991c 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -726,24 +726,37 @@ main( int argc, char **argv ) } } - if ( manageDSAit ) { - int err; - LDAPControl c; - LDAPControl *ctrls[2]; - ctrls[0] = &c; - ctrls[1] = NULL; - - 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 || 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 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; } } diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 6abefbe2e1..f08bdba11f 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -694,25 +694,38 @@ main( int argc, char **argv ) } } - if ( manageDSAit ) { - int err; - LDAPControl c; - LDAPControl *ctrls[2]; - ctrls[0] = &c; - ctrls[1] = NULL; - - 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 || 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 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; } } } diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index daf1eeddab..68633b8439 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -729,25 +729,38 @@ main(int argc, char **argv) } } - if ( manageDSAit ) { - int err; - LDAPControl c; - LDAPControl *ctrls[2]; - ctrls[0] = &c; - ctrls[1] = NULL; - - 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 || 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 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; } } } diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index b39d7d387a..dda3651ab5 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -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 ); diff --git a/clients/tools/ldapwhoami.c b/clients/tools/ldapwhoami.c index ca4d0fa817..841a048790 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -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 ); diff --git a/libraries/liblutil/liblutil.dsp b/libraries/liblutil/liblutil.dsp index 436a6981bf..013a800c12 100644 --- a/libraries/liblutil/liblutil.dsp +++ b/libraries/liblutil/liblutil.dsp @@ -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