Samba 4.2.0rc3 regression: bug 10940

Stefan (metze) Metzmacher metze at samba.org
Mon Jan 5 04:04:14 MST 2015


Am 24.12.2014 um 16:50 schrieb Jeremy Allison:
> On Wed, Dec 24, 2014 at 12:51:51PM +0100, Roel van Meer wrote:
>> Hi list, Andrew,
>>
>> while testing Samba 4.2.0rc[23], I came across a problem where a
>> code cleanup patch broke basic functionality, e.g. the ability to
>> connect to a share on a PDC setup. This had already been reported in
>> bug https://bugzilla.samba.org/show_bug.cgi?id=10940, with different
>> symptoms.
>>
>> The patch that broke things is trivial, and reverting it fixes the problems:
>> https://lists.samba.org/archive/samba-technical/2014-September/102319.html
>>
>> This might be something to look at before 4.2.0 final is released.
>>
>>
>> Since this is not a trivial problem, and the bug didn't seem to have
>> been looked at yet, I thought I'd mention it here.
>>
>> Happy holidays and thanks for all the good work!
> 
> Thanks a *LOT* for testing this Roel.
> 
> Looks like Metze has a fix for this we can
> get into master and 4.2.0 final.
> 
> Merry Christmas and thanks for working on
> it at this time of year :-).

Can someone please review/push the attached fix?

Thanks!
metze
-------------- next part --------------
From d8ec55098bcd4bd575584ec1d0a4073f706b5b55 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 24 Dec 2014 13:58:12 +0100
Subject: [PATCH] s3:passdb: fix logic in pdb_set_pw_history()

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10940

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/passdb/pdb_get_set.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 1b716f4..5e162db 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -872,19 +872,20 @@ bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e
 
 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32_t historyLen, enum pdb_value_state flag)
 {
+	DATA_BLOB new_nt_pw_his = {};
+
 	if (historyLen && pwd){
-		DATA_BLOB *old_nt_pw_his = &(sampass->nt_pw_his);
-		sampass->nt_pw_his = data_blob_talloc(sampass,
-						      pwd, historyLen*PW_HISTORY_ENTRY_LEN);
-		data_blob_free(old_nt_pw_his);
-		if (!sampass->nt_pw_his.length) {
+		new_nt_pw_his = data_blob_talloc(sampass,
+						 pwd, historyLen*PW_HISTORY_ENTRY_LEN);
+		if (new_nt_pw_his.length == 0) {
 			DEBUG(0, ("pdb_set_pw_history: data_blob_talloc() failed!\n"));
 			return False;
 		}
-	} else {
-		sampass->nt_pw_his = data_blob_talloc(sampass, NULL, 0);
 	}
 
+	data_blob_free(&sampass->nt_pw_his);
+	sampass->nt_pw_his = new_nt_pw_his;
+
 	return pdb_set_init_flags(sampass, PDB_PWHISTORY, flag);
 }
 
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150105/f4e7f34b/attachment.pgp>


More information about the samba-technical mailing list