#include "portable.h"
#include <stdio.h>
-#include <stdlib.h> /* get atoi() */
+
+#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/string.h>
ldap_set_option(ld, LDAP_OPT_DEREF, &savederef);
return(NULL);
} else if (matches == 1) {
- if (ldap_search_s(ld, ldap_get_dn(ld, ldap_first_entry(ld, res)), LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
+ dn = ldap_get_dn(ld, ldap_first_entry(ld, res));
+ rc = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", 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)
fflush(stdout);
fetch_buffer(response, sizeof(response), stdin);
if ((response[0] == 'n') || (response[0] == 'N'))
+ {
+ ldap_memfree(dn);
return(NULL);
+ }
}
#ifdef DEBUG
if (debug & D_FIND) {
if (ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
ldap_perror(ld, "ldap_search_s");
ldap_msgfree(res);
- return(NULL);
+ res = NULL;
}
- Free(dn);
+ ldap_memfree(dn);
return(res);
}
else if (matches > 0) {
}
void
-print_list( LDAPMessage *list, char *names[], int *matches )
+print_list( LDAPMessage *list, char **names, int *matches )
{
char **rdns, **cpp;
char resp[SMALL_BUF_SIZE];
}
*matches = i - 1;
names[i] = NULL;
+ return;
}
int
-find_all_subscribers( char *sub[], char *group )
+find_all_subscribers( char **sub, char *group )
{
int count;
LDAPMessage *result;