From 0394c805abe5208f43255aff3b7c24a3337d2529 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 22 Feb 2010 21:53:38 +0000 Subject: [PATCH] ignore non-critical control with unrecognized flags (ITS#6480) --- servers/slapd/controls.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index d20dbd30ae..5d877ab683 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -1671,6 +1671,24 @@ static int parseSearchOptions ( return LDAP_PROTOCOL_ERROR; } + if ( search_flags & ~(LDAP_SEARCH_FLAG_DOMAIN_SCOPE) ) { + /* Search flags not recognised so far, + * including: + * LDAP_SEARCH_FLAG_PHANTOM_ROOT + */ + if ( ctrl->ldctl_iscritical ) { + rs->sr_text = "searchOptions contained unrecognized flag"; + return LDAP_UNWILLING_TO_PERFORM; + } + + /* Ignore */ + Debug( LDAP_DEBUG_TRACE, + "searchOptions: conn=%lu unrecognized flag(s) 0x%x (non-critical)\n", + op->o_connid, (unsigned)search_flags, 0 ); + + return LDAP_SUCCESS; + } + if ( search_flags & LDAP_SEARCH_FLAG_DOMAIN_SCOPE ) { if ( op->o_domain_scope != SLAP_CONTROL_NONE ) { rs->sr_text = "searchOptions control specified multiple times " @@ -1683,15 +1701,6 @@ static int parseSearchOptions ( : SLAP_CONTROL_NONCRITICAL; } - if ( search_flags & ~(LDAP_SEARCH_FLAG_DOMAIN_SCOPE) ) { - /* Other search flags not recognised so far, - * including: - * LDAP_SEARCH_FLAG_PHANTOM_ROOM - */ - rs->sr_text = "searchOptions contained unrecognized flag"; - return LDAP_UNWILLING_TO_PERFORM; - } - return LDAP_SUCCESS; } -- 2.39.5