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