From 26e4960c1cd42bc35b86743b5a3b72439d13b290 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 30 Aug 2002 05:43:47 +0000 Subject: [PATCH] Remove those #ifdefs NOOP just added. --- clients/tools/ldapcompare.c | 20 ++++---------------- clients/tools/ldapdelete.c | 21 ++++----------------- clients/tools/ldapmodify.c | 21 ++++----------------- clients/tools/ldapmodrdn.c | 22 +++++----------------- clients/tools/ldappasswd.c | 19 ++++--------------- clients/tools/ldapsearch.c | 23 +++++------------------ clients/tools/ldapwhoami.c | 15 ++------------- 7 files changed, 28 insertions(+), 113 deletions(-) diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index b83b618f6a..f2e06e6e4c 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -2,6 +2,7 @@ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ +/* $OpenLDAP$ #include "portable.h" @@ -49,9 +50,7 @@ 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" @@ -110,18 +109,15 @@ main( int argc, char **argv ) { char *compdn = NULL, *attrs = NULL; char *sep; - int rc, i, crit, manageDSAit, quiet; + int rc, i, crit, manageDSAit, noop, 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 = + debug = verbose = not = referrals = noop = manageDSAit = want_bindpw = quiet = 0; version = -1; @@ -209,7 +205,6 @@ 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" ); @@ -220,7 +215,6 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; -#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); @@ -733,11 +727,7 @@ main( int argc, char **argv ) } } - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -751,7 +741,6 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -761,7 +750,6 @@ 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 ); diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 9bb21d569f..f08bdba11f 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -64,9 +64,7 @@ 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" @@ -100,15 +98,12 @@ main( int argc, char **argv ) { char buf[ 4096 ]; FILE *fp; - int i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit, crit; + int i, rc, authmethod, referrals, want_bindpw, version, debug, manageDSAit, noop, crit; char *pw_file; char *control, *cvalue; -#ifdef LDAP_CONTROL_NOOP - int noop=0; -#endif not = verbose = contoper = want_bindpw = debug - = manageDSAit = referrals = 0; + = manageDSAit = noop = referrals = 0; fp = NULL; authmethod = -1; version = -1; @@ -211,7 +206,6 @@ 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" ); @@ -222,7 +216,6 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; -#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); @@ -701,11 +694,7 @@ main( int argc, char **argv ) } } - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -719,7 +708,6 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -729,8 +717,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 ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 9d4fe45fab..6ce9d99f9b 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -113,9 +113,7 @@ 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" @@ -150,14 +148,11 @@ 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, referrals; + int rc, i, authmethod, version, want_bindpw, debug, manageDSAit, noop, 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 ); @@ -169,7 +164,7 @@ main( int argc, char **argv ) infile = NULL; rejfile = NULL; - not = verbose = want_bindpw = debug = manageDSAit = referrals = 0; + not = verbose = want_bindpw = debug = manageDSAit = noop = referrals = 0; authmethod = -1; version = -1; @@ -268,7 +263,6 @@ 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" ); @@ -279,7 +273,6 @@ main( int argc, char **argv ) noop = 1 + crit; free( control ); break; -#endif } else { fprintf( stderr, "Invalid general control name: %s\n", control ); @@ -788,11 +781,7 @@ main( int argc, char **argv ) rc = 0; - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -806,7 +795,6 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -816,8 +804,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 ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 501852cc64..68633b8439 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -78,9 +78,7 @@ 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" @@ -113,18 +111,15 @@ 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, crit; + int rc, i, remove, havedn, authmethod, version, want_bindpw, debug, manageDSAit, noop, 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 = referrals = 0; + debug = manageDSAit = noop = referrals = 0; authmethod = -1; version = -1; @@ -231,7 +226,6 @@ 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" ); @@ -242,7 +236,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); @@ -735,11 +729,7 @@ main(int argc, char **argv) } } - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -753,7 +743,6 @@ main(int argc, char **argv) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -763,8 +752,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 ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index e862cc215f..dda3651ab5 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -42,9 +42,7 @@ 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,9 +91,7 @@ main( int argc, char *argv[] ) int version = -1; int authmethod = -1; int manageDSAit = 0; -#ifdef LDAP_CONTROL_NOOP - int noop=0; -#endif + int noop = 0; int crit; char *control, *cvalue; #ifdef HAVE_CYRUS_SASL @@ -228,7 +224,6 @@ 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" ); @@ -239,7 +234,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); @@ -734,11 +729,7 @@ main( int argc, char *argv[] ) } } - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -752,7 +743,6 @@ main( int argc, char *argv[] ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -762,8 +752,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 ); if( err != LDAP_OPT_SUCCESS ) { diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 543e6921b2..05ebceb997 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -75,9 +75,7 @@ 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" @@ -188,7 +186,7 @@ main( int argc, char **argv ) { char *infile, *filtpattern, **attrs = NULL, line[BUFSIZ]; FILE *fp = NULL; - int rc, i, first, scope, deref, attrsonly, manageDSAit, crit; + int rc, i, first, scope, deref, attrsonly, manageDSAit, noop, crit; int referrals, timelimit, sizelimit, debug; int authmethod, version, want_bindpw; LDAP *ld = NULL; @@ -197,13 +195,11 @@ 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 = ldif = want_bindpw = 0; + attrsonly = manageDSAit = noop = ldif = want_bindpw = 0; prog = lutil_progname( "ldapsearch", argc, argv ); @@ -406,7 +402,6 @@ 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" ); @@ -417,7 +412,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); @@ -948,11 +943,7 @@ main( int argc, char **argv ) } } - if ( manageDSAit || valuesReturnFilter -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop || valuesReturnFilter ) { int err; int i=0; LDAPControl c1,c2,c3; @@ -968,7 +959,6 @@ main( int argc, char **argv ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -978,7 +968,6 @@ main( int argc, char **argv ) c2.ldctl_value.bv_len = 0; c2.ldctl_iscritical = noop > 1; } -#endif if ( valuesReturnFilter ) { ctrls[i++]=&c3; @@ -1058,12 +1047,10 @@ 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 9143e2a25e..59713212b6 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -36,9 +36,7 @@ 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" @@ -96,9 +94,7 @@ main( int argc, char *argv[] ) int referrals = 0; LDAP *ld = NULL; int manageDSAit=0; -#ifdef LDAP_CONTROL_NOOP int noop=0; -#endif char *control, *cvalue; int crit; @@ -188,7 +184,6 @@ 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" ); @@ -199,7 +194,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); @@ -668,11 +663,7 @@ main( int argc, char *argv[] ) goto skip; } - if ( manageDSAit -#ifdef LDAP_CONTROL_NOOP - || noop -#endif - ) { + if ( manageDSAit || noop ) { int err, i = 0; LDAPControl c1, c2; LDAPControl *ctrls[3]; @@ -686,7 +677,6 @@ main( int argc, char *argv[] ) c1.ldctl_iscritical = manageDSAit > 1; } -#ifdef LDAP_CONTROL_NOOP if ( noop ) { ctrls[i++] = &c2; ctrls[i] = NULL; @@ -696,7 +686,6 @@ 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 ); -- 2.39.5