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);
}
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 */
}
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" );
}
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",