[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Mar 26 06:17:02 MDT 2013
The branch, master has been updated
via e3f5e47 smbd: Remove an optimization that became unnecessary
via 07ae7e2 smbd: We don't collect our own vnn anymore
via ebb027b smbd: Slightly simplify notify_trigger
via eb885d1 smbd: Slightly simplify notify_trigger
via 032da72 smbd: Avoid some talloc_realloc in notify_internal
via c2b26a4 dbwrap-ctdb: Avoid a talloc_stackframe()
via d147194 ctdb-conn: remove ctdbd_fetch
via 1409895 dbwrap-ctdb: Use ctdbd_parse in db_ctdb_parse_record
via abe4046 ctdb-conn: Add ctdbd_parse
via c8c0bf7 tdb: Fix blank line endings
via a92c08e tdb: Little format change
via d4ebeeb smbd: Avoid sending 0-sized keys to dbwrap
from bbb4068 dbwrap: Use tdb_null in db_ctdb_delete
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e3f5e474c826940ebaf43256cb06a50309ba3ef5
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 31 13:13:50 2012 +0100
smbd: Remove an optimization that became unnecessary
After we only collect nonlocal vnns in idx_state.vnns now, at this point
we *know* we have something to send to a remote node. The previous code
avoided the call to notify_push_remote_blob with an if-statement that
has now become unnecessary.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Tue Mar 26 13:16:39 CET 2013 on sn-devel-104
commit 07ae7e22f789a67bbd5e9536e1227a1c394990f9
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 31 13:11:19 2012 +0100
smbd: We don't collect our own vnn anymore
notify_trigger_index_parser will not anymore add ourselves into the vnn
list that it collects.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit ebb027b738d0addd3ee5c205c5370b01859aee71
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 31 13:10:12 2012 +0100
smbd: Slightly simplify notify_trigger
We have a good chance that we did not collect any remote vnns. This
avoids trying to walk the remote vnns altogether.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit eb885d1fdd6a2be603061aeef63790c92ca9ba56
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 31 13:08:18 2012 +0100
smbd: Slightly simplify notify_trigger
This straightens the for-loop walking the path components slightly
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 032da72e2b81685f292622cfd2ced14af257849d
Author: Volker Lendecke <vl at samba.org>
Date: Wed Oct 31 13:02:19 2012 +0100
smbd: Avoid some talloc_realloc in notify_internal
For the nonclustered case we will only ever have one vnn in notify_index.tdb.
For this case, without this patch we did talloc_realloc when collecting vnns to
be able to do the memcpy instead of explicit copy with a for-loop. This new
code will partition the new vnns we see when parsing a notify_index.tdb record
into ourselves and all foreign vnns, only really collecting the foreign ones in
an array.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit c2b26a43ffae22c9dff7929c48531fec9e6ed922
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 14:42:06 2012 +0000
dbwrap-ctdb: Avoid a talloc_stackframe()
We have only a single allocation in this routine, so I think we can live
without a stackframe.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d147194466560488cda9f6e5e993c985cea02289
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 14:15:38 2012 +0000
ctdb-conn: remove ctdbd_fetch
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 1409895d9e271744060d3f1ef2c71da5b5151f6a
Author: Volker Lendecke <vl at samba.org>
Date: Sat Nov 24 14:14:37 2012 +0000
dbwrap-ctdb: Use ctdbd_parse in db_ctdb_parse_record
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit abe4046643735cf0bc5bcdfe330dd946ab221808
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 23 17:54:57 2012 +0100
ctdb-conn: Add ctdbd_parse
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit c8c0bf74805c61b1379dab1d4529df0004872bb4
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 18 14:39:04 2013 +0100
tdb: Fix blank line endings
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit a92c08e18bca2f1db671dc5e2d0db4adbf39752d
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 18 10:53:49 2013 +0100
tdb: Little format change
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit d4ebeeb78865c6a20a85437b82a1302921f3d1fe
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 25 14:52:24 2013 +0100
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.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/common/io.c | 2 +-
lib/tdb/tools/tdbbackup.c | 27 ++++++++--------
lib/tdb/tools/tdbdump.c | 8 ++--
lib/tdb/tools/tdbtest.c | 12 ++++----
lib/tdb/tools/tdbtool.c | 40 ++++++++++++------------
lib/tdb/tools/tdbtorture.c | 4 +-
source3/include/ctdbd_conn.h | 8 +++--
source3/lib/ctdbd_conn.c | 26 +++++-----------
source3/lib/dbwrap/dbwrap_ctdb.c | 17 ++--------
source3/smbd/notify_internal.c | 62 ++++++++++++++++++++++++--------------
10 files changed, 102 insertions(+), 104 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c
index b9caffb..7e29c38 100644
--- a/lib/tdb/common/io.c
+++ b/lib/tdb/common/io.c
@@ -84,7 +84,7 @@ static int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len,
}
tdb->map_size = st.st_size;
if (tdb_mmap(tdb) != 0) {
- return - 1;
+ return -1;
}
if (st.st_size < (size_t)off + len) {
diff --git a/lib/tdb/tools/tdbbackup.c b/lib/tdb/tools/tdbbackup.c
index 11ecaa0..276a281 100644
--- a/lib/tdb/tools/tdbbackup.c
+++ b/lib/tdb/tools/tdbbackup.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
low level tdb backup and restore utility
Copyright (C) Andrew Tridgell 2002
@@ -7,12 +7,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -61,7 +61,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c
static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
@@ -122,7 +122,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size)
}
/* open the old tdb */
- tdb = tdb_open_ex(old_name, 0, 0,
+ tdb = tdb_open_ex(old_name, 0, 0,
O_RDWR, 0, &log_ctx, NULL);
if (!tdb) {
printf("Failed to open %s\n", old_name);
@@ -132,10 +132,10 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size)
/* create the new tdb */
unlink(tmp_name);
- tdb_new = tdb_open_ex(tmp_name,
- hash_size ? hash_size : tdb_hash_size(tdb),
- TDB_DEFAULT,
- O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777,
+ tdb_new = tdb_open_ex(tmp_name,
+ hash_size ? hash_size : tdb_hash_size(tdb),
+ TDB_DEFAULT,
+ O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777,
&log_ctx, NULL);
if (!tdb_new) {
perror(tmp_name);
@@ -192,9 +192,9 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size)
/* close the new tdb and re-open read-only */
tdb_close(tdb_new);
- tdb_new = tdb_open_ex(tmp_name,
+ tdb_new = tdb_open_ex(tmp_name,
0,
- TDB_DEFAULT,
+ TDB_DEFAULT,
O_RDONLY, 0,
&log_ctx, NULL);
if (!tdb_new) {
@@ -204,7 +204,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size)
free(tmp_name);
return 1;
}
-
+
/* traverse the new tdb to confirm */
count2 = tdb_traverse(tdb_new, test_fn, NULL);
if (count2 != count1) {
@@ -237,7 +237,7 @@ static int verify_tdb(const char *fname, const char *bak_name)
int count = -1;
/* open the tdb */
- tdb = tdb_open_ex(fname, 0, 0,
+ tdb = tdb_open_ex(fname, 0, 0,
O_RDONLY, 0, &log_ctx, NULL);
/* traverse the tdb, then close it */
@@ -280,7 +280,6 @@ static void usage(void)
printf(" -v verify mode (restore if corrupt)\n");
printf(" -n hashsize set the new hash size for the backup\n");
}
-
int main(int argc, char *argv[])
{
diff --git a/lib/tdb/tools/tdbdump.c b/lib/tdb/tools/tdbdump.c
index 47a84d2..e66ea56 100644
--- a/lib/tdb/tools/tdbdump.c
+++ b/lib/tdb/tools/tdbdump.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
simple tdb dump util
Copyright (C) Andrew Tridgell 2001
@@ -7,12 +7,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -99,7 +99,7 @@ static int dump_tdb(const char *fname, const char *keyname, bool emergency)
TDB_CONTEXT *tdb;
TDB_DATA key, value;
struct tdb_logging_context logfn = { log_stderr };
-
+
tdb = tdb_open_ex(fname, 0, 0, O_RDONLY, 0, &logfn, NULL);
if (!tdb) {
printf("Failed to open %s\n", fname);
diff --git a/lib/tdb/tools/tdbtest.c b/lib/tdb/tools/tdbtest.c
index 44c78ef..0be35dc 100644
--- a/lib/tdb/tools/tdbtest.c
+++ b/lib/tdb/tools/tdbtest.c
@@ -24,7 +24,7 @@ static void _start_timer(void)
static double _end_timer(void)
{
gettimeofday(&tp2,NULL);
- return((tp2.tv_sec - tp1.tv_sec) +
+ return((tp2.tv_sec - tp1.tv_sec) +
(tp2.tv_usec - tp1.tv_usec)*1.0e-6);
}
@@ -40,7 +40,7 @@ static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...)
static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...)
{
va_list ap;
-
+
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
@@ -189,15 +189,15 @@ static void merge_test(void)
char keys[5][2];
char tdata[] = "test";
TDB_DATA key, data;
-
+
for (i = 0; i < 5; i++) {
snprintf(keys[i],2, "%d", i);
key.dptr = keys[i];
key.dsize = 2;
-
+
data.dptr = tdata;
data.dsize = 4;
-
+
if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
fatal("tdb_store failed");
}
@@ -248,7 +248,7 @@ static char *test_path(const char *filename)
db = tdb_open(test_tdb, 0, TDB_CLEAR_IF_FIRST,
O_RDWR | O_CREAT | O_TRUNC, 0600);
- gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST,
+ gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST,
0600, NULL);
if (!db || !gdbm) {
diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c
index dc5747f..d007796 100644
--- a/lib/tdb/tools/tdbtool.c
+++ b/lib/tdb/tools/tdbtool.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
Samba database functions
Copyright (C) Andrew Tridgell 1999-2000
@@ -10,12 +10,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -113,7 +113,7 @@ static void _start_timer(void)
static double _end_timer(void)
{
gettimeofday(&tp2,NULL);
- return((tp2.tv_sec - tp1.tv_sec) +
+ return((tp2.tv_sec - tp1.tv_sec) +
(tp2.tv_usec - tp1.tv_usec)*1.0e-6);
}
@@ -160,7 +160,7 @@ static void print_data(const char *buf,int len)
printf("%02X ",(int)((unsigned char)buf[i]));
i++;
if (i%8 == 0) printf(" ");
- if (i%16 == 0) {
+ if (i%16 == 0) {
print_asc(&buf[i-16],8); printf(" ");
print_asc(&buf[i-8],8); printf("\n");
if (i<len) printf("[%03X] ",i);
@@ -168,18 +168,18 @@ static void print_data(const char *buf,int len)
}
if (i%16) {
int n;
-
+
n = 16 - (i%16);
printf(" ");
if (n>8) printf(" ");
while (n--) printf(" ");
-
+
n = i%16;
if (n > 8) n = 8;
print_asc(&buf[i-(i%16)],n); printf(" ");
n = (i%16) - n;
- if (n>0) print_asc(&buf[i-n],n);
- printf("\n");
+ if (n>0) print_asc(&buf[i-n],n);
+ printf("\n");
}
}
@@ -309,11 +309,11 @@ static void show_tdb(char *keyname, size_t keylen)
terror("fetch failed");
return;
}
-
+
print_rec(tdb, key, dbuf, NULL);
-
+
free( dbuf.dptr );
-
+
return;
}
@@ -357,23 +357,23 @@ static void move_rec(char *keyname, size_t keylen, char* tdbname)
terror("fetch failed");
return;
}
-
+
print_rec(tdb, key, dbuf, NULL);
-
+
dst_tdb = tdb_open(tdbname, 0, 0, O_RDWR, 0600);
if ( !dst_tdb ) {
terror("unable to open destination tdb");
return;
}
-
+
if (tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) != 0) {
terror("failed to move record");
}
else
printf("record moved\n");
-
+
tdb_close( dst_tdb );
-
+
return;
}
@@ -520,7 +520,7 @@ static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey)
{
TDB_DATA dbuf;
*pkey = tdb_firstkey(the_tdb);
-
+
dbuf = tdb_fetch(the_tdb, *pkey);
if (!dbuf.dptr) terror("fetch failed");
else {
@@ -532,9 +532,9 @@ static void next_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey)
{
TDB_DATA dbuf;
*pkey = tdb_nextkey(the_tdb, *pkey);
-
+
dbuf = tdb_fetch(the_tdb, *pkey);
- if (!dbuf.dptr)
+ if (!dbuf.dptr)
terror("fetch failed");
else
print_rec(the_tdb, *pkey, dbuf, NULL);
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c
index 760ad59..a23d154 100644
--- a/lib/tdb/tools/tdbtorture.c
+++ b/lib/tdb/tools/tdbtorture.c
@@ -1,5 +1,5 @@
/* this tests tdb by doing lots of ops from several simultaneous
- writers - that stresses the locking code.
+ writers - that stresses the locking code.
*/
#include "replace.h"
@@ -59,7 +59,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c
system(ptr);
free(ptr);
}
-#endif
+#endif
}
static void fatal(const char *why)
diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index 5778a92..64cb1d5 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -62,9 +62,11 @@ NTSTATUS ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
TDB_DATA key);
-NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32_t db_id,
- TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data,
- bool local_copy);
+NTSTATUS ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
+ TDB_DATA key, bool local_copy,
+ void (*parser)(TDB_DATA key, TDB_DATA data,
+ void *private_data),
+ void *private_data);
NTSTATUS ctdbd_traverse(uint32_t db_id,
void (*fn)(TDB_DATA key, TDB_DATA data,
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 2cf5e47..1481a9c 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -1414,11 +1414,13 @@ NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id,
}
/*
- * remotely fetch a record (read-only)
+ * Fetch a record and parse it
*/
-NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32_t db_id,
- TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data,
- bool local_copy)
+NTSTATUS ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
+ TDB_DATA key, bool local_copy,
+ void (*parser)(TDB_DATA key, TDB_DATA data,
+ void *private_data),
+ void *private_data)
{
struct ctdb_req_call req;
struct ctdb_reply_call *reply;
@@ -1473,21 +1475,9 @@ NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32_t db_id,
goto fail;
}
- data->dsize = reply->datalen;
- if (data->dsize == 0) {
- data->dptr = NULL;
- goto done;
- }
+ parser(key, make_tdb_data(&reply->data[0], reply->datalen),
+ private_data);
- data->dptr = (uint8 *)talloc_memdup(mem_ctx, &reply->data[0],
- reply->datalen);
- if (data->dptr == NULL) {
- DEBUG(0, ("talloc failed\n"));
- status = NT_STATUS_NO_MEMORY;
- goto fail;
- }
-
- done:
status = NT_STATUS_OK;
fail:
TALLOC_FREE(reply);
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 399c850..e55689c 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -140,15 +140,13 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db,
struct ctdb_ltdb_header *header,
TDB_DATA data)
{
- TALLOC_CTX *tmp_ctx = talloc_stackframe();
TDB_DATA rec;
int ret;
rec.dsize = data.dsize + sizeof(struct ctdb_ltdb_header);
- rec.dptr = (uint8_t *)talloc_size(tmp_ctx, rec.dsize);
+ rec.dptr = (uint8_t *)talloc_size(talloc_tos(), rec.dsize);
if (rec.dptr == NULL) {
- talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
@@ -157,7 +155,7 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db,
ret = tdb_store(db->wtdb->tdb, key, rec, TDB_REPLACE);
- talloc_free(tmp_ctx);
+ talloc_free(rec.dptr);
return (ret == 0) ? NT_STATUS_OK
: tdb_error_to_ntstatus(db->wtdb->tdb);
@@ -1211,7 +1209,6 @@ static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key,
db->private_data, struct db_ctdb_ctx);
struct db_ctdb_parse_record_state state;
NTSTATUS status;
- TDB_DATA data;
state.parser = parser;
state.private_data = private_data;
@@ -1249,14 +1246,8 @@ static NTSTATUS db_ctdb_parse_record(struct db_context *db, TDB_DATA key,
return NT_STATUS_OK;
}
- status = ctdbd_fetch(messaging_ctdbd_connection(), ctx->db_id, key,
- talloc_tos(), &data, state.ask_for_readonly_copy);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- parser(key, data, private_data);
- TALLOC_FREE(data.dptr);
- return NT_STATUS_OK;
+ return ctdbd_parse(messaging_ctdbd_connection(), ctx->db_id, key,
+ state.ask_for_readonly_copy, parser, private_data);
}
struct traverse_state {
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index eaf51e7..2dc8674 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -484,7 +484,7 @@ static void notify_trigger_index_parser(TDB_DATA key, TDB_DATA data,
struct notify_trigger_index_state *state =
(struct notify_trigger_index_state *)private_data;
uint32_t *new_vnns;
- size_t i, num_vnns, num_new_vnns;
+ size_t i, num_vnns, num_new_vnns, num_remote_vnns;
if ((data.dsize % sizeof(uint32_t)) != 0) {
DEBUG(1, ("Invalid record size in notify index db: %u\n",
@@ -493,22 +493,32 @@ static void notify_trigger_index_parser(TDB_DATA key, TDB_DATA data,
}
new_vnns = (uint32_t *)data.dptr;
num_new_vnns = data.dsize / sizeof(uint32_t);
-
- num_vnns = talloc_array_length(state->vnns);
+ num_remote_vnns = num_new_vnns;
for (i=0; i<num_new_vnns; i++) {
if (new_vnns[i] == state->my_vnn) {
state->found_my_vnn = true;
+ num_remote_vnns -= 1;
}
}
+ if (num_remote_vnns == 0) {
+ return;
+ }
+ num_vnns = talloc_array_length(state->vnns);
state->vnns = talloc_realloc(state->mem_ctx, state->vnns, uint32_t,
- num_vnns + num_new_vnns);
- if ((num_vnns + num_new_vnns != 0) && (state->vnns == NULL)) {
+ num_vnns + num_remote_vnns);
--
Samba Shared Repository
More information about the samba-cvs
mailing list