/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* local functions */
#ifndef HAVE_GETLINE
-static char *getline LDAP_P(( char *line, int len, FILE *fp, char *prompt ));
+static char *getline LDAP_P(( char *line, int len, FILE *fp, const char *prompt ));
#endif
-static char **get_list LDAP_P(( char *prompt ));
-static int file_read LDAP_P(( char *path, struct berval *bv ));
-static LDAPMod **get_modlist LDAP_P(( char *prompt1, char *prompt2, char *prompt3 ));
+static char **get_list LDAP_P(( const char *prompt ));
+static int file_read LDAP_P(( const char *path, struct berval *bv ));
+static LDAPMod **get_modlist LDAP_P(( const char *prompt1,
+ const char *prompt2, const char *prompt3 ));
static void handle_result LDAP_P(( LDAP *ld, LDAPMessage *lm ));
-static void print_ldap_result LDAP_P(( LDAP *ld, LDAPMessage *lm, char *s ));
+static void print_ldap_result LDAP_P(( LDAP *ld, LDAPMessage *lm,
+ const char *s ));
static void print_search_entry LDAP_P(( LDAP *ld, LDAPMessage *res ));
static void free_list LDAP_P(( char **list ));
#ifndef HAVE_GETLINE
static char *
-getline( char *line, int len, FILE *fp, char *prompt )
+getline( char *line, int len, FILE *fp, const char *prompt )
{
printf(prompt);
#endif
static char **
-get_list( char *prompt )
+get_list( const char *prompt )
{
static char buf[256];
int num;
static int
-file_read( char *path, struct berval *bv )
+file_read( const char *path, struct berval *bv )
{
FILE *fp;
ber_slen_t rlen;
static LDAPMod **
-get_modlist( char *prompt1, char *prompt2, char *prompt3 )
+get_modlist(
+ const char *prompt1,
+ const char *prompt2,
+ const char *prompt3 )
{
static char buf[256];
int num;
static int
-bind_prompt( LDAP *ld, LDAP_CONST char *url, int request, ber_int_t msgid)
+bind_prompt( LDAP *ld,
+ LDAP_CONST char *url,
+ ber_tag_t request, ber_int_t msgid,
+ void *params )
{
static char dn[256], passwd[256];
int authmethod;
- printf("rebind for request=%d msgid=%ld url=%s\n",
+ printf("rebind for request=%ld msgid=%ld url=%s\n",
request, (long) msgid, url );
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
timeout.tv_sec = atoi( line );
break;
-#ifdef LDAP_UFN
- case 'U': /* set ufn search prefix */
- getline( line, sizeof(line), stdin, "ufn prefix? " );
- ldap_ufn_setprefix( ld, line );
- break;
-
- case 'u': /* user friendly search w/optional timeout */
- getline( dn, sizeof(dn), stdin, "ufn? " );
- strcat( dn, dnsuffix );
- types = get_list( "attrs to return? " );
- getline( line, sizeof(line), stdin,
- "attrsonly (0=attrs&values, 1=attrs only)? " );
- attrsonly = atoi( line );
-
- if ( command2 == 't' ) {
- id = ldap_ufn_search_c( ld, dn, types,
- attrsonly, &res, ldap_ufn_timeout,
- &timeout );
- } else {
- id = ldap_ufn_search_s( ld, dn, types,
- attrsonly, &res );
- }
- if ( res == NULL )
- ldap_perror( ld, "ldap_ufn_search" );
- else {
- printf( "\nresult: err %d\n", id );
- handle_result( ld, res );
- res = NULL;
- }
- free_list( types );
- break;
-#endif
-
- case 'l': /* URL search */
- getline( line, sizeof(line), stdin,
- "attrsonly (0=attrs&values, 1=attrs only)? " );
- attrsonly = atoi( line );
- getline( line, sizeof(line), stdin, "LDAP URL? " );
- if (( id = ldap_url_search( ld, line, attrsonly ))
- == -1 ) {
- ldap_perror( ld, "ldap_url_search" );
- } else {
- printf( "URL search initiated with id %d\n", id );
- }
- break;
-
case 'p': /* parse LDAP URL */
getline( line, sizeof(line), stdin, "LDAP URL? " );
if (( i = ldap_url_parse( line, &ludp )) != 0 ) {
getline( line, sizeof(line), stdin,
"Prompt for bind credentials when chasing referrals (0=no, 1=yes)?" );
if ( atoi( line ) != 0 ) {
- ldap_set_rebind_proc( ld, bind_prompt );
+ ldap_set_rebind_proc( ld, bind_prompt, NULL );
}
}
break;
case '?': /* help */
printf( "Commands: [ad]d [ab]andon [b]ind\n" );
- printf( " [B]ind async [c]ompare [l]URL search\n" );
+ printf( " [B]ind async [c]ompare\n" );
printf( " [modi]fy [modr]dn [rem]ove\n" );
printf( " [res]ult [s]earch [q]uit/unbind\n\n" );
-#ifdef LDAP_UFN
- printf( " [u]fn search [ut]fn search with timeout [U]fn prefix\n" );
-#endif
printf( " [d]ebug [e]nable cache set ms[g]id\n" );
printf( " d[n]suffix [t]imeout [v]ersion\n" );
printf( " [?]help [o]ptions [O]cache options\n" );
}
static void
-print_ldap_result( LDAP *ld, LDAPMessage *lm, char *s )
+print_ldap_result( LDAP *ld, LDAPMessage *lm, const char *s )
{
ldap_result2error( ld, lm, 1 );
ldap_perror( ld, s );