-#if 0
- /* It appears that this is unnecessary, and returns an error even when the search succeeds? */
- if (i != LDAP_SUCCESS) {
- CtdlLogPrintf(CTDL_DEBUG, "LDAP search failed: %s (%d)\n", ldap_err2string(i), i);
- ldap_unbind(ldserver);
- if (search_result != NULL) {
- /* this should never happen - warning memory leak! */
- CtdlLogPrintf(CTDL_DEBUG, "search returned error but search_result is not null!\n");
- }
- return(i);
- }
-#endif
-
+ /* Ignore the return value of ldap_search_ext_s(). Sometimes it returns an error even when
+ * the search succeeds. Instead, we check to see whether search_result is still NULL.
+ */