Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/entrywsi.c | 43 +++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
New commits:
commit 71b5bb925a53ecdc23c584eca9fcc4a86093b7cf
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Mar 30 16:01:58 2010 -0600
Bug 578167 - repl. of mod/replace deletes multi-valued attrs
https://bugzilla.redhat.com/show_bug.cgi?id=578167
Resolves: bug 578167
Bug Description: repl. of mod/replace deletes multi-valued attrs
Reviewed by: nkinder (Thanks!)
Branch: Directory_Server_8_2_Branch
Fix Description: The server implements a mod/replace operation as a
mod/delete if all values, followed by a mod/add of the new values. The
mod/delete phase, since it removes all of the values, essentially deletes
the attribute, so it must set the attribute deletion_csn. This is even
true in the case when you do a mod/replace on an attribute that doesn't yet
exist. We have to create an empty attribute on the deleted_attrs list with
the deletion_csn set to the csn of the operation. This preserves the
semantics of the mod/replace operation.
When doing the add phase of the mod/replace, we have to be able to
resurrect attributes and values that may have been deleted by the mod/delete
phase. We can tell that we need to resurrect a deleted value in
resolve_attribute_state_multi_valued, in the deleted_values loop, because
the deletioncsn will be the same as the update csn, and the
delete_priority flag will be 0.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit c559982cddbe09bad1b7717a84c7b0187111d61a)
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 14ff163..6b51ef1 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -532,7 +532,7 @@ entry_add_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **b
* returning an LDAP result code.
*/
static int
-entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **vals, const CSN *csn, int urp, int mod_op)
+entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **vals, const CSN *csn, int urp, int mod_op, struct berval **replacevals)
{
int retVal= LDAP_SUCCESS;
Slapi_Attr *a= NULL;
@@ -648,18 +648,25 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
retVal= LDAP_NO_SUCH_ATTRIBUTE;
/* NOTE: LDAP says that a MOD REPLACE with no vals of a non-existent
attribute is a no-op - MOD REPLACE with some vals will add the attribute */
- if ((LDAP_MOD_REPLACE == mod_op) && vals && vals[0])
+ /* if we are doing a replace with actual values, meaning the result
+ of the mod is that the attribute will have some values, we need to create
+ a dummy attribute for entry_add_present_values_wsi to use, and set
+ the deletion csn to the csn of the current operation */
+ /* note that if LDAP_MOD_REPLACE == mod_op then vals is NULL -
+ see entry_replace_present_values_wsi */
+ if ((LDAP_MOD_REPLACE == mod_op) && replacevals && replacevals[0])
{
/* Create a new attribute and set the adcsn */
Slapi_Attr *a = slapi_attr_new();
slapi_attr_init(a, type);
- /* According to URP there should be an adcsn.
- * According to Tests, there should not
- * since the attribute never existed
- * Tests 26 and 27 of MMRepl state. */
- if (urp)
- attr_set_deletion_csn(a,csn);
- attrlist_add(&e->e_attrs, a);
+ attr_set_deletion_csn(a,csn);
+ /* mark the attribute as deleted - it does not really
+ exist yet - the code in entry_add_present_values_wsi
+ will add it back to the present list in the non urp case,
+ or determine if the attribute needs to be added
+ or not in the urp case
+ */
+ entry_add_deleted_attribute_wsi(e, a);
}
}
return( retVal );
@@ -677,7 +684,7 @@ entry_replace_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
/*
* Remove all existing values.
*/
- entry_delete_present_values_wsi(e, type, NULL /* Delete all values */, csn, urp, LDAP_MOD_REPLACE);
+ entry_delete_present_values_wsi(e, type, NULL /* Delete all values */, csn, urp, LDAP_MOD_REPLACE, vals);
/*
* Add the new values. If there are no new values,
@@ -706,7 +713,7 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN *csn, int urp)
case LDAP_MOD_DELETE:
LDAPDebug( LDAP_DEBUG_ARGS, " delete: %s\n", mod->mod_type, 0, 0 );
- retVal = entry_delete_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, mod->mod_op );
+ retVal = entry_delete_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, mod->mod_op, NULL );
break;
case LDAP_MOD_REPLACE:
@@ -1014,7 +1021,21 @@ resolve_attribute_state_multi_valued(Slapi_Entry *e, Slapi_Attr *a, int attribut
deletedcsn= csn_max(vdcsn, adcsn);
/* check if the attribute or value was deleted after the value was last updated */
+ /* When a replace operation happens, the entry_replace_present_values_wsi() function
+ * first calls entry_delete_present_values_wsi with vals == NULL to essentially delete
+ * the attribute and set the deletion csn. If the urp flag is set (urp in this case
+ * meaning the operation is a replicated op), entry_delete_present_values_wsi will
+ * call this function which will move the present values to the deleted values
+ * (see above - delete_priority will be 1) then the below code will move the
+ * attribute to the deleted list.
+ * next, entry_replace_present_values_wsi will call entry_add_present_values_wsi
+ * to add the values provided in the replace operation. We need to be able to
+ * "resurrect" these deleted values and resurrect the deleted attribute. In the
+ * replace case, the deletedcsn will be the same as the vucsn of the values that
+ * should be present values.
+ */
if((csn_compare(vucsn,deletedcsn)>0) ||
+ ((delete_priority == 0) && (csn_compare(vucsn,deletedcsn)==0)) ||
value_distinguished_at_csn(e, a, v, deletedcsn))
{
entry_deleted_value_to_present_value(a,v);
13 years, 8 months
ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/entrywsi.c | 43 +++++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 11 deletions(-)
New commits:
commit c559982cddbe09bad1b7717a84c7b0187111d61a
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Mar 30 16:01:58 2010 -0600
Bug 578167 - repl. of mod/replace deletes multi-valued attrs
https://bugzilla.redhat.com/show_bug.cgi?id=578167
Resolves: bug 578167
Bug Description: repl. of mod/replace deletes multi-valued attrs
Reviewed by: nkinder (Thanks!)
Branch: HEAD
Fix Description: The server implements a mod/replace operation as a
mod/delete if all values, followed by a mod/add of the new values. The
mod/delete phase, since it removes all of the values, essentially deletes
the attribute, so it must set the attribute deletion_csn. This is even
true in the case when you do a mod/replace on an attribute that doesn't yet
exist. We have to create an empty attribute on the deleted_attrs list with
the deletion_csn set to the csn of the operation. This preserves the
semantics of the mod/replace operation.
When doing the add phase of the mod/replace, we have to be able to
resurrect attributes and values that may have been deleted by the mod/delete
phase. We can tell that we need to resurrect a deleted value in
resolve_attribute_state_multi_valued, in the deleted_values loop, because
the deletioncsn will be the same as the update csn, and the
delete_priority flag will be 0.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 14ff163..6b51ef1 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -532,7 +532,7 @@ entry_add_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **b
* returning an LDAP result code.
*/
static int
-entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **vals, const CSN *csn, int urp, int mod_op)
+entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval **vals, const CSN *csn, int urp, int mod_op, struct berval **replacevals)
{
int retVal= LDAP_SUCCESS;
Slapi_Attr *a= NULL;
@@ -648,18 +648,25 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
retVal= LDAP_NO_SUCH_ATTRIBUTE;
/* NOTE: LDAP says that a MOD REPLACE with no vals of a non-existent
attribute is a no-op - MOD REPLACE with some vals will add the attribute */
- if ((LDAP_MOD_REPLACE == mod_op) && vals && vals[0])
+ /* if we are doing a replace with actual values, meaning the result
+ of the mod is that the attribute will have some values, we need to create
+ a dummy attribute for entry_add_present_values_wsi to use, and set
+ the deletion csn to the csn of the current operation */
+ /* note that if LDAP_MOD_REPLACE == mod_op then vals is NULL -
+ see entry_replace_present_values_wsi */
+ if ((LDAP_MOD_REPLACE == mod_op) && replacevals && replacevals[0])
{
/* Create a new attribute and set the adcsn */
Slapi_Attr *a = slapi_attr_new();
slapi_attr_init(a, type);
- /* According to URP there should be an adcsn.
- * According to Tests, there should not
- * since the attribute never existed
- * Tests 26 and 27 of MMRepl state. */
- if (urp)
- attr_set_deletion_csn(a,csn);
- attrlist_add(&e->e_attrs, a);
+ attr_set_deletion_csn(a,csn);
+ /* mark the attribute as deleted - it does not really
+ exist yet - the code in entry_add_present_values_wsi
+ will add it back to the present list in the non urp case,
+ or determine if the attribute needs to be added
+ or not in the urp case
+ */
+ entry_add_deleted_attribute_wsi(e, a);
}
}
return( retVal );
@@ -677,7 +684,7 @@ entry_replace_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
/*
* Remove all existing values.
*/
- entry_delete_present_values_wsi(e, type, NULL /* Delete all values */, csn, urp, LDAP_MOD_REPLACE);
+ entry_delete_present_values_wsi(e, type, NULL /* Delete all values */, csn, urp, LDAP_MOD_REPLACE, vals);
/*
* Add the new values. If there are no new values,
@@ -706,7 +713,7 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN *csn, int urp)
case LDAP_MOD_DELETE:
LDAPDebug( LDAP_DEBUG_ARGS, " delete: %s\n", mod->mod_type, 0, 0 );
- retVal = entry_delete_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, mod->mod_op );
+ retVal = entry_delete_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, mod->mod_op, NULL );
break;
case LDAP_MOD_REPLACE:
@@ -1014,7 +1021,21 @@ resolve_attribute_state_multi_valued(Slapi_Entry *e, Slapi_Attr *a, int attribut
deletedcsn= csn_max(vdcsn, adcsn);
/* check if the attribute or value was deleted after the value was last updated */
+ /* When a replace operation happens, the entry_replace_present_values_wsi() function
+ * first calls entry_delete_present_values_wsi with vals == NULL to essentially delete
+ * the attribute and set the deletion csn. If the urp flag is set (urp in this case
+ * meaning the operation is a replicated op), entry_delete_present_values_wsi will
+ * call this function which will move the present values to the deleted values
+ * (see above - delete_priority will be 1) then the below code will move the
+ * attribute to the deleted list.
+ * next, entry_replace_present_values_wsi will call entry_add_present_values_wsi
+ * to add the values provided in the replace operation. We need to be able to
+ * "resurrect" these deleted values and resurrect the deleted attribute. In the
+ * replace case, the deletedcsn will be the same as the vucsn of the values that
+ * should be present values.
+ */
if((csn_compare(vucsn,deletedcsn)>0) ||
+ ((delete_priority == 0) && (csn_compare(vucsn,deletedcsn)==0)) ||
value_distinguished_at_csn(e, a, v, deletedcsn))
{
entry_deleted_value_to_present_value(a,v);
13 years, 8 months
esc/src/app/xul/esc/chrome/content/esc ESC.js, 1.30, 1.31
by Jack Magne
Author: jmagne
Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv5915
Modified Files:
ESC.js
Log Message:
Simple refinement to fix of #469867, Cannot use arrow keys to move between cards in the main ESC screen.
Index: ESC.js
===================================================================
RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ESC.js 17 Mar 2010 00:43:52 -0000 1.30
+++ ESC.js 30 Mar 2010 20:49:49 -0000 1.31
@@ -1862,6 +1862,8 @@
window.setTimeout('ShowWindow()',250);
+ list.focus();
+
}
//Window related functions
13 years, 8 months
ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/configdse.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit 6e839e9cc2acb957dc3435ee46aa9d2942cf1bcc
Author: Endi S. Dewata <edewata(a)redhat.com>
Date: Mon Mar 22 17:53:33 2010 -0500
Bug 566320 - RFE: add exception to removal of attributes in cn=config for aci
https://bugzilla.redhat.com/show_bug.cgi?id=566320
Resolves: bug 566320
Bug description: RFE: add exception to removal of attributes in cn=config for aci
Fix description: The modify_config_dse() has been modified to
check the ignore_attr_type() for all types of modify operation.
Reviewed by: rmeggins (and pushed by)
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index 317c78d..91b8580 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -391,17 +391,17 @@ modify_config_dse(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, in
for ( apply_mods = 0; apply_mods <= 1; apply_mods++ ) {
int i = 0;
for (i = 0; (mods[i] && (LDAP_SUCCESS == rc)); i++) {
+ /* send all aci modifications to the backend */
+ config_attr = (char *)mods[i]->mod_type;
+ if (ignore_attr_type(config_attr))
+ continue;
+
if ((mods[i]->mod_op & LDAP_MOD_DELETE) ||
(mods[i]->mod_op & LDAP_MOD_ADD)) {
rc= LDAP_UNWILLING_TO_PERFORM;
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "%s attributes is not allowed",
(mods[i]->mod_op & LDAP_MOD_DELETE) ? "Deleting" : "Adding");
} else if (mods[i]->mod_op & LDAP_MOD_REPLACE) {
- /* send all aci modifications to the backend */
- config_attr = (char *)mods[i]->mod_type;
- if (ignore_attr_type(config_attr))
- continue;
-
if ( (checked_all_maxdiskspace_and_mlogsize == 0 ) &&
((strcasecmp( mods[i]->mod_type, CONFIG_ERRORLOG_MAXLOGDISKSPACE_ATTRIBUTE) == 0) ||
(strcasecmp( mods[i]->mod_type, CONFIG_ERRORLOG_MAXLOGSIZE_ATTRIBUTE) == 0) ||
13 years, 8 months
Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/connection.c | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 6dec0725ba70e97deefcaec605b5192368e2625c
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 15:11:58 2010 -0600
Bug 567429 - slapd didn't close connection and get into CLOSE_WAIT state
https://bugzilla.redhat.com/show_bug.cgi?id=567429
Resolves: bug 567429
Bug Description: slapd didn't close connection and get into CLOSE_WAIT state
Reviewed by: nhosoi (Thanks!)
Branch: Directory_Server_8_2_Branch
Fix Description: The JNDI code attached to the bug uses persistent search.
The connection pool code handles persistent searches differently than
regular connections. The connection pool code was acquiring a reference
to a conn, but was not releasing it in the persistent search case, assuming
the persistent search code did not also have a reference, but it does. This
caused connection_table_move_connection_out_of_active_list() to not move
the connection out of the active list, and therefore available for closing,
because there was an outstanding reference. The solution is for the
connection pool code to release its reference.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 48d50e8f06e0c2fd8e2541c3c239217a6b72ebbc)
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 5c8decb..d2b728c 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -971,6 +971,13 @@ done:
}
PR_Unlock( conn->c_mutex );
+ } else { /* ps code acquires ref to conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ if (connection_release_nolock (conn) != 0)
+ {
+ return_value = -1;
+ }
+ PR_Unlock( conn->c_mutex );
}
return return_value;
}
@@ -2294,6 +2301,10 @@ done:
connection_release_nolock (conn);
}
PR_Unlock( conn->c_mutex );
+ } else { /* the ps code acquires a ref to the conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ connection_release_nolock (conn);
+ PR_Unlock( conn->c_mutex );
}
/* Since we didn't do so earlier, we need to make a replication connection readable again here */
if ( ((1 == is_timedout) || (replication_connection && !thread_turbo_flag)) && !more_data)
13 years, 8 months
ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/connection.c | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 48d50e8f06e0c2fd8e2541c3c239217a6b72ebbc
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 15:11:58 2010 -0600
Bug 567429 - slapd didn't close connection and get into CLOSE_WAIT state
https://bugzilla.redhat.com/show_bug.cgi?id=567429
Resolves: bug 567429
Bug Description: slapd didn't close connection and get into CLOSE_WAIT state
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: The JNDI code attached to the bug uses persistent search.
The connection pool code handles persistent searches differently than
regular connections. The connection pool code was acquiring a reference
to a conn, but was not releasing it in the persistent search case, assuming
the persistent search code did not also have a reference, but it does. This
caused connection_table_move_connection_out_of_active_list() to not move
the connection out of the active list, and therefore available for closing,
because there was an outstanding reference. The solution is for the
connection pool code to release its reference.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 8686d16..bab3345 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -991,6 +991,13 @@ done:
}
PR_Unlock( conn->c_mutex );
+ } else { /* ps code acquires ref to conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ if (connection_release_nolock (conn) != 0)
+ {
+ return_value = -1;
+ }
+ PR_Unlock( conn->c_mutex );
}
return return_value;
}
@@ -2314,6 +2321,10 @@ done:
connection_release_nolock (conn);
}
PR_Unlock( conn->c_mutex );
+ } else { /* the ps code acquires a ref to the conn - we need to release ours here */
+ PR_Lock( conn->c_mutex );
+ connection_release_nolock (conn);
+ PR_Unlock( conn->c_mutex );
}
/* Since we didn't do so earlier, we need to make a replication connection readable again here */
if ( ((1 == is_timedout) || (replication_connection && !thread_turbo_flag)) && !more_data)
13 years, 8 months
ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/replication/cl5_api.c | 4 +++-
ldap/servers/slapd/libglobs.c | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 65e04b8d72fa0ebe8a4c8475c6bc26ac831f984f
Author: Endi S. Dewata <edewata(a)redhat.com>
Date: Sun Mar 21 23:15:56 2010 -0500
Bug 455489 - Address compiler warnings about strict-aliasing rules
https://bugzilla.redhat.com/show_bug.cgi?id=455489
Resolves: bug 455489
Bug description: Address compiler warnings about strict-aliasing rules
Fix description: The codes that generate strict-aliasing warnings have
been changed.
Reviewed by: rmeggins (and pushed by)
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index b468d32..b4ec5e4 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -4548,6 +4548,7 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
char csnStr [CSN_STRSIZE];
struct berval **vals;
DB_TXN *txnid = NULL;
+ char *buff;
if ((purge && file->purgeRUV == NULL) || (!purge && file->maxRUV == NULL))
return CL5_SUCCESS;
@@ -4565,7 +4566,8 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
key.size = CSN_STRSIZE;
- rc = _cl5WriteBervals (vals, (char**)&data.data, &data.size);
+ rc = _cl5WriteBervals (vals, &buff, &data.size);
+ data.data = buff;
ber_bvecfree(vals);
if (rc != CL5_SUCCESS)
{
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 89a3c79..dbeae65 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -5796,9 +5796,9 @@ config_set_entry(Slapi_Entry *e)
if (needs_free && value) { /* assumes memory allocated by slapi_ch_Xalloc */
if (CONFIG_CHARRAY == cgas->config_var_type) {
- charray_free(*((char ***)value));
+ charray_free((char **)*value);
} else if (CONFIG_SPECIAL_REFERRALLIST == cgas->config_var_type) {
- ber_bvecfree(*((struct berval ***)value));
+ ber_bvecfree((struct berval **)*value);
} else if ((CONFIG_CONSTANT_INT != cgas->config_var_type) && /* do not free constants */
(CONFIG_CONSTANT_STRING != cgas->config_var_type)) {
slapi_ch_free(value);
13 years, 8 months
Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/syntaxes/string.c | 6 +++---
ldap/servers/slapd/filterentry.c | 19 ++++++++++++++++---
ldap/servers/slapd/proto-slap.h | 2 ++
3 files changed, 21 insertions(+), 6 deletions(-)
New commits:
commit 41c5be046a21f06a1e743513631814186c7df79b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 11:51:26 2010 -0600
Bug 576074 - search filters with parentheses fail
https://bugzilla.redhat.com/show_bug.cgi?id=576074
Resolves: bug 576074
Bug Description: search filters with parentheses fail
Reviewed by: nhosoi (Thanks!)
Branch: Directory_Server_8_2_Branch
Fix Description: PCRE requires '(' and ')' to be escaped to match a literal
parenthesis. Otherwise, it thinks the parenthesis is used for grouping.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit c1d2e7461ac41f39f5f27f3d9dcd6084bb4435a5)
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index ad607dc..dd44a80 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -262,7 +262,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
if ( initial != NULL ) {
value_normalize( initial, syntax, 1 /* trim leading blanks */ );
*p++ = '^';
- filter_strcpy_special( p, initial );
+ filter_strcpy_special_ext( p, initial, FILTER_STRCPY_ESCAPE_PARENS );
p = strchr( p, '\0' );
}
if ( any != NULL ) {
@@ -271,7 +271,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
/* ".*" + value */
*p++ = '.';
*p++ = '*';
- filter_strcpy_special( p, any[i] );
+ filter_strcpy_special_ext( p, any[i], FILTER_STRCPY_ESCAPE_PARENS );
p = strchr( p, '\0' );
}
}
@@ -280,7 +280,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
/* ".*" + value */
*p++ = '.';
*p++ = '*';
- filter_strcpy_special( p, final );
+ filter_strcpy_special_ext( p, final, FILTER_STRCPY_ESCAPE_PARENS );
strcat( p, "$" );
}
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index f566676..f163b47 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -647,7 +647,7 @@ test_filter_list(
}
void
-filter_strcpy_special( char *d, char *s )
+filter_strcpy_special_ext( char *d, char *s, int flags )
{
for ( ; *s; s++ ) {
switch ( *s ) {
@@ -660,14 +660,27 @@ filter_strcpy_special( char *d, char *s )
case '^':
case '$':
*d++ = '\\';
- /* FALL */
+ break;
+ case '(':
+ case ')':
+ if (flags & FILTER_STRCPY_ESCAPE_PARENS) {
+ *d++ = '\\';
+ }
+ break;
default:
- *d++ = *s;
+ break;
}
+ *d++ = *s;
}
*d = '\0';
}
+void
+filter_strcpy_special( char *d, char *s )
+{
+ return filter_strcpy_special_ext(d, s, 0);
+}
+
int test_substring_filter(
Slapi_PBlock *pb,
Slapi_Entry *e,
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 5608670..d428ff9 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -574,6 +574,8 @@ void set_hash_filters(int i);
* filterentry.c
*/
void filter_strcpy_special( char *d, char *s );
+#define FILTER_STRCPY_ESCAPE_PARENS 0x01
+void filter_strcpy_special_ext( char *d, char *s, int flags );
/*
13 years, 8 months
ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/syntaxes/string.c | 6 +++---
ldap/servers/slapd/filterentry.c | 19 ++++++++++++++++---
ldap/servers/slapd/proto-slap.h | 2 ++
3 files changed, 21 insertions(+), 6 deletions(-)
New commits:
commit c1d2e7461ac41f39f5f27f3d9dcd6084bb4435a5
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 11:51:26 2010 -0600
Bug 576074 - search filters with parentheses fail
https://bugzilla.redhat.com/show_bug.cgi?id=576074
Resolves: bug 576074
Bug Description: search filters with parentheses fail
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: PCRE requires '(' and ')' to be escaped to match a literal
parenthesis. Otherwise, it thinks the parenthesis is used for grouping.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index ad607dc..dd44a80 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -262,7 +262,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
if ( initial != NULL ) {
value_normalize( initial, syntax, 1 /* trim leading blanks */ );
*p++ = '^';
- filter_strcpy_special( p, initial );
+ filter_strcpy_special_ext( p, initial, FILTER_STRCPY_ESCAPE_PARENS );
p = strchr( p, '\0' );
}
if ( any != NULL ) {
@@ -271,7 +271,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
/* ".*" + value */
*p++ = '.';
*p++ = '*';
- filter_strcpy_special( p, any[i] );
+ filter_strcpy_special_ext( p, any[i], FILTER_STRCPY_ESCAPE_PARENS );
p = strchr( p, '\0' );
}
}
@@ -280,7 +280,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
/* ".*" + value */
*p++ = '.';
*p++ = '*';
- filter_strcpy_special( p, final );
+ filter_strcpy_special_ext( p, final, FILTER_STRCPY_ESCAPE_PARENS );
strcat( p, "$" );
}
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index f566676..f163b47 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -647,7 +647,7 @@ test_filter_list(
}
void
-filter_strcpy_special( char *d, char *s )
+filter_strcpy_special_ext( char *d, char *s, int flags )
{
for ( ; *s; s++ ) {
switch ( *s ) {
@@ -660,14 +660,27 @@ filter_strcpy_special( char *d, char *s )
case '^':
case '$':
*d++ = '\\';
- /* FALL */
+ break;
+ case '(':
+ case ')':
+ if (flags & FILTER_STRCPY_ESCAPE_PARENS) {
+ *d++ = '\\';
+ }
+ break;
default:
- *d++ = *s;
+ break;
}
+ *d++ = *s;
}
*d = '\0';
}
+void
+filter_strcpy_special( char *d, char *s )
+{
+ return filter_strcpy_special_ext(d, s, 0);
+}
+
int test_substring_filter(
Slapi_PBlock *pb,
Slapi_Entry *e,
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index be3b9dd..e67cfae 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -595,6 +595,8 @@ void set_hash_filters(int i);
* filterentry.c
*/
void filter_strcpy_special( char *d, char *s );
+#define FILTER_STRCPY_ESCAPE_PARENS 0x01
+void filter_strcpy_special_ext( char *d, char *s, int flags );
/*
13 years, 8 months
Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 8 +++++++-
ldap/servers/slapd/back-ldbm/ldbm_modify.c | 4 ++++
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 5db90314f1d0239b928a35e325b4810d14677c6b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Mar 25 12:10:46 2010 -0600
Bug 571677 - Busy replica on consumers when directly deleting a replication conflict
https://bugzilla.redhat.com/show_bug.cgi?id=571677
Resolves: bug 571677
Bug Description: Busy replica on consumers when directly deleting a replication conflict
Reviewed by: nhosoi (Thanks!)
Branch: Directory_Server_8_2_Branch
Fix Description: In some cases, urp fixup operations can be called from
the bepreop stage of other operations. The ldbm_back_delete() and
ldbm_back_modify() code lock the target entry in the cache. If a bepreop
then attempts to operate on the same entry and acquire the lock on the
entry, deadlock will occur.
The modrdn code does not acquire the cache lock on the target entries
before calling the bepreops. The modify and delete code does not acquire
the cache lock on the target entries before calling the bepostops.
I tried unlocking the target entry before calling the bepreops, then locking
the entry just after. This causes the problem to disappear, but I do not
know if this will lead to race conditions. The modrdn has been working this
way forever, and there are no known race conditions with that code.
I think the most robust fix for this issue would be to introduce some sort
of semaphore instead of a simple mutex on the cached entry. Then
cache_lock_entry would look something like this:
if entry->sem == 0
entry->sem++ /* acquire entry */
entry->locking_thread = this_thread
else if entry->locking_thread == this_thread
entry->sem++ /* increment count on this entry */
else
wait_for_sem(entry->sem) /* wait until released */
and cache_unlock_entry would look something like this:
entry->sem--;
if entry->sem == 0
entry->locking_thread = 0
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit eac3f15f2209719e05640e1576b4273d03bef079)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 9cb961c..c1cb1cf 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -178,6 +178,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
/* Don't call pre-op for Tombstone entries */
if (!delete_tombstone_entry)
{
+ int rc = 0;
/*
* Some present state information is passed through the PBlock to the
* backend pre-op plugin. To ensure a consistent snapshot of this state
@@ -191,7 +192,12 @@ ldbm_back_delete( Slapi_PBlock *pb )
goto error_return;
}
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
- if(plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN)==-1)
+ /* have to unlock the entry here, in case the bepreop attempts
+ to modify the same entry == deadlock */
+ cache_unlock_entry( &inst->inst_cache, e );
+ rc = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN);
+ cache_lock_entry( &inst->inst_cache, e );
+ if (rc == -1)
{
/*
* Plugin indicated some kind of failure,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 2b17eee..ecd42c9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -294,7 +294,11 @@ ldbm_back_modify( Slapi_PBlock *pb )
/* ec is the entry that our bepreop should get to mess with */
slapi_pblock_set( pb, SLAPI_MODIFY_EXISTING_ENTRY, ec->ep_entry );
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
+ /* have to unlock the entry here, in case the bepreop attempts
+ to modify the same entry == deadlock */
+ cache_unlock_entry( &inst->inst_cache, e );
plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_MODIFY_FN);
+ cache_lock_entry( &inst->inst_cache, e );
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/* The Plugin may have messed about with some of the PBlock parameters... ie. mods */
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 0dd8eb2..8cb7173 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -876,6 +876,7 @@ common_return:
cache_return( &inst->inst_cache, &ec );
}
+ moddn_unlock_and_return_entries(be,&e,&existingentry);
/*
* The bepostop is called even if the operation fails.
*/
@@ -889,7 +890,6 @@ common_return:
slapi_mods_done(&smods_operation_wsi);
slapi_mods_done(&smods_generated);
slapi_mods_done(&smods_generated_wsi);
- moddn_unlock_and_return_entries(be,&e,&existingentry);
slapi_ch_free((void**)&child_entries);
slapi_ch_free((void**)&child_entry_copies);
if (ldap_result_matcheddn && 0 != strcmp(ldap_result_matcheddn, "NULL"))
13 years, 8 months