ldap/servers/slapd/entrywsi.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
New commits:
commit c4667c08c36294e460a43a378a5f426c841c850c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jun 12 16:58:31 2013 -0700
Trac Ticket #402 - nhashed#user#password in entry extension
Description: commit 091c749adcc53ef3332cab6d34b25dadcb69c696
had a logic flaw: entry_apply_mod_wsi checks whether modify
candidate attribute is to be stored in an entry extension or
not. If it is supposed to be in the entry extension, it removes
the attribute from the entry attribute list (e_attrs), and put
it into the entry extension. The steps have to be done under
any condition, but entry_apply_mod_wsi used to check if the
entry extension was configured properly and the attribute
existed in the extension, first. If both were not satisfied,
the attribute was not removed from the attribute list.
This patch eliminated the check and the attribute to be stored
in the entry extension is always removed from the attribute
list in the entry.
Reviewed by Nathan (Thank you!!)
https://fedorahosted.org/389/ticket/402
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 00de193..200743d 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -952,27 +952,24 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN
*csn, int urp)
for (aiep = attrs_in_extension; aiep && aiep->ext_type; aiep++) {
if (0 == strcasecmp(mod->mod_type, aiep->ext_type)) {
Slapi_Attr *a;
- int rc;
- Slapi_Value **ext_vals = NULL;
- rc = slapi_pw_get_entry_ext(e, &ext_vals);
- if (rc) {
- continue; /* skip it. */
- }
+ /* remove the attribute from the attr list */
a = attrlist_remove(&e->e_attrs, mod->mod_type);
if (a && a->a_present_values.va) {
/* a->a_present_values.va is consumed if successful. */
- rc = slapi_pw_set_entry_ext(e, a->a_present_values.va,
- SLAPI_EXT_SET_REPLACE);
+ int rc = slapi_pw_set_entry_ext(e, a->a_present_values.va,
+ SLAPI_EXT_SET_REPLACE);
if (LDAP_SUCCESS == rc) {
/* va is set to entry extension; just release the rest */
a->a_present_values.va = NULL;
}
slapi_attr_free(&a);
} else {
+ Slapi_Value **ext_vals = NULL;
+ slapi_pw_get_entry_ext(e, &ext_vals);
if (ext_vals) {
/* slapi_pw_set_entry_ext frees the stored extension */
- rc = slapi_pw_set_entry_ext(e, NULL, SLAPI_EXT_SET_REPLACE);
+ slapi_pw_set_entry_ext(e, NULL, SLAPI_EXT_SET_REPLACE);
ext_vals = NULL;
}
}