/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2010 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
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 );
{
static char buf[256];
int num;
- LDAPMod tmp;
+ LDAPMod tmp = { 0 };
LDAPMod **result;
struct berval **bvals;
6 ) == 0 ) {
if ( file_read( tmp.mod_values[i] + 6,
bvals[i] ) < 0 ) {
+ free( bvals );
+ for ( i = 0; i<num; i++ )
+ free( result[ i ] );
+ free( result );
return( NULL );
}
} else {
printf("rebind for request=%ld msgid=%ld url=%s\n",
request, (long) msgid, url );
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
- get_line( dn, sizeof(dn), stdin,
- "re-bind method (0->simple, 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 );
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;
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 );
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 );
ludp->lud_scope == LDAP_SCOPE_BASE ? "baseObject"
: ludp->lud_scope == LDAP_SCOPE_ONELEVEL ? "oneLevel"
: ludp->lud_scope == LDAP_SCOPE_SUBTREE ? "subtree"
+#ifdef LDAP_SCOPE_SUBORDINATE
: ludp->lud_scope == LDAP_SCOPE_SUBORDINATE ? "children"
+#endif
: "**invalid**" );
printf( "\tfilter: <%s>\n", ludp->lud_filter );
ldap_free_urldesc( ludp );