[PATCH] smbd: Avoid sending 0-sized keys to dbwrap

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Mar 26 03:01:10 MDT 2013


Hi!

While doing ctdb performance work, it became obvious that we
are trying to access 0-length keys in notify_index.tdb. The
attached patch fixes that.

Please review & push to master.

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 3e24ff714e6816aa221399cf273c0c219d356e75 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 25 Mar 2013 14:52:24 +0100
Subject: [PATCH] smbd: Avoid sending 0-sized keys to dbwrap

Start the notification one level below /. Sharing and notifying / for changes
is broken at this moment anyway. When sharing / and someone wants to get
notified for changes under /usr, we store "//usr" as the notify_index key. So
this patch does not break anything that is not broken today, and it avoids a
bogus call to dbwrap_parse_records.
---
 source3/smbd/notify_internal.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index eaf51e7..f5a8584 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -608,11 +608,18 @@ void notify_trigger(struct notify_context *notify,
 		return;
 	}
 
+	if (path[0] != '/') {
+		/*
+		 * The rest of this routine assumes an absolute path.
+		 */
+		return;
+	}
+
 	idx_state.mem_ctx = talloc_tos();
 	idx_state.vnns = NULL;
 	idx_state.my_vnn = get_my_vnn();
 
-	for (p = path; p != NULL; p = next_p) {
+	for (p = strchr(path+1, '/'); p != NULL; p = next_p) {
 		ptrdiff_t path_len = p - path;
 		bool recursive;
 
-- 
1.7.3.4



More information about the samba-technical mailing list