Problem trying to find users in LDAP using the following code...
printf("Enter ID to search for:\n");
gets(&unid);
sprintf(buffer, "(CN=%s)", &unid);
printf("Searching for: %s\n", buffer);
if(ldap_search_s(ld, "ou=users,dc=domain,dc=com", LDAP_SCOPE_BASE,
buffer, NULL, 0, &res) != LDAP_SUCCESS) {
printf("Search failed\n");
ldap_perror(ld,"ldap_search_s");
}
printf("Search made\n");
if(ldap_first_entry(ld, res) == 0) {
printf("No results found for %s\n", buffer);
}
I have done the following, verified the user does indeed exist in the default
DN to search within', verified the "buffer" var is formated correctly using
the sprint() call. If I use "\"(CN=%s)\"", buffer I recieve search filter