Changes included in OpenLDAP 1.2
CVS Tag: OPENLDAP_REL_ENG_1_2
Add ldappasswd() tool
+ Add client/tools password prompting
+ Update client/tools Kerberos option handling
Changes included in OpenLDAP 1.1.3
CVS Tag: OPENLDAP_REL_ENG_1_1_3
int
main( int argc, char **argv )
{
- char *usage = "usage: %s [-n] [-v] [-k] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
+ char *usage = "usage: %s [-n] [-v] [-k] [-W] [-d debug-level] [-f file] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [dn]...\n";
char buf[ 4096 ];
FILE *fp;
- int i, rc, authmethod;
+ int i, rc, authmethod, want_bindpw;
- not = verbose = contoper = 0;
+ not = verbose = contoper = want_bindpw = 0;
fp = NULL;
authmethod = LDAP_AUTH_SIMPLE;
- while (( i = getopt( argc, argv, "nvkKch:p:D:w:d:f:" )) != EOF ) {
+ while (( i = getopt( argc, argv, "WnvkKch:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
case 'k': /* kerberos bind */
#ifdef HAVE_KERBEROS
case 'v': /* verbose mode */
verbose++;
break;
+ case 'W':
+ want_bindpw++;
+ break;
default:
fprintf( stderr, usage, argv[0] );
exit( 1 );
ld->ld_deref = LDAP_DEREF_NEVER; /* prudent, but probably unnecessary */
+ 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 );
{
char *infile, *rbuf, *start, *p, *q;
FILE *fp;
- int rc, i, use_ldif, authmethod;
- char *usage = "usage: %s [-abcknrvF] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n";
+ int rc, i, use_ldif, authmethod, want_bindpw;
+ char *usage = "usage: %s [-abcknrvWF] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n";
if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) {
prog = argv[ 0 ];
new = ( strcmp( prog, "ldapadd" ) == 0 );
infile = NULL;
- not = verbose = valsfromfiles = 0;
+ not = verbose = valsfromfiles = want_bindpw = 0;
authmethod = LDAP_AUTH_SIMPLE;
- while (( i = getopt( argc, argv, "FabckKnrtvh:p:D:w:d:f:" )) != EOF ) {
+ while (( i = getopt( argc, argv, "WFabckKnrtvh:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
case 'a': /* add */
new = 1;
case 'v': /* verbose mode */
verbose++;
break;
+ case 'W':
+ want_bindpw++;
+ break;
default:
fprintf( stderr, usage, prog );
exit( 1 );
ld->ld_deref = LDAP_DEREF_NEVER; /* this seems prudent */
+ 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 );
int
main(int argc, char **argv)
{
- char *usage = "usage: %s [-nvkc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
+ char *usage = "usage: %s [-nvkWc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
char *myname,*infile, *entrydn, *rdn, buf[ 4096 ];
FILE *fp;
- int rc, i, remove, havedn, authmethod;
+ int rc, i, remove, havedn, authmethod, want_bindpw;
infile = NULL;
- not = contoper = verbose = remove = 0;
+ not = contoper = verbose = remove = want_bindpw = 0;
authmethod = LDAP_AUTH_SIMPLE;
myname = (myname = strrchr(argv[0], '/')) == NULL ? argv[0] : ++myname;
- while (( i = getopt( argc, argv, "kKcnvrh:p:D:w:d:f:" )) != EOF ) {
+ while (( i = getopt( argc, argv, "WkKcnvrh:p:D:w:d:f:" )) != EOF ) {
switch( i ) {
case 'k': /* kerberos bind */
#ifdef HAVE_KERBEROS
case 'r': /* remove old RDN */
remove++;
break;
+ case 'W':
+ want_bindpw++;
+ break;
default:
fprintf( stderr, usage, argv[0] );
exit( 1 );
ld->ld_deref = LDAP_DEREF_NEVER; /* this seems prudent */
+ 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 );
#define DEFSEP "="
-
-static void
-usage( char *s )
+static void usage( s )
+char *s;
{
fprintf( stderr, "usage: %s [options] filter [attributes...]\nwhere:\n", s );
fprintf( stderr, " filter\tRFC-1558 compliant LDAP search filter\n" );
static int verbose, not, includeufn, allow_binary, vals2tmp, ldif;
int
-main( int argc, char **argv )
+main( argc, argv )
+int argc;
+char **argv;
{
char *infile, *filtpattern, **attrs, line[ BUFSIZ ];
FILE *fp;
- int rc, i, first, scope, deref, attrsonly;
+ int rc, i, first, scope, kerberos, deref, attrsonly;
int ldap_options, timelimit, sizelimit, authmethod;
LDAP *ld;
infile = NULL;
- verbose = allow_binary = not = vals2tmp =
+ deref = verbose = allow_binary = not = kerberos = vals2tmp =
attrsonly = ldif = 0;
#ifdef LDAP_REFERRALS
deref = sizelimit = timelimit = -1;
scope = LDAP_SCOPE_SUBTREE;
authmethod = LDAP_AUTH_SIMPLE;
+ scope = LDAP_SCOPE_SUBTREE;
- while (( i = getopt( argc, argv, "KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:")) != EOF ) {
+ while (( i = getopt( argc, argv,
+#ifdef HAVE_KERBEROS
+ "KknuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
+#else
+ "nuvtRABLD:s:f:h:b:d:p:F:a:w:l:z:S:"
+#endif
+ )) != EOF ) {
switch( i ) {
case 'n': /* do Not do any searches */
++not;
fprintf( stderr, "compile with -DLDAP_DEBUG for debugging\n" );
#endif /* LDAP_DEBUG */
break;
- case 'k': /* use kerberos bind */
#ifdef HAVE_KERBEROS
- authmethod = LDAP_AUTH_KRBV4;
-#else
- fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
-#endif
+ case 'k': /* use kerberos bind */
+ kerberos = 2;
break;
case 'K': /* use kerberos bind, 1st part only */
-#ifdef HAVE_KERBEROS
- authmethod = LDAP_AUTH_KRBV41;
-#else
- fprintf (stderr, "%s was not compiled with Kerberos support\n", argv[0]);
-#endif
+ kerberos = 1;
break;
+#endif
case 'u': /* include UFN */
++includeufn;
break;
}
ld->ld_options = ldap_options;
+ if ( !kerberos ) {
+ authmethod = LDAP_AUTH_SIMPLE;
+ } else if ( kerberos == 1 ) {
+ authmethod = LDAP_AUTH_KRBV41;
+ } else {
+ authmethod = LDAP_AUTH_KRBV4;
+ }
if ( ldap_bind_s( ld, binddn, passwd, authmethod ) != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
exit( 1 );
ldap_unbind( ld );
exit( rc );
-
- /* UNREACHABLE */
- return(0);
}