|
|
dc8c34 |
From 68973758cc835199facd97620bcbb368eca358a8 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
dc8c34 |
Date: Fri, 7 Mar 2014 12:29:55 -0800
|
|
|
dc8c34 |
Subject: [PATCH 174/225] Ticket #47735 - e_uniqueid fails to set if an entry
|
|
|
dc8c34 |
is a conflict entry
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description:
|
|
|
dc8c34 |
When an entry is turned to be a conflict entry, its nsUniqueId has
|
|
|
dc8c34 |
a mdcsn info as a subtype like this:
|
|
|
dc8c34 |
nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
|
|
|
dc8c34 |
In this case, the attribute type is assigned to the berval "type"
|
|
|
dc8c34 |
as follows:
|
|
|
dc8c34 |
type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
|
|
|
dc8c34 |
type.bv_len = 37
|
|
|
dc8c34 |
The subtyped stateinfo is processed in str2entry_state_information_from_type,
|
|
|
dc8c34 |
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
|
|
|
dc8c34 |
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
|
|
|
dc8c34 |
with stateinfo fails to set the value to e_uniqueid.
|
|
|
dc8c34 |
if ( type.bv_len == 10 &&
|
|
|
dc8c34 |
PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: This patch resets the length of the type with the
|
|
|
dc8c34 |
basetype length 10 before the if expression is called for setting
|
|
|
dc8c34 |
e_uniqueid.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47735
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
|
|
|
dc8c34 |
(cherry picked from commit a02f94191f38f46eff4f777083b5a50624d46a89)
|
|
|
dc8c34 |
(cherry picked from commit 6153865313beaff49bde969d71d72fa0e80c3c1f)
|
|
|
dc8c34 |
(cherry picked from commit e1f92c03b03f22ec4533d777413b9437eb9cb81c)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/entry.c | 43 ++++++++++++++++++++++++++++---------------
|
|
|
dc8c34 |
1 file changed, 28 insertions(+), 15 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
|
|
|
dc8c34 |
index 8a5df7e..97d21a6 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/entry.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/entry.c
|
|
|
dc8c34 |
@@ -85,10 +85,22 @@ static char *forbidden_attrs [] = {PSEUDO_ATTR_UNHASHEDUSERPASSWORD,
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* WARNING: s gets butchered... the base type remains.
|
|
|
dc8c34 |
*/
|
|
|
dc8c34 |
-void
|
|
|
dc8c34 |
-str2entry_state_information_from_type(char *s,CSNSet **csnset,CSN **attributedeletioncsn,CSN **maxcsn,int *value_state,int *attr_state)
|
|
|
dc8c34 |
-{
|
|
|
dc8c34 |
- char *p= strchr(s, ';');
|
|
|
dc8c34 |
+static void
|
|
|
dc8c34 |
+str2entry_state_information_from_type(struct berval *atype,
|
|
|
dc8c34 |
+ CSNSet **csnset,
|
|
|
dc8c34 |
+ CSN **attributedeletioncsn,
|
|
|
dc8c34 |
+ CSN **maxcsn,
|
|
|
dc8c34 |
+ int *value_state,
|
|
|
dc8c34 |
+ int *attr_state)
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ char *p = NULL;
|
|
|
dc8c34 |
+ if ((NULL == atype) || (NULL == atype->bv_val)) {
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ p = PL_strchr(atype->bv_val, ';');
|
|
|
dc8c34 |
+ if (p) {
|
|
|
dc8c34 |
+ atype->bv_len = p - atype->bv_val;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
*value_state= VALUE_PRESENT;
|
|
|
dc8c34 |
*attr_state= ATTRIBUTE_PRESENT;
|
|
|
dc8c34 |
while(p!=NULL)
|
|
|
dc8c34 |
@@ -229,19 +241,20 @@ str2entry_fast( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( slapi_ldif_parse_line( s, &type, &value, &freeval ) < 0 ) {
|
|
|
dc8c34 |
- LDAPDebug( LDAP_DEBUG_TRACE,
|
|
|
dc8c34 |
- "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
|
|
|
dc8c34 |
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= str2entry_fast NULL (parse_line)\n");
|
|
|
dc8c34 |
continue;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/*
|
|
|
dc8c34 |
* Extract the attribute and value CSNs from the attribute type.
|
|
|
dc8c34 |
- */
|
|
|
dc8c34 |
+ */
|
|
|
dc8c34 |
csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */
|
|
|
dc8c34 |
csnset_free(&valuecsnset);
|
|
|
dc8c34 |
value_state= VALUE_NOTFOUND;
|
|
|
dc8c34 |
attr_state= ATTRIBUTE_NOTFOUND;
|
|
|
dc8c34 |
- str2entry_state_information_from_type(type.bv_val,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
|
|
|
dc8c34 |
+ str2entry_state_information_from_type(&type,
|
|
|
dc8c34 |
+ &valuecsnset, &attributedeletioncsn,
|
|
|
dc8c34 |
+ &maxcsn, &value_state, &attr_state);
|
|
|
dc8c34 |
if(!read_stateinfo)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
/* We are not maintaining state information */
|
|
|
dc8c34 |
@@ -376,8 +389,7 @@ str2entry_fast( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/* retrieve uniqueid */
|
|
|
dc8c34 |
- if ( type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH && PL_strncasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID, type.bv_len) == 0 ){
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+ if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
|
|
|
dc8c34 |
if (e->e_uniqueid != NULL){
|
|
|
dc8c34 |
LDAPDebug (LDAP_DEBUG_TRACE,
|
|
|
dc8c34 |
"str2entry_fast: entry has multiple uniqueids %s "
|
|
|
dc8c34 |
@@ -733,7 +745,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
entry_attrs *ea = NULL;
|
|
|
dc8c34 |
int tree_attr_checking = 0;
|
|
|
dc8c34 |
int big_entry_attr_presence_check = 0;
|
|
|
dc8c34 |
- int check_for_duplicate_values = (0 != (flags & SLAPI_STR2ENTRY_REMOVEDUPVALS));
|
|
|
dc8c34 |
+ int check_for_duplicate_values = ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
|
|
|
dc8c34 |
Slapi_Value *value = 0;
|
|
|
dc8c34 |
CSN *attributedeletioncsn= NULL;
|
|
|
dc8c34 |
CSNSet *valuecsnset= NULL;
|
|
|
dc8c34 |
@@ -744,7 +756,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
/* Check if we should be performing strict validation. */
|
|
|
dc8c34 |
strict = config_get_dn_validate_strict();
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n", 0, 0, 0 );
|
|
|
dc8c34 |
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n");
|
|
|
dc8c34 |
|
|
|
dc8c34 |
e = slapi_entry_alloc();
|
|
|
dc8c34 |
slapi_entry_init(e,NULL,NULL);
|
|
|
dc8c34 |
@@ -784,7 +796,9 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
csnset_free(&valuecsnset);
|
|
|
dc8c34 |
value_state= VALUE_NOTFOUND;
|
|
|
dc8c34 |
attr_state= VALUE_NOTFOUND;
|
|
|
dc8c34 |
- str2entry_state_information_from_type(type,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
|
|
|
dc8c34 |
+ str2entry_state_information_from_type(&bvtype,
|
|
|
dc8c34 |
+ &valuecsnset, &attributedeletioncsn,
|
|
|
dc8c34 |
+ &maxcsn, &value_state, &attr_state);
|
|
|
dc8c34 |
if(!read_stateinfo)
|
|
|
dc8c34 |
{
|
|
|
dc8c34 |
/* We are not maintaining state information */
|
|
|
dc8c34 |
@@ -892,8 +906,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
/* retrieve uniqueid */
|
|
|
dc8c34 |
- if ( strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0 ){
|
|
|
dc8c34 |
-
|
|
|
dc8c34 |
+ if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
|
|
|
dc8c34 |
if (e->e_uniqueid != NULL){
|
|
|
dc8c34 |
LDAPDebug (LDAP_DEBUG_TRACE,
|
|
|
dc8c34 |
"str2entry_dupcheck: entry has multiple uniqueids %s "
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|