Branch '389-ds-base-1.3.2' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/urp_glue.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit 97fa6d25159bcdbc6701c4696d675683bed34761
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 14:44:40 2014 -0800
Ticket #47737 - Under heavy stress, failure of turning a tombstone into glue makes the server hung
Description: Turning a tombstone entry to a glue entry is done in a
while loop (create_glue_entry:urp_glue.c) Unless the transformation
is successful (or LDAP_NO_SUCH_OBJECT), it cannot exit from the loop.
But under a stress, there could be a tombstone and a conflict entry
coexist, and do_create_glue_entry keeps returning LDAP_ALREADY_EXISTS.
In such a case, we need to give up creating a glue.
https://fedorahosted.org/389/ticket/47737
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
(cherry picked from commit a84dab5923de59cfda9bd4e78813d0c22bab35ae)
diff --git a/ldap/servers/plugins/replication/urp_glue.c b/ldap/servers/plugins/replication/urp_glue.c
index 369363d..6eeb826 100644
--- a/ldap/servers/plugins/replication/urp_glue.c
+++ b/ldap/servers/plugins/replication/urp_glue.c
@@ -169,7 +169,6 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
sdn = slapi_sdn_new_dn_byval(slapi_sdn_get_ndn(superiordn));
slapi_sdn_add_rdn(sdn,rdn);
-
/* must take care of multi-valued rdn: split rdn into different lines introducing
* '\n' between each type/value pair.
*/
@@ -187,8 +186,7 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
rdnstr = slapi_ch_realloc(rdnstr, alloc_len);
rdnpair = &rdnstr[rdnstr_len];
}
- slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype,
- rdnval, rdnval_len, LDIF_OPT_NOWRAP);
+ slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype, rdnval, rdnval_len, LDIF_OPT_NOWRAP);
*rdnpair = '\0';
}
estr= slapi_ch_smprintf(glue_entry, slapi_sdn_get_ndn(sdn), rdnstr, uniqueid,
@@ -247,6 +245,12 @@ create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char
sessionid, dnstr, uniqueid);
done= 1;
break;
+ case LDAP_ALREADY_EXISTS:
+ slapi_log_error ( SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Skipped creating glue entry %s uniqueid=%s reason Entry Already Exists\n",
+ sessionid, dnstr, uniqueid);
+ done= 1;
+ break;
case LDAP_NO_SUCH_OBJECT:
/* The parent is missing */
{
10 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/urp_glue.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit a84dab5923de59cfda9bd4e78813d0c22bab35ae
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 14:44:40 2014 -0800
Ticket #47737 - Under heavy stress, failure of turning a tombstone into glue makes the server hung
Description: Turning a tombstone entry to a glue entry is done in a
while loop (create_glue_entry:urp_glue.c) Unless the transformation
is successful (or LDAP_NO_SUCH_OBJECT), it cannot exit from the loop.
But under a stress, there could be a tombstone and a conflict entry
coexist, and do_create_glue_entry keeps returning LDAP_ALREADY_EXISTS.
In such a case, we need to give up creating a glue.
https://fedorahosted.org/389/ticket/47737
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
diff --git a/ldap/servers/plugins/replication/urp_glue.c b/ldap/servers/plugins/replication/urp_glue.c
index 369363d..6eeb826 100644
--- a/ldap/servers/plugins/replication/urp_glue.c
+++ b/ldap/servers/plugins/replication/urp_glue.c
@@ -169,7 +169,6 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
sdn = slapi_sdn_new_dn_byval(slapi_sdn_get_ndn(superiordn));
slapi_sdn_add_rdn(sdn,rdn);
-
/* must take care of multi-valued rdn: split rdn into different lines introducing
* '\n' between each type/value pair.
*/
@@ -187,8 +186,7 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha
rdnstr = slapi_ch_realloc(rdnstr, alloc_len);
rdnpair = &rdnstr[rdnstr_len];
}
- slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype,
- rdnval, rdnval_len, LDIF_OPT_NOWRAP);
+ slapi_ldif_put_type_and_value_with_options(&rdnpair, rdntype, rdnval, rdnval_len, LDIF_OPT_NOWRAP);
*rdnpair = '\0';
}
estr= slapi_ch_smprintf(glue_entry, slapi_sdn_get_ndn(sdn), rdnstr, uniqueid,
@@ -247,6 +245,12 @@ create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char
sessionid, dnstr, uniqueid);
done= 1;
break;
+ case LDAP_ALREADY_EXISTS:
+ slapi_log_error ( SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Skipped creating glue entry %s uniqueid=%s reason Entry Already Exists\n",
+ sessionid, dnstr, uniqueid);
+ done= 1;
+ break;
case LDAP_NO_SUCH_OBJECT:
/* The parent is missing */
{
10 years, 1 month
Branch '389-ds-base-1.2.11' - 2 commits - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 43 ++++++++++++++++++++++++++++---------------
ldap/servers/slapd/plugin.c | 7 ++++---
2 files changed, 32 insertions(+), 18 deletions(-)
New commits:
commit e1f92c03b03f22ec4533d777413b9437eb9cb81c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 12:29:55 2014 -0800
Ticket #47735 - e_uniqueid fails to set if an entry is a conflict entry
Bug Description:
When an entry is turned to be a conflict entry, its nsUniqueId has
a mdcsn info as a subtype like this:
nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
In this case, the attribute type is assigned to the berval "type"
as follows:
type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
type.bv_len = 37
The subtyped stateinfo is processed in str2entry_state_information_from_type,
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
with stateinfo fails to set the value to e_uniqueid.
if ( type.bv_len == 10 &&
PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){
Fix Description: This patch resets the length of the type with the
basetype length 10 before the if expression is called for setting
e_uniqueid.
https://fedorahosted.org/389/ticket/47735
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit a02f94191f38f46eff4f777083b5a50624d46a89)
(cherry picked from commit 6153865313beaff49bde969d71d72fa0e80c3c1f)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 9064e41..9c7a31b 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -85,10 +85,22 @@ static char *forbidden_attrs [] = {PSEUDO_ATTR_UNHASHEDUSERPASSWORD,
/*
* WARNING: s gets butchered... the base type remains.
*/
-void
-str2entry_state_information_from_type(char *s,CSNSet **csnset,CSN **attributedeletioncsn,CSN **maxcsn,int *value_state,int *attr_state)
-{
- char *p= strchr(s, ';');
+static void
+str2entry_state_information_from_type(struct berval *atype,
+ CSNSet **csnset,
+ CSN **attributedeletioncsn,
+ CSN **maxcsn,
+ int *value_state,
+ int *attr_state)
+{
+ char *p = NULL;
+ if ((NULL == atype) || (NULL == atype->bv_val)) {
+ return;
+ }
+ p = PL_strchr(atype->bv_val, ';');
+ if (p) {
+ atype->bv_len = p - atype->bv_val;
+ }
*value_state= VALUE_PRESENT;
*attr_state= ATTRIBUTE_PRESENT;
while(p!=NULL)
@@ -229,19 +241,20 @@ str2entry_fast( const char *rawdn, char *s, int flags, int read_stateinfo )
}
if ( slapi_ldif_parse_line( s, &type, &value, &freeval ) < 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= str2entry_fast NULL (parse_line)\n");
continue;
}
/*
* Extract the attribute and value CSNs from the attribute type.
- */
+ */
csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= ATTRIBUTE_NOTFOUND;
- str2entry_state_information_from_type(type.bv_val,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&type,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -376,8 +389,7 @@ str2entry_fast( const char *rawdn, char *s, int flags, int read_stateinfo )
}
/* retrieve uniqueid */
- if ( type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH && PL_strncasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID, type.bv_len) == 0 ){
-
+ if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_fast: entry has multiple uniqueids %s "
@@ -733,7 +745,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
entry_attrs *ea = NULL;
int tree_attr_checking = 0;
int big_entry_attr_presence_check = 0;
- int check_for_duplicate_values = (0 != (flags & SLAPI_STR2ENTRY_REMOVEDUPVALS));
+ int check_for_duplicate_values = ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
Slapi_Value *value = 0;
CSN *attributedeletioncsn= NULL;
CSNSet *valuecsnset= NULL;
@@ -744,7 +756,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
/* Check if we should be performing strict validation. */
strict = config_get_dn_validate_strict();
- LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n");
e = slapi_entry_alloc();
slapi_entry_init(e,NULL,NULL);
@@ -784,7 +796,9 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= VALUE_NOTFOUND;
- str2entry_state_information_from_type(type,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&bvtype,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -892,8 +906,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
}
/* retrieve uniqueid */
- if ( strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0 ){
-
+ if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_dupcheck: entry has multiple uniqueids %s "
commit cca1fb5802009bea9ebbf27d4a2a6f878875c20c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Mar 6 13:26:06 2014 -0800
Ticket #47731 - A tombstone entry is deleted by ldapdelete
Description: A tombstone deletion by ldapdelete op from client is
supposed to fail. The failure from SLAPI_PLUGIN_BETXNPOSTOPERATION
was ignored in 389-ds-base-1.2.11 plugin_call_func and it was not
passed to the backend to abort. This patch added the check in the
same way as in 389-ds-base-1.3.1 and newer.
https://fedorahosted.org/389/ticket/47731
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 0a4f4e0..d21701b 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -1454,8 +1454,7 @@ plugin_call_func (struct slapdplugin *list, int operation, Slapi_PBlock *pb, int
{
if (SLAPI_PLUGIN_PREOPERATION == list->plg_type ||
SLAPI_PLUGIN_INTERNAL_PREOPERATION == list->plg_type ||
- SLAPI_PLUGIN_BETXNPREOPERATION == list->plg_type ||
- SLAPI_PLUGIN_START_FN == operation )
+ SLAPI_PLUGIN_START_FN == operation )
{
/*
* We bail out of plugin processing for preop plugins
@@ -1466,7 +1465,9 @@ plugin_call_func (struct slapdplugin *list, int operation, Slapi_PBlock *pb, int
return_value = rc;
break;
} else if (SLAPI_PLUGIN_BEPREOPERATION == list->plg_type ||
- SLAPI_PLUGIN_BEPOSTOPERATION == list->plg_type)
+ SLAPI_PLUGIN_BEPOSTOPERATION == list->plg_type ||
+ SLAPI_PLUGIN_BETXNPREOPERATION == list->plg_type ||
+ SLAPI_PLUGIN_BETXNPOSTOPERATION == list->plg_type)
{
/* respect fatal error (-1); should not OR it */
if (-1 == rc) {
10 years, 1 month
Branch '389-ds-base-1.3.1' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 60 +++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 24 deletions(-)
New commits:
commit d4350bd0724c37040a4aaf361a10918c925b7605
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 12:29:55 2014 -0800
Ticket #47735 - e_uniqueid fails to set if an entry is a conflict entry
Bug Description:
When an entry is turned to be a conflict entry, its nsUniqueId has
a mdcsn info as a subtype like this:
nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
In this case, the attribute type is assigned to the berval "type"
as follows:
type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
type.bv_len = 37
The subtyped stateinfo is processed in str2entry_state_information_from_type,
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
with stateinfo fails to set the value to e_uniqueid.
if ( type.bv_len == 10 &&
PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){
Fix Description: This patch resets the length of the type with the
basetype length 10 before the if expression is called for setting
e_uniqueid.
https://fedorahosted.org/389/ticket/47735
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit 07bd2259cc45c9d5c193b15faaf0d0c60e1b723c)
(cherry picked from commit 6e0ffbe1bdde99cfd71a5617d89482eef4696c7f)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 40a5ed8..2b9f83f 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -96,10 +96,22 @@ struct attrs_in_extension attrs_in_extension[] =
/*
* WARNING: s gets butchered... the base type remains.
*/
-void
-str2entry_state_information_from_type(char *s,CSNSet **csnset,CSN **attributedeletioncsn,CSN **maxcsn,int *value_state,int *attr_state)
+static void
+str2entry_state_information_from_type(struct berval *atype,
+ CSNSet **csnset,
+ CSN **attributedeletioncsn,
+ CSN **maxcsn,
+ int *value_state,
+ int *attr_state)
{
- char *p= strchr(s, ';');
+ char *p = NULL;
+ if ((NULL == atype) || (NULL == atype->bv_val)) {
+ return;
+ }
+ p = PL_strchr(atype->bv_val, ';');
+ if (p) {
+ atype->bv_len = p - atype->bv_val;
+ }
*value_state= VALUE_PRESENT;
*attr_state= ATTRIBUTE_PRESENT;
while(p!=NULL)
@@ -244,19 +256,20 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
if ( slapi_ldif_parse_line( s, &type, &value, &freeval ) < 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= str2entry_fast NULL (parse_line)\n");
continue;
}
/*
* Extract the attribute and value CSNs from the attribute type.
- */
+ */
csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= ATTRIBUTE_NOTFOUND;
- str2entry_state_information_from_type(type.bv_val,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&type,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -394,8 +407,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
/* retrieve uniqueid */
- if ( type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH && PL_strncasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID, type.bv_len) == 0 ){
-
+ if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_fast: entry has multiple uniqueids %s "
@@ -753,22 +765,21 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
char *valuecharptr=NULL;
struct berval bvvalue;
int rc;
- entry_attrs *ea = NULL;
- int tree_attr_checking = 0;
- int big_entry_attr_presence_check = 0;
- int check_for_duplicate_values =
- ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
- Slapi_Value *value = 0;
- CSN *attributedeletioncsn= NULL;
- CSNSet *valuecsnset= NULL;
- CSN *maxcsn= NULL;
- char *normdn = NULL;
- int strict = 0;
+ entry_attrs *ea = NULL;
+ int tree_attr_checking = 0;
+ int big_entry_attr_presence_check = 0;
+ int check_for_duplicate_values = ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
+ Slapi_Value *value = 0;
+ CSN *attributedeletioncsn= NULL;
+ CSNSet *valuecsnset= NULL;
+ CSN *maxcsn= NULL;
+ char *normdn = NULL;
+ int strict = 0;
/* Check if we should be performing strict validation. */
strict = config_get_dn_validate_strict();
- LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n");
e = slapi_entry_alloc();
slapi_entry_init(e,NULL,NULL);
@@ -809,7 +820,9 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= VALUE_NOTFOUND;
- str2entry_state_information_from_type(type,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&bvtype,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -917,8 +930,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
}
/* retrieve uniqueid */
- if ( strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0 ){
-
+ if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_dupcheck: entry has multiple uniqueids %s "
10 years, 1 month
Branch '389-ds-base-1.3.2' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 60 +++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 24 deletions(-)
New commits:
commit 6e0ffbe1bdde99cfd71a5617d89482eef4696c7f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 12:29:55 2014 -0800
Ticket #47735 - e_uniqueid fails to set if an entry is a conflict entry
Bug Description:
When an entry is turned to be a conflict entry, its nsUniqueId has
a mdcsn info as a subtype like this:
nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
In this case, the attribute type is assigned to the berval "type"
as follows:
type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
type.bv_len = 37
The subtyped stateinfo is processed in str2entry_state_information_from_type,
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
with stateinfo fails to set the value to e_uniqueid.
if ( type.bv_len == 10 &&
PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){
Fix Description: This patch resets the length of the type with the
basetype length 10 before the if expression is called for setting
e_uniqueid.
https://fedorahosted.org/389/ticket/47735
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit 07bd2259cc45c9d5c193b15faaf0d0c60e1b723c)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 57e1d1e..c05d0e2 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -117,10 +117,22 @@ struct _entry_vattr {
/*
* WARNING: s gets butchered... the base type remains.
*/
-void
-str2entry_state_information_from_type(char *s,CSNSet **csnset,CSN **attributedeletioncsn,CSN **maxcsn,int *value_state,int *attr_state)
+static void
+str2entry_state_information_from_type(struct berval *atype,
+ CSNSet **csnset,
+ CSN **attributedeletioncsn,
+ CSN **maxcsn,
+ int *value_state,
+ int *attr_state)
{
- char *p= strchr(s, ';');
+ char *p = NULL;
+ if ((NULL == atype) || (NULL == atype->bv_val)) {
+ return;
+ }
+ p = PL_strchr(atype->bv_val, ';');
+ if (p) {
+ atype->bv_len = p - atype->bv_val;
+ }
*value_state= VALUE_PRESENT;
*attr_state= ATTRIBUTE_PRESENT;
while(p!=NULL)
@@ -265,19 +277,20 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
if ( slapi_ldif_parse_line( s, &type, &value, &freeval ) < 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= str2entry_fast NULL (parse_line)\n");
continue;
}
/*
* Extract the attribute and value CSNs from the attribute type.
- */
+ */
csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= ATTRIBUTE_NOTFOUND;
- str2entry_state_information_from_type(type.bv_val,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&type,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -415,8 +428,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
/* retrieve uniqueid */
- if ( type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH && PL_strncasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID, type.bv_len) == 0 ){
-
+ if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_fast: entry has multiple uniqueids %s "
@@ -774,22 +786,21 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
char *valuecharptr=NULL;
struct berval bvvalue;
int rc;
- entry_attrs *ea = NULL;
- int tree_attr_checking = 0;
- int big_entry_attr_presence_check = 0;
- int check_for_duplicate_values =
- ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
- Slapi_Value *value = 0;
- CSN *attributedeletioncsn= NULL;
- CSNSet *valuecsnset= NULL;
- CSN *maxcsn= NULL;
- char *normdn = NULL;
- int strict = 0;
+ entry_attrs *ea = NULL;
+ int tree_attr_checking = 0;
+ int big_entry_attr_presence_check = 0;
+ int check_for_duplicate_values = ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
+ Slapi_Value *value = 0;
+ CSN *attributedeletioncsn= NULL;
+ CSNSet *valuecsnset= NULL;
+ CSN *maxcsn= NULL;
+ char *normdn = NULL;
+ int strict = 0;
/* Check if we should be performing strict validation. */
strict = config_get_dn_validate_strict();
- LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n");
e = slapi_entry_alloc();
slapi_entry_init(e,NULL,NULL);
@@ -830,7 +841,9 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= VALUE_NOTFOUND;
- str2entry_state_information_from_type(type,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&bvtype,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -938,8 +951,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
}
/* retrieve uniqueid */
- if ( strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0 ){
-
+ if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_dupcheck: entry has multiple uniqueids %s "
10 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 60 +++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 24 deletions(-)
New commits:
commit 07bd2259cc45c9d5c193b15faaf0d0c60e1b723c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 7 12:29:55 2014 -0800
Ticket #47735 - e_uniqueid fails to set if an entry is a conflict entry
Bug Description:
When an entry is turned to be a conflict entry, its nsUniqueId has
a mdcsn info as a subtype like this:
nsUniqueId;mdcsn-5319136f000200010000: c5e0d787-a58f11e3-b7f9dfd1-acc3d5e4
In this case, the attribute type is assigned to the berval "type"
as follows:
type.bv_val = "nsUniqueId;mdcsn-5319136f000200010000"
type.bv_len = 37
The subtyped stateinfo is processed in str2entry_state_information_from_type,
which modifies type.bv_val to "nsUniqueId", but type.bv_len remains 37.
str2entry_fast has this logic to set e_uniqueid, where the nsUniqueId
with stateinfo fails to set the value to e_uniqueid.
if ( type.bv_len == 10 &&
PL_strncasecmp (type.bv_val, "nsUniqueId", type.bv_len) == 0 ){
Fix Description: This patch resets the length of the type with the
basetype length 10 before the if expression is called for setting
e_uniqueid.
https://fedorahosted.org/389/ticket/47735
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 9dc94b3..9b4a9ab 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -135,10 +135,22 @@ struct _entry_vattr {
/*
* WARNING: s gets butchered... the base type remains.
*/
-void
-str2entry_state_information_from_type(char *s,CSNSet **csnset,CSN **attributedeletioncsn,CSN **maxcsn,int *value_state,int *attr_state)
+static void
+str2entry_state_information_from_type(struct berval *atype,
+ CSNSet **csnset,
+ CSN **attributedeletioncsn,
+ CSN **maxcsn,
+ int *value_state,
+ int *attr_state)
{
- char *p= strchr(s, ';');
+ char *p = NULL;
+ if ((NULL == atype) || (NULL == atype->bv_val)) {
+ return;
+ }
+ p = PL_strchr(atype->bv_val, ';');
+ if (p) {
+ atype->bv_len = p - atype->bv_val;
+ }
*value_state= VALUE_PRESENT;
*attr_state= ATTRIBUTE_PRESENT;
while(p!=NULL)
@@ -283,19 +295,20 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
if ( slapi_ldif_parse_line( s, &type, &value, &freeval ) < 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= str2entry_fast NULL (parse_line)\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= str2entry_fast NULL (parse_line)\n");
continue;
}
/*
* Extract the attribute and value CSNs from the attribute type.
- */
+ */
csn_free(&attributedeletioncsn); /* JCM - Do this more efficiently */
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= ATTRIBUTE_NOTFOUND;
- str2entry_state_information_from_type(type.bv_val,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&type,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -433,8 +446,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
}
/* retrieve uniqueid */
- if ( type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH && PL_strncasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID, type.bv_len) == 0 ){
-
+ if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_fast: entry has multiple uniqueids %s "
@@ -792,22 +804,21 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
char *valuecharptr=NULL;
struct berval bvvalue;
int rc;
- entry_attrs *ea = NULL;
- int tree_attr_checking = 0;
- int big_entry_attr_presence_check = 0;
- int check_for_duplicate_values =
- ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
- Slapi_Value *value = 0;
- CSN *attributedeletioncsn= NULL;
- CSNSet *valuecsnset= NULL;
- CSN *maxcsn= NULL;
- char *normdn = NULL;
- int strict = 0;
+ entry_attrs *ea = NULL;
+ int tree_attr_checking = 0;
+ int big_entry_attr_presence_check = 0;
+ int check_for_duplicate_values = ( 0 != ( flags & SLAPI_STR2ENTRY_REMOVEDUPVALS ));
+ Slapi_Value *value = 0;
+ CSN *attributedeletioncsn= NULL;
+ CSNSet *valuecsnset= NULL;
+ CSN *maxcsn= NULL;
+ char *normdn = NULL;
+ int strict = 0;
/* Check if we should be performing strict validation. */
strict = config_get_dn_validate_strict();
- LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n", 0, 0, 0 );
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "=> str2entry_dupcheck\n");
e = slapi_entry_alloc();
slapi_entry_init(e,NULL,NULL);
@@ -848,7 +859,9 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
csnset_free(&valuecsnset);
value_state= VALUE_NOTFOUND;
attr_state= VALUE_NOTFOUND;
- str2entry_state_information_from_type(type,&valuecsnset,&attributedeletioncsn,&maxcsn,&value_state,&attr_state);
+ str2entry_state_information_from_type(&bvtype,
+ &valuecsnset, &attributedeletioncsn,
+ &maxcsn, &value_state, &attr_state);
if(!read_stateinfo)
{
/* We are not maintaining state information */
@@ -956,8 +969,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
}
/* retrieve uniqueid */
- if ( strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0 ){
-
+ if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
if (e->e_uniqueid != NULL){
LDAPDebug (LDAP_DEBUG_TRACE,
"str2entry_dupcheck: entry has multiple uniqueids %s "
10 years, 1 month
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_tot_protocol.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit e0fd1ffcd84d533e4cd62aae15aea504677798ab
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Mar 7 14:07:01 2014 -0500
Ticket 47729 - Directory Server crashes if shutdown during a replication initialization
Bug Description: When a shutdown was detected we marked that the total update was done
prematurely(prp->stopped). This allowed the replication plugin to close
while the total update was still in progress. Other plugins continued to
be shutdown (e.g. ldbm database), while the total update was using shared
resources - which lead to a crash.
Fix Description: Only mark the total update protocol as stopped, after it is finished using
shared resources.
https://fedorahosted.org/389/ticket/47729
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index b10d2d0..9829984 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -340,7 +340,6 @@ repl5_tot_run(Private_Repl_Protocol *prp)
prp->stopped = 0;
if (prp->terminate)
{
- prp->stopped = 1;
goto done;
}
@@ -362,8 +361,7 @@ repl5_tot_run(Private_Repl_Protocol *prp)
}
else if (prp->terminate)
{
- conn_disconnect(prp->conn);
- prp->stopped = 1;
+ conn_disconnect(prp->conn);
goto done;
}
@@ -646,7 +644,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (prp->terminate)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
@@ -659,7 +656,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (rc)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
10 years, 1 month
Branch '389-ds-base-1.3.0' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_tot_protocol.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit 9ac3edba44e0a7c9b9f9c8ec0f622532ec58cdb6
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Mar 7 14:07:01 2014 -0500
Ticket 47729 - Directory Server crashes if shutdown during a replication initialization
Bug Description: When a shutdown was detected we marked that the total update was done
prematurely(prp->stopped). This allowed the replication plugin to close
while the total update was still in progress. Other plugins continued to
be shutdown (e.g. ldbm database), while the total update was using shared
resources - which lead to a crash.
Fix Description: Only mark the total update protocol as stopped, after it is finished using
shared resources.
https://fedorahosted.org/389/ticket/47729
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index b10d2d0..9829984 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -340,7 +340,6 @@ repl5_tot_run(Private_Repl_Protocol *prp)
prp->stopped = 0;
if (prp->terminate)
{
- prp->stopped = 1;
goto done;
}
@@ -362,8 +361,7 @@ repl5_tot_run(Private_Repl_Protocol *prp)
}
else if (prp->terminate)
{
- conn_disconnect(prp->conn);
- prp->stopped = 1;
+ conn_disconnect(prp->conn);
goto done;
}
@@ -646,7 +644,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (prp->terminate)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
@@ -659,7 +656,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (rc)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
10 years, 1 month
Branch '389-ds-base-1.3.1' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_tot_protocol.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit de8d28b66c407a4caf89095c30b80c91b780a63a
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Mar 7 14:07:01 2014 -0500
Ticket 47729 - Directory Server crashes if shutdown during a replication initialization
Bug Description: When a shutdown was detected we marked that the total update was done
prematurely(prp->stopped). This allowed the replication plugin to close
while the total update was still in progress. Other plugins continued to
be shutdown (e.g. ldbm database), while the total update was using shared
resources - which lead to a crash.
Fix Description: Only mark the total update protocol as stopped, after it is finished using
shared resources.
https://fedorahosted.org/389/ticket/47729
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index 3895ace..2db5178 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -343,7 +343,6 @@ repl5_tot_run(Private_Repl_Protocol *prp)
prp->stopped = 0;
if (prp->terminate)
{
- prp->stopped = 1;
goto done;
}
@@ -365,8 +364,7 @@ repl5_tot_run(Private_Repl_Protocol *prp)
}
else if (prp->terminate)
{
- conn_disconnect(prp->conn);
- prp->stopped = 1;
+ conn_disconnect(prp->conn);
goto done;
}
@@ -661,7 +659,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (prp->terminate)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
@@ -674,7 +671,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (rc)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
10 years, 1 month
Branch '389-ds-base-1.3.2' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/replication/repl5_tot_protocol.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
New commits:
commit c40e1cd9f64f5c0a57708f3ee9ad4abb606ecfc5
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Mar 7 14:07:01 2014 -0500
Ticket 47729 - Directory Server crashes if shutdown during a replication initialization
Bug Description: When a shutdown was detected we marked that the total update was done
prematurely(prp->stopped). This allowed the replication plugin to close
while the total update was still in progress. Other plugins continued to
be shutdown (e.g. ldbm database), while the total update was using shared
resources - which lead to a crash.
Fix Description: Only mark the total update protocol as stopped, after it is finished using
shared resources.
https://fedorahosted.org/389/ticket/47729
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit e7f7e9127717c1d432b10493b626fed334cc595f)
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index 3895ace..2db5178 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -343,7 +343,6 @@ repl5_tot_run(Private_Repl_Protocol *prp)
prp->stopped = 0;
if (prp->terminate)
{
- prp->stopped = 1;
goto done;
}
@@ -365,8 +364,7 @@ repl5_tot_run(Private_Repl_Protocol *prp)
}
else if (prp->terminate)
{
- conn_disconnect(prp->conn);
- prp->stopped = 1;
+ conn_disconnect(prp->conn);
goto done;
}
@@ -661,7 +659,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (prp->terminate)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
@@ -674,7 +671,6 @@ int send_entry (Slapi_Entry *e, void *cb_data)
if (rc)
{
conn_disconnect(prp->conn);
- prp->stopped = 1;
((callback_data*)cb_data)->rc = -1;
return -1;
}
10 years, 1 month