]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/test.c
More cleanup in ldap_pvt_tls_destroy()
[openldap] / libraries / libldap / test.c
index c21f88c9bfbe96b750019450ccbf416598f514f9..05e9cf90f86ba1b440ea4eec4b2ba269ae8550ec 100644 (file)
@@ -1,6 +1,6 @@
 /* $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 ));
 
@@ -51,7 +53,7 @@ static char *dnsuffix;
 
 #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);
 
@@ -65,7 +67,7 @@ getline( char *line, int len, FILE *fp, char *prompt )
 #endif
 
 static char **
-get_list( char *prompt )
+get_list( const char *prompt )
 {
        static char     buf[256];
        int             num;
@@ -111,7 +113,7 @@ free_list( char **list )
 
 
 static int
-file_read( char *path, struct berval *bv )
+file_read( const char *path, struct berval *bv )
 {
        FILE            *fp;
        ber_slen_t      rlen;
@@ -157,7 +159,10 @@ file_read( char *path, struct berval *bv )
 
 
 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;
@@ -229,12 +234,15 @@ get_modlist( char *prompt1, char *prompt2, char *prompt3 )
 
 
 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
@@ -599,19 +607,6 @@ main( int argc, char **argv )
                        timeout.tv_sec = atoi( line );
                        break;
 
-               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 ) {
@@ -701,7 +696,7 @@ main( int argc, char **argv )
                                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;
@@ -731,7 +726,7 @@ main( int argc, char **argv )
 
                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" );
     printf( "          [d]ebug       [e]nable cache    set ms[g]id\n" );
@@ -799,7 +794,7 @@ handle_result( LDAP *ld, LDAPMessage *lm )
 }
 
 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 );