andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 336aedd43f38447e8b9868d2789cf2b083b88894 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Thu, 20 Jun 2013 14:05:35 -0700
dc8c34
Subject: [PATCH 76/99] Ticket #47402 - Attribute names are incorrect in search
dc8c34
 results
dc8c34
dc8c34
Bug Description: Attribute list given by a client to ldapsearch
dc8c34
is first copied to op->o_searchattrs to respect the client input.
dc8c34
Then the attribute types are normalized and if the list contains
dc8c34
any forbidden attributes, they are removed from the list.  When
dc8c34
the search result is returned, the internal normalized attribute
dc8c34
types are replaced with the original input op->o_searchattrs,
dc8c34
respectively. Since forbidden attributes are in op->o_searchattrs
dc8c34
but not in the internal attribute list, wrong type from copy is
dc8c34
associated to the value and returned to the client.
dc8c34
dc8c34
Fix Description: This patch removes the forbidden attribute
dc8c34
before copying the original attribute list to op->o_searchattrs.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47402
dc8c34
dc8c34
Reviewed by Nathan (Thank you!!)
dc8c34
(cherry picked from commit 29236cd1000f5f9391db4a39511603b8bed707f2)
dc8c34
---
dc8c34
 ldap/servers/slapd/search.c | 4 +++-
dc8c34
 1 file changed, 3 insertions(+), 1 deletion(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
dc8c34
index 7719727..1a824b2 100644
dc8c34
--- a/ldap/servers/slapd/search.c
dc8c34
+++ b/ldap/servers/slapd/search.c
dc8c34
@@ -329,6 +329,8 @@ do_search( Slapi_PBlock *pb )
dc8c34
 			gerattrs[gerattridx] = NULL;
dc8c34
 		}
dc8c34
 
dc8c34
+		/* Set attrs to SLAPI_SEARCH_ATTRS once to get rid of the forbidden attrs */
dc8c34
+		slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, attrs );
dc8c34
 		operation->o_searchattrs = cool_charray_dup( attrs );
dc8c34
 		for ( i = 0; attrs[i] != NULL; i++ ) {
dc8c34
 			char	*type;
dc8c34
@@ -338,7 +340,7 @@ do_search( Slapi_PBlock *pb )
dc8c34
 			attrs[i] = type;
dc8c34
 		}
dc8c34
 	}
dc8c34
-   if ( slapd_ldap_debug & LDAP_DEBUG_ARGS ) {
dc8c34
+	if ( slapd_ldap_debug & LDAP_DEBUG_ARGS ) {
dc8c34
 		char abuf[ 1024 ], *astr;
dc8c34
 
dc8c34
 		if ( NULL == attrs ) {
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34