소스 검색

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
Noriko Hosoi 12 년 전
부모
커밋
c4667c08c3
1개의 변경된 파일6개의 추가작업 그리고 9개의 파일을 삭제
  1. 6 9
      ldap/servers/slapd/entrywsi.c

+ 6 - 9
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;
 				}
 			}