andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0304-Ticket-47752-Don-t-add-unhashed-password-mod-if-we-d.patch

dc8c34
From 0e6c3ac53a325051ef2d2478bfaff44c46cd39f0 Mon Sep 17 00:00:00 2001
dc8c34
From: Nathan Kinder <nkinder@redhat.com>
dc8c34
Date: Mon, 17 Mar 2014 19:34:45 -0700
dc8c34
Subject: [PATCH 304/305] Ticket 47752 - Don't add unhashed password mod if we
dc8c34
 don't have an unhashed value
dc8c34
dc8c34
When performing a modify operation to replace the userpassword with a pre-hashed
dc8c34
value, the modify code adds a LDAPMod that replaces the "unhashed#user#password"
dc8c34
attribute with no values. While this doesn't cause any harm inside DS itself, it
dc8c34
is not the correct behavior. We should only add a LDAPMod for the unhashed password
dc8c34
if we actually have an unhashed value available.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47752
dc8c34
dc8c34
Reviewed by mreynold@redhat.com
dc8c34
dc8c34
(cherry picked from commit ccc61a3a589a47844a7e6eeb13f87e1351637618)
dc8c34
---
dc8c34
 ldap/servers/slapd/modify.c | 4 ++--
dc8c34
 1 file changed, 2 insertions(+), 2 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
dc8c34
index 90c9f8c..9c6610f 100644
dc8c34
--- a/ldap/servers/slapd/modify.c
dc8c34
+++ b/ldap/servers/slapd/modify.c
dc8c34
@@ -961,10 +961,10 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
dc8c34
 			} else {
dc8c34
 				/* add pseudo password attribute - only if it's value is clear text */
dc8c34
 				valuearray_init_bervalarray_unhashed_only(pw_mod->mod_bvalues, &va);
dc8c34
-				if(va){
dc8c34
+				if(va && va[0]){
dc8c34
 					slapi_mods_add_mod_values(&smods, pw_mod->mod_op, unhashed_pw_attr, va);
dc8c34
-					valuearray_free(&va);
dc8c34
 				}
dc8c34
+                                valuearray_free(&va);
dc8c34
 			}
dc8c34
 
dc8c34
 			/* Init new value array for hashed value */
dc8c34
-- 
dc8c34
1.9.3
dc8c34