]> git.sur5r.net Git - openldap/commitdiff
Don't depend error handling on exact resultCode.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 26 Apr 2000 09:21:19 +0000 (09:21 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 26 Apr 2000 09:21:19 +0000 (09:21 +0000)
clients/ud/find.c
clients/ud/main.c
clients/ud/mod.c
contrib/whois++/whois++.c

index 59a89ebf15c75d0fefab63720c286842fc83396e..a569458caf85e9ced82b72543e9733f69dee8c9f 100644 (file)
@@ -231,12 +231,7 @@ find( char *who, int quiet )
                        rc = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, NULL, read_attrs, FALSE, &res);
                        ldap_memfree(dn);
                        if (rc != LDAP_SUCCESS) {
-                               int ld_errno = 0;
-                               ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
-                               if (ld_errno == LDAP_UNAVAILABLE)
-                                       printf("  Could not contact the LDAP server to find \"%s\".\n", who);
-                               else
-                                       ldap_perror(ld, "ldap_search_s");
+                               ldap_perror(ld, "ldap_search_s");
                                return(NULL);
                        }
                        ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
index 2aeb8e0c09eadf40cf51255a633528a47f550f04..794b77d38cdda474e138a7b0ed5bffc7de3ac2ef 100644 (file)
@@ -660,12 +660,7 @@ initialize_client( void )
        }
        if (ldap_bind_s(ld, (char *) default_bind_object, NULL,
            LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
-               int ld_errno = 0;
-               ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
-
-               fprintf(stderr, "  The LDAP Directory is temporarily unavailable.  Please try again later.\n");
-               if (ld_errno != LDAP_UNAVAILABLE)
-                       ldap_perror(ld, "  ldap_bind_s");
+               ldap_perror(ld, "  ldap_bind_s");
                exit( EXIT_FAILURE );
                /* NOTREACHED */
        }
index 759f3f09434735ff95649ed7fb094df93c1b4624..a955b17161a42b375ec3dbb357e4971e39771bad 100644 (file)
@@ -788,23 +788,22 @@ check_URL( char *url )
 void
 mod_perror( LDAP *ld )
 {
-       int ld_errno = 0;
+       int ld_errno = LDAP_SUCCESS;
+       char *ld_errtext = NULL;
 
-       if(ld != NULL) {
-               ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
-       }
+       ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno );
 
-       if (( ld == NULL ) || ( ld_errno != LDAP_UNAVAILABLE &&
-           ld_errno != LDAP_UNWILLING_TO_PERFORM ))
-       {
-               ldap_perror( ld, "modify" );
-               return;
-       }
+       if( ld_errno != LDAP_SUCCESS ) {
+               ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ld_errtext );
+       }       
 
-       fprintf( stderr, "\n  modify: failed because part of the online directory is not able\n" );
-       fprintf( stderr, "  to be modified right now" );
-       if ( ld_errno == LDAP_UNAVAILABLE ) {
-               fprintf( stderr, " or is temporarily unavailable" );
+       fprintf( stderr, "  modify failed: %s (%d)\n",
+               ldap_err2string( ld_errno ), ld_errno );
+
+       if( ld_errtext != NULL ) {
+               fprintf( stderr, "    additional information: %s\n",
+                       ld_errtext );
        }
-       fprintf( stderr, ".\n  Please try again later.\n" );
+
+       fprintf( stderr, "  Please try again later.\n" );
 }
index 7e20bcc7429f2c2856f10de31dea8fe9fd17a37c..d353408a9423df7d16e77c4d8eb9dc9a07f830cb 100644 (file)
@@ -195,13 +195,6 @@ char       **argv;
        case LDAP_SUCCESS:
                break;
 
-       case LDAP_UNAVAILABLE:
-               printFormatted( lineLength, TRUE, stdout,
-                       "Sorry, the X.500 service is temporarily unavailable. \
-Please try again later." );
-               syslog( LOG_NOTICE, "X.500 service temporarily unavailable" );
-               exit( 1 );
-
        default:
                printFormatted( lineLength, TRUE, stdout,
                        "Bind to Directory failed, %s",