[PATCH] Fixes for pdb_tdb

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Nov 11 03:52:05 MST 2014


Hi!

I'd appreciate review&push.

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From dc02ed0a5dc28439080a79bac2954cac0f44d694 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 11 Nov 2014 10:35:50 +0000
Subject: [PATCH 1/2] pdb_tdb: Fix a TALLOC/SAFE_FREE mixup

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/passdb/pdb_tdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 0d31c47..ba1f1d4 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -606,7 +606,7 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods,
 
 	if (!init_samu_from_buffer(user, SAMU_BUFFER_LATEST, data.dptr, data.dsize)) {
 		DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
-		SAFE_FREE(data.dptr);
+		TALLOC_FREE(data.dptr);
 		return NT_STATUS_NO_MEMORY;
 	}
 
-- 
1.8.1.2


From 29e5ff6373a2242160d5cc248761509d006e764f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 11 Nov 2014 10:36:23 +0000
Subject: [PATCH 2/2] pdb_tdb: Avoid a nasty error message with ctdb

ctdb gives us 0-sized records for deleted passdb entries

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/passdb/pdb_tdb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index ba1f1d4..d1ff006f 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -602,6 +602,12 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods,
 		return NT_STATUS_NO_SUCH_USER;
 	}
 
+	if (data.dsize == 0) {
+		DEBUG(5, ("%s: Got 0-sized record for key %s\n", __func__,
+			  keystr));
+		return NT_STATUS_NO_SUCH_USER;
+	}
+
   	/* unpack the buffer */
 
 	if (!init_samu_from_buffer(user, SAMU_BUFFER_LATEST, data.dptr, data.dsize)) {
-- 
1.8.1.2



More information about the samba-technical mailing list