From 4103e180a419b8f3b3df2ab68d5eabd4a0fa9fcc Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 27 Aug 2018 12:15:20 +0000 Subject: [PATCH] Undefined plans can never match. Check for that before trying to use the plan. OK millert@ gsoares@ --- usr.sbin/ldapd/filter.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ldapd/filter.c b/usr.sbin/ldapd/filter.c index c5bccb5acc3..2aeae4b1d15 100644 --- a/usr.sbin/ldapd/filter.c +++ b/usr.sbin/ldapd/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.7 2018/08/27 11:43:36 claudio Exp $ */ +/* $OpenBSD: filter.c,v 1.8 2018/08/27 12:15:20 claudio Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -37,7 +37,9 @@ ldap_filt_eq(struct ber_element *root, struct plan *plan) char *vs; struct ber_element *a, *vals, *v; - if (plan->adesc != NULL) + if (plan->undefined) + return -1; + else if (plan->adesc != NULL) a = ldap_get_attribute(root, plan->adesc); else a = ldap_find_attribute(root, plan->at); @@ -116,7 +118,9 @@ ldap_filt_subs(struct ber_element *root, struct plan *plan) const char *attr; struct ber_element *a, *v; - if (plan->adesc != NULL) + if (plan->undefined) + return -1; + else if (plan->adesc != NULL) a = ldap_get_attribute(root, plan->adesc); else a = ldap_find_attribute(root, plan->at); @@ -188,7 +192,9 @@ ldap_filt_presence(struct ber_element *root, struct plan *plan) { struct ber_element *a; - if (plan->adesc != NULL) + if (plan->undefined) + return -1; + else if (plan->adesc != NULL) a = ldap_get_attribute(root, plan->adesc); else a = ldap_find_attribute(root, plan->at); -- 2.20.1