summaryrefslogtreecommitdiff
path: root/usr.sbin/ldapd/search.c
diff options
context:
space:
mode:
authorMartin Hedenfal <martinh@cvs.openbsd.org>2010-11-05 08:17:47 +0000
committerMartin Hedenfal <martinh@cvs.openbsd.org>2010-11-05 08:17:47 +0000
commitc07e6e5ed81680bfa1f6a5f042b10acbf5f3f141 (patch)
treec7eaaec1225f37f9fa7c9ef1bf3cf119caaaa678 /usr.sbin/ldapd/search.c
parent9f5f109c8466d04bf4c028ddaf178e48192bd67b (diff)
If the base DN in a search request doesn't exist, return early.
Diffstat (limited to 'usr.sbin/ldapd/search.c')
-rw-r--r--usr.sbin/ldapd/search.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/ldapd/search.c b/usr.sbin/ldapd/search.c
index 51ca2a39192..9fe2a0d95a0 100644
--- a/usr.sbin/ldapd/search.c
+++ b/usr.sbin/ldapd/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.12 2010/11/04 15:35:00 martinh Exp $ */
+/* $OpenBSD: search.c,v 1.13 2010/11/05 08:17:46 martinh Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -951,12 +951,17 @@ ldap_search(struct request *req)
btval_reset(&val);
reason = LDAP_SUCCESS;
} else if (errno == ENOENT)
- reason = LDAP_SUCCESS;
+ reason = LDAP_NO_SUCH_OBJECT;
else
reason = LDAP_OTHER;
goto done;
}
+ if (!namespace_exists(search->ns, search->basedn)) {
+ reason = LDAP_NO_SUCH_OBJECT;
+ goto done;
+ }
+
search->plan = search_planner(search->ns, search->filter);
if (search->plan == NULL) {
reason = LDAP_PROTOCOL_ERROR;