[PATCH] dbwrap_ctdb: Treat empty records as non-existing
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed Aug 28 06:08:12 MDT 2013
Hi!
Attached find a patch that is meant as a workaround for bug
10008 until the problem is really fixed.
It does fix a lot of nasty messages in my tests.
Please 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
*****************************************************************
visit us on it-sa:IT security exhibitions in Nürnberg, Germany
October 8th - 10th 2013, hall 12, booth 333
free tickets available via code 270691 on: www.it-sa.de/gutschein
******************************************************************
-------------- next part --------------
From 5c9c2c287d9a801599d7a7f834881a7e61e3558f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 28 Aug 2013 11:34:08 +0000
Subject: [PATCH] dbwrap_ctdb: Treat empty records as non-existing
This is a patch implementing the workaround Christian mentioned in
https://bugzilla.samba.org/show_bug.cgi?id=10008#c5
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10008
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/lib/ctdbd_conn.c | 8 ++++++++
source3/lib/dbwrap/dbwrap_ctdb.c | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 4f5dce0..f960541 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1474,6 +1474,14 @@ NTSTATUS ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
goto fail;
}
+ if (reply->datalen == 0) {
+ /*
+ * Treat an empty record as non-existing
+ */
+ status = NT_STATUS_NOT_FOUND;
+ goto fail;
+ }
+
parser(key, make_tdb_data(&reply->data[0], reply->datalen),
private_data);
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index f90e7b8..5a473f9 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -103,6 +103,16 @@ static int db_ctdb_ltdb_parser(TDB_DATA key, TDB_DATA data,
if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
return -1;
}
+ if (data.dsize == sizeof(struct ctdb_ltdb_header)) {
+ /*
+ * Making this a separate case that needs fixing
+ * separately. This is an empty record. ctdbd does not
+ * distinguish between empty and deleted records. Samba right
+ * now can live without empty records, so lets treat zero-size
+ * (i.e. deleted) records as non-existing.
+ */
+ return -1;
+ }
state->parser(
key, (struct ctdb_ltdb_header *)data.dptr,
make_tdb_data(data.dptr + sizeof(struct ctdb_ltdb_header),
--
1.8.1.2
More information about the samba-technical
mailing list