static int searchscope = LDAP_SCOPE_SUBTREE;
static int persistent = 0;
static int noreferrals = 0;
-static int debug = 0;
+static int show_debug_messages = 0;
static int port = LDAP_PORT;
static int strip_nt_domain = 0;
static int edir_universal_passwd = 0;
snprintf(filter, sizeof(filter), usersearchfilter, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login, escaped_login);
retrysrch:
- if (debug)
+ if (show_debug_messages)
fprintf(stderr, "user filter '%s', searchbase '%s'\n", filter, searchbase);
rc = ldap_search_s(ld, searchbase, searchscope, filter, NULL, 0, &res);
snprintf(searchbase, 8192, "%s=%s, %s", userdnattr, login, userbasedn);
retrydnattr:
- if (debug)
+ if (show_debug_messages)
fprintf(stderr, "searchbase '%s'\n", searchbase);
rc = ldap_search_s(ld, searchbase, searchscope, NULL, NULL, 0, &res);
}
if (rc == LDAP_SUCCESS) {
entry = ldap_first_entry(ld, res);
if (entry) {
- if (debug)
+ if (show_debug_messages)
printf("ldap dn: %s\n", ldap_get_dn(ld, entry));
if (edir_universal_passwd) {
/* actually talk to NMAS to get a password */
nmas_res = nds_get_password(ld, ldap_get_dn(ld, entry), &universal_password_len, universal_password);
if (nmas_res == LDAP_SUCCESS && universal_password) {
- if (debug)
+ if (show_debug_messages)
printf("NMAS returned value %s\n", universal_password);
values[0] = universal_password;
} else {
- if (debug)
+ if (show_debug_messages)
printf("Error reading Universal Password: %d = %s\n", nmas_res, ldap_err2string(nmas_res));
}
} else {
return NULL;
}
if (!values) {
- if (debug)
+ if (show_debug_messages)
printf("No attribute value found\n");
if (edir_universal_passwd)
free(universal_password);
}
value++;
}
- if (debug)
+ if (show_debug_messages)
printf("password: %s\n", password);
if (password)
password = xstrdup(password);
ld = NULL;
}
}
- if (debug)
+ if (show_debug_messages)
fprintf(stderr, "Connected OK\n");
}
}
break;
#endif
case 'd':
- debug = 1;
+ show_debug_messages = 1;
break;
case 'E':
strip_nt_domain = 1;