andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 553adee9a7f49b4da083ffa6ea526d35ef1cbba2 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Fri, 27 Jun 2014 12:51:30 -0700
dc8c34
Subject: [PATCH 232/234] Ticket #47750 - Creating a glue fails if one above
dc8c34
 level is a conflict or missing
dc8c34
dc8c34
Bug description: https://fedorahosted.org/389/ticket/47750#comment:16
dc8c34
dc8c34
Fix description: The logic in slapi_is_special_rdn to check if the
dc8c34
RDN is a tombstone or not had a problem.  Even if the first part of
dc8c34
RDN is not nsuniqueid=<UNIQUE_ID>, it was returning true.  In this
dc8c34
patch, code to check the case is added and it returns false if the
dc8c34
first part of RDN is not  nsuniqueid=<UNIQUE_ID>.
dc8c34
dc8c34
Reviewed by mreynolds@redhat.com and rmeggins@redhat.com (Thank you,
dc8c34
Mark and Rich!!)
dc8c34
(cherry picked from commit 286559dac7a968faa0102f0165ba56892795b269)
dc8c34
(cherry picked from commit 36b883082265a2a5b2c818c0f7ce93e97ee55672)
dc8c34
(cherry picked from commit 2f3852fea43efde5994b3805d65cf2fc80210d73)
dc8c34
(cherry picked from commit fe0b7956a6df4222cde2c127fd11e0cb42a5afe7)
dc8c34
---
dc8c34
 ldap/servers/slapd/util.c | 13 ++++++++++---
dc8c34
 1 file changed, 10 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
dc8c34
index c566512..7a753f8 100644
dc8c34
--- a/ldap/servers/slapd/util.c
dc8c34
+++ b/ldap/servers/slapd/util.c
dc8c34
@@ -1120,7 +1120,7 @@ slapi_is_special_rdn(const char *rdn, int flag)
dc8c34
 	}
dc8c34
 	rp = (char *)rdn;
dc8c34
 	while (rp) {
dc8c34
-		char *comma = NULL;
dc8c34
+		char *endp = NULL;
dc8c34
 		if (!PL_strncasecmp(rp, SLAPI_ATTR_UNIQUEID, SLAPI_ATTR_UNIQUEID_LENGTH) &&
dc8c34
 		    (*(rp + SLAPI_ATTR_UNIQUEID_LENGTH) == '=')) {
dc8c34
 			if (RDN_IS_TOMBSTONE == flag) {
dc8c34
@@ -1137,10 +1137,17 @@ slapi_is_special_rdn(const char *rdn, int flag)
dc8c34
 					return 1;
dc8c34
 				}
dc8c34
 			}
dc8c34
+		} else if (RDN_IS_TOMBSTONE == flag) {
dc8c34
+			/* If the first part of rdn does not start with SLAPI_ATTR_UNIQUEID,
dc8c34
+			 * it's not a tombstone RDN. */
dc8c34
+			return 0;
dc8c34
+		}
dc8c34
+		endp = PL_strchr(rp, ',');
dc8c34
+		if (!endp) {
dc8c34
+			endp = rp + strlen(rp);
dc8c34
 		}
dc8c34
-		comma = PL_strchr(rp, ',');
dc8c34
 		rp = PL_strchr(rp, '+');
dc8c34
-		if (rp && (rp < comma)) {
dc8c34
+		if (rp && (rp < endp)) {
dc8c34
 			plus = 1;
dc8c34
 			rp++;
dc8c34
 		}
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34