Skip to content

Commit

Permalink
Trac Ticket #402 - nhashed#user#password in entry extension
Browse files Browse the repository at this point in the history
Description: commit 091c749
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
(cherry picked from commit c4667c0)
  • Loading branch information
nhosoi committed Jun 13, 2013
1 parent 17d9dc5 commit 539419f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ldap/servers/slapd/entrywsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,27 +767,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;
}
}
Expand Down

0 comments on commit 539419f

Please sign in to comment.