]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
ldap: Treat "No such object" errors to search the same as if no results were returned.
authorTimo Sirainen <tss@iki.fi>
Fri, 15 Aug 2014 11:05:21 +0000 (14:05 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 15 Aug 2014 11:05:21 +0000 (14:05 +0300)
Trying to look up a nonexistent base returns this error.

src/auth/db-ldap.c

index 0bbae90ed21b2beef6afda37414541da10fc7504..da460ad4cba1a9ce27f5c540ffcf587cfda7b05d 100644 (file)
@@ -760,7 +760,9 @@ db_ldap_handle_request_result(struct ldap_connection *conn,
                final_result = TRUE;
                ret = ldap_result2error(conn->ld, res->msg, 0);
        }
-       if (ret != LDAP_SUCCESS && request->type == LDAP_REQUEST_TYPE_SEARCH) {
+       /* LDAP_NO_SUCH_OBJECT is returned for nonexistent base */
+       if (ret != LDAP_SUCCESS && ret != LDAP_NO_SUCH_OBJECT &&
+           request->type == LDAP_REQUEST_TYPE_SEARCH) {
                /* handle search failures here */
                struct ldap_request_search *srequest =
                        (struct ldap_request_search *)request;