andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 5bfd8890e549659ac5255699731085a88f7dcc31 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
dc8c34
Date: Mon, 10 Dec 2012 15:08:05 -0800
dc8c34
Subject: [PATCH 59/99] Trac Ticket #531 - loading an entry from the database
dc8c34
 should use str2entry_f
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/531
dc8c34
dc8c34
Description: Based upon the comments by Rich Megginson (Thanks!!),
dc8c34
changing the newly introduced macro to all upper case.  Plus, it
dc8c34
was pointed out that the meaning of the macro name was opposite.
dc8c34
Fixing these 2 issues, this patch replaces the macro str2entry_
dc8c34
can_use_fast with STR2ENTRY_CANNOT_USE_FAST.
dc8c34
(cherry picked from commit b3a0ab786091705883bec5315c9b74e025ad211a)
dc8c34
(cherry picked from commit b5dc3dbd1b7af9436014067441ae949809d5daf2)
dc8c34
---
dc8c34
 ldap/servers/slapd/entry.c | 18 +++++++++++++-----
dc8c34
 1 file changed, 13 insertions(+), 5 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
dc8c34
index 1926417..f38c39e 100644
dc8c34
--- a/ldap/servers/slapd/entry.c
dc8c34
+++ b/ldap/servers/slapd/entry.c
dc8c34
@@ -1315,6 +1315,8 @@ free_and_return:
dc8c34
 			| SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES					\
dc8c34
 			| SLAPI_STR2ENTRY_TOMBSTONE_CHECK						\
dc8c34
 			| SLAPI_STR2ENTRY_USE_OBSOLETE_DNFORMAT 				\
dc8c34
+			| SLAPI_STR2ENTRY_NO_ENTRYDN 							\
dc8c34
+			| SLAPI_STR2ENTRY_DN_NORMALIZED 						\
dc8c34
 			)
dc8c34
 
dc8c34
 #define SLAPI_STRENTRY_FLAGS_HANDLED_BY_STR2ENTRY_FAST				\
dc8c34
@@ -1322,6 +1324,14 @@ free_and_return:
dc8c34
  			| SLAPI_STRENTRY_FLAGS_HANDLED_IN_SLAPI_STR2ENTRY		\
dc8c34
  			)
dc8c34
 
dc8c34
+/*
dc8c34
+ * If well-formed LDIF has not been provided OR if a flag that is
dc8c34
+ * not handled by str2entry_fast() has been passed in, call the
dc8c34
+ * slower but more forgiving str2entry_dupcheck() function.
dc8c34
+ */
dc8c34
+#define STR2ENTRY_CANNOT_USE_FAST(flags) \
dc8c34
+			(((flags) & SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF) || \
dc8c34
+			 ((flags) & ~SLAPI_STRENTRY_FLAGS_HANDLED_BY_STR2ENTRY_FAST))
dc8c34
 
dc8c34
 Slapi_Entry *
dc8c34
 slapi_str2entry( char *s, int flags )
dc8c34
@@ -1339,9 +1349,8 @@ slapi_str2entry( char *s, int flags )
dc8c34
 	 * not handled by str2entry_fast() has been passed in, call the
dc8c34
 	 * slower but more forgiving str2entry_dupcheck() function.
dc8c34
 	 */
dc8c34
-	if ( 0 != ( flags & SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF ) ||
dc8c34
-		 0 != ( flags & ~SLAPI_STRENTRY_FLAGS_HANDLED_BY_STR2ENTRY_FAST ))
dc8c34
-    {
dc8c34
+	if (STR2ENTRY_CANNOT_USE_FAST(flags))
dc8c34
+	{
dc8c34
 	    e= str2entry_dupcheck( NULL/*dn*/, s, flags, read_stateinfo );
dc8c34
     }
dc8c34
     else
dc8c34
@@ -1401,8 +1410,7 @@ slapi_str2entry_ext( const char *normdn, char *s, int flags )
dc8c34
 	 * not handled by str2entry_fast() has been passed in, call the
dc8c34
 	 * slower but more forgiving str2entry_dupcheck() function.
dc8c34
 	 */
dc8c34
-	if ( 0 != ( flags & SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF ) ||
dc8c34
-			0 != ( flags & ~SLAPI_STRENTRY_FLAGS_HANDLED_BY_STR2ENTRY_FAST ))
dc8c34
+	if (STR2ENTRY_CANNOT_USE_FAST(flags))
dc8c34
 	{
dc8c34
 	    e = str2entry_dupcheck( normdn, s, 
dc8c34
 	                    flags|SLAPI_STR2ENTRY_DN_NORMALIZED, read_stateinfo );
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34