X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Ftest.c;h=9ee6e3a739af1f1c9fd082ccb2263e8d68ada797;hb=ae471f78c32d7531c729aa88116b8b413cc200bf;hp=8cc5eb480fbe87602cef17a65985fc31f76aced0;hpb=dc0eacd40b625258355eea866d62188e5aa7ce3b;p=openldap diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c index 8cc5eb480f..9ee6e3a739 100644 --- a/libraries/libldap/test.c +++ b/libraries/libldap/test.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2005 The OpenLDAP Foundation. + * Copyright 1998-2008 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,7 +59,7 @@ static char *dnsuffix; static char * get_line( char *line, int len, FILE *fp, const char *prompt ) { - printf(prompt); + fputs(prompt, stdout); if ( fgets( line, len, fp ) == NULL ) return( NULL ); @@ -169,7 +169,7 @@ get_modlist( { static char buf[256]; int num; - LDAPMod tmp; + LDAPMod tmp = { 0 }; LDAPMod **result; struct berval **bvals; @@ -205,6 +205,10 @@ get_modlist( 6 ) == 0 ) { if ( file_read( tmp.mod_values[i] + 6, bvals[i] ) < 0 ) { + free( bvals ); + for ( i = 0; isimple, 1->krbv41, 2->krbv42, 3->krbv41&2)? " ); - if (( authmethod = atoi( dn )) == 3 ) { - authmethod = LDAP_AUTH_KRBV4; - } else { - authmethod |= 0x80; - } -#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ authmethod = LDAP_AUTH_SIMPLE; -#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ get_line( dn, sizeof(dn), stdin, "re-bind dn? " ); strcat( dn, dnsuffix ); @@ -283,7 +277,8 @@ main( int argc, char **argv ) char passwd[64], dn[256], rdn[64], attr[64], value[256]; char filter[256], *host, **types; char **exdn; - char *usage = "usage: %s [-u] [-h host] [-d level] [-s dnsuffix] [-p port] [-t file] [-T file]\n"; + static const char usage[] = + "usage: %s [-u] [-h host] [-d level] [-s dnsuffix] [-p port] [-t file] [-T file]\n"; int bound, all, scope, attrsonly; LDAPMessage *res; LDAPMod **mods, **attrs; @@ -408,13 +403,7 @@ main( int argc, char **argv ) break; case 'b': /* asynch bind */ -#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND - get_line( line, sizeof(line), stdin, - "method (0->simple, 1->krbv41, 2->krbv42)? " ); - method = atoi( line ) | 0x80; -#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ method = LDAP_AUTH_SIMPLE; -#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ get_line( dn, sizeof(dn), stdin, "dn? " ); strcat( dn, dnsuffix ); @@ -434,17 +423,7 @@ main( int argc, char **argv ) break; case 'B': /* synch bind */ -#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND - get_line( line, sizeof(line), stdin, - "method 0->simple 1->krbv41 2->krbv42 3->krb? " ); - method = atoi( line ); - if ( method == 3 ) - method = LDAP_AUTH_KRBV4; - else - method = method | 0x80; -#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ method = LDAP_AUTH_SIMPLE; -#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */ get_line( dn, sizeof(dn), stdin, "dn? " ); strcat( dn, dnsuffix );