+/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
#include <sys/file.h>
#endif
-#include <lber.h>
#include <ldap.h>
-#include <ldapconfig.h>
+#include "ldap_defaults.h"
#include "ud.h"
/*
printf(" 64 authentication information\n");
printf(" 128 initialization information\n\n");
format("These are masks, and may be added to form multiple debug levels. For example, '-d 35' would perform a function trace, print out information about the find() function, and would print out information about the output routines too.", 75, 2);
- exit(0);
+ exit( EXIT_SUCCESS );
default:
fprintf(stderr, "Usage: %s [-c filter-config-file] [-d debug-level] [-l ldap-debug-level] [-s server] [-p port] [-V]\n", argv[0]);
- exit(-1);
+ exit( EXIT_FAILURE);
/* NOTREACHED */
}
}
printf(" Thank you!\n");
ldap_unbind(ld);
-#ifdef HAVE_KERBEROS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
destroy_tickets();
#endif
- exit(0);
+ exit( EXIT_SUCCESS );
/* NOTREACHED */
}
if (debug & D_TRACE)
printf("->status()\n");
#endif
- printf(" Current server is %s", server);
+ printf(" Current server is %s", server != NULL ? server : "<default>" );
if ( ld != NULL ) {
char *host = NULL;
ldap_get_option(ld, LDAP_OPT_HOST_NAME, &host);
- if (( host != NULL ) && (strcasecmp( host, server ) != 0 )) {
+ if ( host != NULL &&
+ ( server == NULL || strcasecmp( host, server ) != 0 ) )
+ {
printf( " (%s)", host );
}
}
{
register char *cp; /* utility pointers */
char **rdns; /* for parsing */
- char *output_string; /* for nice output */
+ char *output_string = NULL; /* for nice output */
int num_picked; /* # of selected base */
int j; /* used with num_picked */
int i = 1; /* index into choices array */
/*
* If s is NULL we need to prompt the user for an argument.
*/
- while (s == NULL) {
+ if (s == NULL) {
if (verbose) {
printf(" You need to specify how the base is to be changed. Valid choices are:\n");
printf(" ? - list the choices immediately below this level\n");
fetch_buffer(buf, sizeof(buf), stdin);
if ((buf != NULL) && (buf[0] != '\0'))
s = buf;
+ else
+ return;
}
/* set the output string */
* the user if they want to see more. They can also just
* type a number at that point too.
*/
- if (ldap_search_s(ld, *base, LDAP_SCOPE_ONELEVEL, "(|(objectClass=quipuNonLeafObject)(objectClass=externalNonLeafObject))", attrs, FALSE, &mp) != LDAP_SUCCESS) {
+ if (ldap_search_s(ld, *base, LDAP_SCOPE_ONELEVEL, NULL, attrs, FALSE, &mp) != LDAP_SUCCESS) {
int ld_errno = 0;
ldap_get_option(ld, LDAP_OPT_ERROR_NUMBER, &ld_errno);
if ((ld_errno == LDAP_TIMELIMIT_EXCEEDED) ||
#endif
if (ldebug) {
- ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &ldebug);
- ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldebug);
+ ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &ldebug );
+ ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &ldebug );
}
/*
* are meaningless since we will immediately be doing a null bind
* because we want to be sure to use TCP, not UDP.
*/
- if ((ld = ldap_open(server, ldap_port)) == NULL) {
- fprintf(stderr, " The LDAP Directory is temporarily unavailable. Please try again later.\n");
- exit(0);
+ if ((ld = ldap_init(server, ldap_port)) == NULL) {
+ fprintf(stderr, " Initialization of LDAP session failed.\n");
+ exit( EXIT_FAILURE );
/* NOTREACHED */
}
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");
- exit(0);
+ ldap_perror(ld, " ldap_bind_s");
+ exit( EXIT_FAILURE );
/* NOTREACHED */
}
{
fflush(stdout);
printf("\n\n INTERRUPTED!\n");
- (void) SIGNAL (SIGINT, attn);
+ (void) SIGNAL_REINSTALL (SIGINT, attn);
longjmp(env, 1);
}
col_size = win.ws_col;
}
- (void) SIGNAL (SIGWINCH, chwinsz);
+ (void) SIGNAL_REINSTALL (SIGWINCH, chwinsz);
}
#endif