From 1e562b0d1f11994c45545331b3243b8711ef03ea Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 16 Jul 2000 00:14:08 +0000 Subject: [PATCH] Make it all work. --- clients/tools/ldapdelete.c | 2 ++ clients/tools/ldapmodify.c | 2 ++ clients/tools/ldapmodrdn.c | 14 ++++++++++---- clients/tools/ldappasswd.c | 5 +++++ clients/tools/ldapsearch.c | 7 +++++++ tests/scripts/defines.sh | 15 +++++++-------- tests/scripts/test001-slapadd | 3 +-- 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index dee2fa9381..686f9ff764 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -333,6 +333,8 @@ main( int argc, char **argv ) #endif break; default: + fprintf( stderr, "%s: unrecongized option -%c\n", + prog, optopt ); usage( prog ); return( EXIT_FAILURE ); } diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 274ecb13cf..3134361851 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -391,6 +391,8 @@ main( int argc, char **argv ) #endif break; default: + fprintf( stderr, "%s: unrecongized option -%c\n", + prog, optopt ); usage( prog ); } } diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index b0cab08e6a..cc8cc724fa 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -63,15 +63,15 @@ usage( const char *s ) " If not given, the list of modifications is read from stdin or\n" " from the file specified by \"-f file\" (see man page).\n" "Rename options:\n" +" -c\t\tcontinuous operation mode (do not stop on errors)\n" +" -f file\t\tread operations from `file'\n" " -r\t\tremove old RDN\n" " -s newsuperior\tnew superior entry\n" "common options:\n" -" -c\t\tcontinuous operation mode (do not stop on errors)\n" " -C\t\tchase referrals\n" " -d level\tset LDAP debugging level to `level'\n" " -D binddn\tbind DN\n" -" -f file\t\tread operations from `file'\n" " -h host\t\tLDAP server\n" " -k\t\tuse Kerberos authentication\n" " -K\t\tlike -k, but do only step 1 of the Kerberos bind\n" @@ -109,9 +109,12 @@ main(int argc, char **argv) prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : ++prog; - while (( i = getopt( argc, argv, "rs:" "cCd:D:f:h:kKMnO:p:P:U:vw:WxX:Y:Z" )) != EOF ) { + while (( i = getopt( argc, argv, "cf:rs:" "Cd:D:h:kKMnO:p:P:U:vw:WxX:Y:Z" )) != EOF ) { switch( i ) { /* Modrdn Options */ + case 'c': + contoper++; + break; case 's': /* newSuperior */ if( version == LDAP_VERSION2 ) { fprintf( stderr, "%s: -X incompatible with LDAPv%d\n", @@ -346,6 +349,8 @@ main(int argc, char **argv) #endif break; default: + fprintf( stderr, "%s: unrecongized option -%c\n", + prog, optopt ); usage( argv[0] ); return( EXIT_FAILURE ); } @@ -374,7 +379,8 @@ main(int argc, char **argv) } ++havedn; } else if ( argc - optind != 0 ) { - fprintf( stderr, "%s: invalid number of arguments, only two allowed\n", prog); + fprintf( stderr, "%s: invalid number of arguments (%d), " + "only two allowed\n", prog, argc-optind ); usage( argv[0] ); return( EXIT_FAILURE ); } diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index aeeb39e69b..6a995374f6 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -61,6 +61,7 @@ int main( int argc, char *argv[] ) { int rc; + char *prog = NULL; char *ldaphost = NULL; char *dn = NULL; @@ -97,6 +98,8 @@ main( int argc, char *argv[] ) char *retoid = NULL; struct berval *retdata = NULL; + prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : ++prog; + if (argc == 1) usage (argv[0]); @@ -235,6 +238,8 @@ main( int argc, char *argv[] ) break; default: + fprintf( stderr, "%s: unrecongized option -%c\n", + prog, optopt ); usage (argv[0]); } } diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index e31800f7c8..4b51feb1f3 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -171,6 +171,8 @@ main( int argc, char **argv ) scope = LDAP_SCOPE_SUBTREE; authmethod = -1; + prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : ++prog; + while (( i = getopt( argc, argv, "Aa:b:f:Ll:S:s:T:tuV:z:" "Cd:D:h:kKMnO:p:P:U:vw:WxX:Y:Z")) != EOF ) { @@ -193,6 +195,9 @@ main( int argc, char **argv ) case 'A': /* retrieve attribute names only -- no values */ ++attrsonly; break; + case 'b': /* search base */ + base = strdup( optarg ); + break; case 'f': /* input file */ infile = strdup( optarg ); break; @@ -456,6 +461,8 @@ main( int argc, char **argv ) #endif break; default: + fprintf( stderr, "%s: unrecongized option -%c\n", + prog, optopt ); usage( argv[0] ); } } diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh index f88faf8e96..b772af34b1 100755 --- a/tests/scripts/defines.sh +++ b/tests/scripts/defines.sh @@ -21,9 +21,8 @@ else REFSLAVECONF=$DATADIR/slapd-ref-slave.conf fi -if test "$LDAP_PROTO" ; then - PROTO="-P $LDAP_PROTO" -fi +TOOLARGS="-x $LDAP_TOOLARGS" +TOOLPROTO="-P 3" PASSWDCONF=$DATADIR/slapd-passwd.conf @@ -36,11 +35,11 @@ LDIF2LDBM="../servers/slapd/tools/slapadd $LDAP_VERBOSE" CMP="diff -i -q" SLAPD=../servers/slapd/slapd SLURPD=../servers/slurpd/slurpd -LDAPPASSWD="$CLIENTDIR/ldappasswd" -LDAPSEARCH="$CLIENTDIR/ldapsearch $PROTO -LLL" -LDAPMODIFY="$CLIENTDIR/ldapmodify $PROTO" -LDAPADD="$CLIENTDIR/ldapadd $PROTO" -LDAPMODRDN="$CLIENTDIR/ldapmodrdn $PROTO" +LDAPPASSWD="$CLIENTDIR/ldappasswd $TOOLARGS" +LDAPSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $TOOLARGS -LLL" +LDAPMODIFY="$CLIENTDIR/ldapmodify $TOOLPROTO $TOOLARGS" +LDAPADD="$CLIENTDIR/ldapadd $TOOLPROTO $TOOLARGS" +LDAPMODRDN="$CLIENTDIR/ldapmodrdn $TOOLPROTO $TOOLARGS" SLAPDTESTER=$PROGDIR/slapd-tester LVL=${SLAPD_DEBUG-5} ADDR=127.0.0.1 diff --git a/tests/scripts/test001-slapadd b/tests/scripts/test001-slapadd index efe811eae7..052624be7c 100755 --- a/tests/scripts/test001-slapadd +++ b/tests/scripts/test001-slapadd @@ -34,8 +34,7 @@ PID=$! echo "Using ldapsearch to retrieve all the entries..." for i in 0 1 2 3 4 5; do - $LDAPSEARCH -S "" -b "$BASEDN" -h localhost -p $PORT \ - 'objectClass=*' > $SEARCHOUT 2>&1 + $LDAPSEARCH -S "" -b "$BASEDN" -h localhost:$PORT > $SEARCHOUT 2>&1 RC=$? if test $RC = 1 ; then echo "Waiting 5 seconds for slapd to start..." -- 2.39.5