From: Kurt Zeilenga Date: Fri, 6 Aug 1999 00:19:54 +0000 (+0000) Subject: Add -W option to ldapsearch. X-Git-Tag: OPENLDAP_REL_ENG_1_2_7~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e948fa9f639bdca4fa2694c70b884de25f9c31c;p=thirdparty%2Fopenldap.git Add -W option to ldapsearch. (note: log for rev 1.4.2.5.2.1 indicated such was added. However, this change appears to be Kerberos related. in fact, it appears to back out previous Kerberos change... should be examined by Kerberos maintainer (if we had such). --- diff --git a/CHANGES b/CHANGES index 44217f7e04..3ed697877a 100644 --- a/CHANGES +++ b/CHANGES @@ -2,7 +2,7 @@ OpenLDAP Change Log Changes included in OpenLDAP 1.2 Release Engineering CVS Tag: OPENLDAP_REL_ENG_1_2 - + Added ldapsearch -W password prompting Changes included in OpenLDAP 1.2.6 CVS Tag: OPENLDAP_REL_ENG_1_2_6 diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 377d72dfe4..c96c58aad5 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -47,6 +47,7 @@ char *s; fprintf( stderr, " -z size lim\tsize limit (in entries) for search\n" ); fprintf( stderr, " -D binddn\tbind dn\n" ); fprintf( stderr, " -w passwd\tbind passwd (for simple authentication)\n" ); + fprintf( stderr, " -W\t\tprompt for bind passwd\n" ); #ifdef HAVE_KERBEROS fprintf( stderr, " -k\t\tuse Kerberos instead of Simple Password authentication\n" ); #endif @@ -92,12 +93,12 @@ char **argv; char *infile, *filtpattern, **attrs, line[ BUFSIZ ]; FILE *fp; int rc, i, first, scope, kerberos, deref, attrsonly, debug; - int ldap_options, timelimit, sizelimit, authmethod; + int ldap_options, timelimit, sizelimit, authmethod, want_bindpw; LDAP *ld; infile = NULL; deref = verbose = allow_binary = not = kerberos = vals2tmp = - attrsonly = ldif = debug = 0; + attrsonly = ldif = want_bindpw = debug = 0; #ifdef LDAP_REFERRALS ldap_options = LDAP_OPT_REFERRALS; @@ -112,9 +113,9 @@ char **argv; while (( i = getopt( argc, argv, #ifdef HAVE_KERBEROS - "KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:" + "KknuvtRABLD:s:f:h:b:d:p:F:a:Ww:l:z:S:" #else - "nuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:" + "nuvtRABLD:s:f:h:b:d:p:F:a:Ww:l:z:S:" #endif )) != EOF ) { switch( i ) { @@ -211,6 +212,9 @@ char **argv; case 'w': /* bind password */ passwd = strdup( optarg ); break; + case 'W': /* prompt for password */ + want_bindpw++; + break; case 'l': /* time limit */ timelimit = atoi( optarg ); break; @@ -294,6 +298,11 @@ char **argv; } else { authmethod = LDAP_AUTH_KRBV4; } + + if (want_bindpw) { + passwd = getpass("Enter LDAP Password: "); + } + if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) { ldap_perror( ld, "ldap_bind" ); exit( 1 );