From: Kurt Zeilenga Date: Fri, 30 Aug 2002 05:02:20 +0000 (+0000) Subject: Place NOOP behind #ifdef X-Git-Tag: NO_SLAP_OP_BLOCKS~1093 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0517278aff03e813a0d419c5c4399a7cb7d0c210;p=openldap Place NOOP behind #ifdef --- diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index 4786bd991c..7451b9d7d7 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -49,7 +49,9 @@ usage( const char *s ) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -h host LDAP server\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" " -I use SASL Interactive mode\n" @@ -108,15 +110,18 @@ main( int argc, char **argv ) { char *compdn = NULL, *attrs = NULL; char *sep; - int rc, i, crit, manageDSAit, noop, quiet; + int rc, i, crit, manageDSAit, quiet; int referrals, debug; int authmethod, version, want_bindpw; LDAP *ld = NULL; struct berval bvalue = { 0, NULL }; char *pw_file = NULL; char *control, *cvalue; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif - debug = verbose = not = referrals = noop = + debug = verbose = not = referrals = manageDSAit = want_bindpw = quiet = 0; version = -1; diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index f08bdba11f..9bb21d569f 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -64,7 +64,9 @@ usage( const char *s ) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -98,12 +100,15 @@ main( int argc, char **argv ) { char buf[ 4096 ]; FILE *fp; - int i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit, noop, crit; + int i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit, crit; char *pw_file; char *control, *cvalue; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif not = verbose = contoper = want_bindpw = debug - = manageDSAit = noop = referrals = 0; + = manageDSAit = referrals = 0; fp = NULL; authmethod = -1; version = -1; @@ -206,6 +211,7 @@ main( int argc, char **argv ) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -216,6 +222,7 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); @@ -694,7 +701,11 @@ main( int argc, char **argv ) } } - if ( manageDSAit || noop ) { + if ( manageDSAit +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -708,6 +719,7 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -717,7 +729,8 @@ main( int argc, char **argv ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } - +#endif + err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 6ce9d99f9b..9d4fe45fab 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -113,7 +113,9 @@ usage( const char *prog ) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -148,11 +150,14 @@ main( int argc, char **argv ) char *infile, *rejfile, *rbuf, *start, *rejbuf = NULL; FILE *fp, *rejfp; char *matched_msg = NULL, *error_msg = NULL; - int rc, i, authmethod, version, want_bindpw, debug, manageDSAit, noop, referrals; + int rc, i, authmethod, version, want_bindpw, debug, manageDSAit, referrals; int count, len; char *pw_file = NULL; char *control, *cvalue; int crit; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif prog = lutil_progname( "ldapmodify", argc, argv ); @@ -164,7 +169,7 @@ main( int argc, char **argv ) infile = NULL; rejfile = NULL; - not = verbose = want_bindpw = debug = manageDSAit = noop = referrals = 0; + not = verbose = want_bindpw = debug = manageDSAit = referrals = 0; authmethod = -1; version = -1; @@ -263,6 +268,7 @@ main( int argc, char **argv ) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -273,6 +279,7 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); @@ -781,7 +788,11 @@ main( int argc, char **argv ) rc = 0; - if ( manageDSAit || noop ) { + if ( manageDSAit +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -795,6 +806,7 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -804,7 +816,8 @@ main( int argc, char **argv ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } - +#endif + err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 68633b8439..501852cc64 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -78,7 +78,9 @@ usage( const char *s ) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -111,15 +113,18 @@ main(int argc, char **argv) { char *infile, *entrydn = NULL, *rdn = NULL, buf[ 4096 ]; FILE *fp; - int rc, i, remove, havedn, authmethod, version, want_bindpw, debug, manageDSAit, noop, crit; + int rc, i, remove, havedn, authmethod, version, want_bindpw, debug, manageDSAit, crit; int referrals; char *newSuperior=NULL; char *pw_file = NULL; char *control, *cvalue; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif infile = NULL; not = contoper = verbose = remove = want_bindpw = - debug = manageDSAit = noop = referrals = 0; + debug = manageDSAit = referrals = 0; authmethod = -1; version = -1; @@ -226,6 +231,7 @@ main(int argc, char **argv) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -236,7 +242,7 @@ main(int argc, char **argv) noop = 1 + crit; free( control ); break; - +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); usage(prog); @@ -729,7 +735,11 @@ main(int argc, char **argv) } } - if ( manageDSAit || noop ) { + if ( manageDSAit +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -743,6 +753,7 @@ main(int argc, char **argv) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -752,7 +763,8 @@ main(int argc, char **argv) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } - +#endif + err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index dda3651ab5..e862cc215f 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -42,7 +42,9 @@ usage(const char *s) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server(s)\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -91,7 +93,9 @@ main( int argc, char *argv[] ) int version = -1; int authmethod = -1; int manageDSAit = 0; - int noop = 0; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif int crit; char *control, *cvalue; #ifdef HAVE_CYRUS_SASL @@ -224,6 +228,7 @@ main( int argc, char *argv[] ) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -234,7 +239,7 @@ main( int argc, char *argv[] ) noop = 1 + crit; free( control ); break; - +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); usage(prog); @@ -729,7 +734,11 @@ main( int argc, char *argv[] ) } } - if ( manageDSAit || noop ) { + if ( manageDSAit +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -743,6 +752,7 @@ main( int argc, char *argv[] ) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -752,7 +762,8 @@ main( int argc, char *argv[] ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } - +#endif + err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 05ebceb997..543e6921b2 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -75,7 +75,9 @@ usage( const char *s ) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -186,7 +188,7 @@ main( int argc, char **argv ) { char *infile, *filtpattern, **attrs = NULL, line[BUFSIZ]; FILE *fp = NULL; - int rc, i, first, scope, deref, attrsonly, manageDSAit, noop, crit; + int rc, i, first, scope, deref, attrsonly, manageDSAit, crit; int referrals, timelimit, sizelimit, debug; int authmethod, version, want_bindpw; LDAP *ld = NULL; @@ -195,11 +197,13 @@ main( int argc, char **argv ) struct berval *bvalp = NULL; char *vrFilter = NULL, *control = NULL, *cvalue; char *pw_file = NULL; - +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif infile = NULL; debug = verbose = not = vals2tmp = referrals = valuesReturnFilter = - attrsonly = manageDSAit = noop = ldif = want_bindpw = 0; + attrsonly = manageDSAit = ldif = want_bindpw = 0; prog = lutil_progname( "ldapsearch", argc, argv ); @@ -402,6 +406,7 @@ main( int argc, char **argv ) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -412,7 +417,7 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; - +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); usage(prog); @@ -943,7 +948,11 @@ main( int argc, char **argv ) } } - if ( manageDSAit || noop || valuesReturnFilter ) { + if ( manageDSAit || valuesReturnFilter +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err; int i=0; LDAPControl c1,c2,c3; @@ -959,6 +968,7 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -968,6 +978,7 @@ main( int argc, char **argv ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } +#endif if ( valuesReturnFilter ) { ctrls[i++]=&c3; @@ -1047,10 +1058,12 @@ main( int argc, char **argv ) printf("\n# with manageDSAit %scontrol", manageDSAit > 1 ? "critical " : "" ); } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { printf("\n# with noop %scontrol", noop > 1 ? "critical " : "" ); } +#endif if ( valuesReturnFilter ) { printf("\n# with valuesReturnFilter %scontrol: %s", valuesReturnFilter > 1 ? "critical " : "", vrFilter ); diff --git a/clients/tools/ldapwhoami.c b/clients/tools/ldapwhoami.c index 841a048790..9143e2a25e 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -36,7 +36,9 @@ usage(const char *s) " -D binddn bind DN\n" " -e [!][=] general controls (! indicates criticality)\n" " [!]manageDSAit (alternate form, see -M)\n" +#ifdef LDAP_CONTROL_NOOP " [!]noop\n" +#endif " -f file read operations from `file'\n" " -h host LDAP server(s)\n" " -H URI LDAP Uniform Resource Indentifier(s)\n" @@ -93,7 +95,10 @@ main( int argc, char *argv[] ) int use_tls = 0; int referrals = 0; LDAP *ld = NULL; - int manageDSAit=0, noop=0; + int manageDSAit=0; +#ifdef LDAP_CONTROL_NOOP + int noop=0; +#endif char *control, *cvalue; int crit; @@ -183,6 +188,7 @@ main( int argc, char *argv[] ) free( control ); break; +#ifdef LDAP_CONTROL_NOOP } else if ( strcasecmp( control, "noop" ) == 0 ) { if( cvalue != NULL ) { fprintf( stderr, "noop: no control value expected" ); @@ -193,7 +199,7 @@ main( int argc, char *argv[] ) noop = 1 + crit; free( control ); break; - +#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); usage(prog); @@ -662,7 +668,11 @@ main( int argc, char *argv[] ) goto skip; } - if ( manageDSAit || noop ) { + if ( manageDSAit +#ifdef LDAP_CONTROL_NOOP + || noop +#endif + ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -676,6 +686,7 @@ main( int argc, char *argv[] ) c1.ldctl_iscritical = manageDSAit > 1; } +#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -685,6 +696,7 @@ main( int argc, char *argv[] ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } +#endif err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls );