Browse Source

Ticket #584 - Existence of an entry is not checked when its password is to be deleted

Bug description: When attempting to delete a password from an
entry, a password syntax checking api check_pw_syntax_ext missed
a check if the target entry exists or not.  Note: add and replace
checks it and handles the case correctly.

Fix description: In this patch the check is added to the delete
case, as well.

Reviewed by Rich (Thank you!!)
Noriko Hosoi 12 years ago
parent
commit
d559d4665b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      ldap/servers/slapd/pw.c

+ 7 - 1
ldap/servers/slapd/pw.c

@@ -770,7 +770,7 @@ int
 check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
 			char **old_pw, Slapi_Entry *e, int mod_op, Slapi_Mods *smods)
 {
-   	Slapi_Attr		*attr;
+	Slapi_Attr		*attr;
 	int 			i, pwresponse_req = 0;
 	int				is_replication = 0;
 	int				internal_op = 0;
@@ -787,6 +787,12 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
 	 * PASS == 0.
 	 */
 	if (LDAP_MOD_DELETE == (mod_op & LDAP_MOD_OP)) {
+		/* check if the entry exists or not */
+		e = get_entry(pb, dn);
+		if (e == NULL) {
+			return -1;
+		}
+		slapi_entry_free(e); 
 		return 0;
 	}
 	if (NULL == vals) {