[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Mon Sep 3 19:39:03 UTC 2018


The branch, master has been updated
       via  05e618c dbwrap_tool: We don't do "listwatchers" anymore
       via  0ce26c7 dbwrap_tool: Avoid an unnecessary "else"
       via  02d4484 dbwrap_tool: Simplify persistent/non-persistent check
       via  46819e2 dbwrap_tool: Simplify listkey_fn
       via  89f9c16 dbwrap_tool: Simplify dbwrap_tool_erase
       via  0bd109b smbd: Fix a memleak in async search ask sharemode
      from  30eb288 ctdb-tests: Don't run valgrind or other tracing in simple_test_command()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 05e618cbaf5b28e9db7f7e1f47bd98943f71c40a
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 24 15:11:53 2018 +0200

    dbwrap_tool: We don't do "listwatchers" anymore
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Mon Sep  3 21:38:40 CEST 2018 on sn-devel-144

commit 0ce26c75cb0329d013365dcff973d6ebe2261775
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 24 15:07:28 2018 +0200

    dbwrap_tool: Avoid an unnecessary "else"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 02d448429cc7f715b34d42aa425b74a715221202
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 24 15:06:34 2018 +0200

    dbwrap_tool: Simplify persistent/non-persistent check
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 46819e2628a1439a94ed3a63bc164ce1d7b67706
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 24 14:41:41 2018 +0200

    dbwrap_tool: Simplify listkey_fn
    
    To me dbwrap_record_get_key(rec).dsize just looks a bit ugly
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 89f9c163f32a409a40ae73455af892e58cd0e214
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 24 14:39:19 2018 +0200

    dbwrap_tool: Simplify dbwrap_tool_erase
    
    That's what dbwrap_wipe is for :-)
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 0bd109b733fbce774feae2142d25f7e828b56bcb
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 3 15:54:48 2018 +0200

    smbd: Fix a memleak in async search ask sharemode
    
    fetch_share_mode_unlocked_parser() takes a "struct
    fetch_share_mode_unlocked_state *" as
    "private_data". fetch_share_mode_send() used a talloc_zero'ed "struct
    share_mode_lock". This lead to the parser putting a "struct
    share_mode_lock on the NULL talloc_context where nobody really picked it
    up.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13602
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/locking/share_mode_lock.c | 13 +++++--------
 source3/utils/dbwrap_tool.c       | 30 +++++++++++-------------------
 2 files changed, 16 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 0bf7b9d..90723fb 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -663,7 +663,7 @@ static void fetch_share_mode_done(struct tevent_req *subreq);
 struct fetch_share_mode_state {
 	struct file_id id;
 	TDB_DATA key;
-	struct share_mode_lock *lck;
+	struct fetch_share_mode_unlocked_state parser_state;
 	enum dbwrap_req_state req_state;
 };
 
@@ -711,17 +711,14 @@ struct tevent_req *fetch_share_mode_send(TALLOC_CTX *mem_ctx,
 
 	state->id = id;
 	state->key = locking_key(&state->id);
-	state->lck = talloc_zero(state, struct share_mode_lock);
-	if (tevent_req_nomem(state->lck, req)) {
-		return tevent_req_post(req, ev);
-	}
+	state->parser_state.mem_ctx = state;
 
 	subreq = dbwrap_parse_record_send(state,
 					  ev,
 					  lock_db,
 					  state->key,
 					  fetch_share_mode_unlocked_parser,
-					  state->lck,
+					  &state->parser_state,
 					  &state->req_state);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
@@ -765,12 +762,12 @@ NTSTATUS fetch_share_mode_recv(struct tevent_req *req,
 		return status;
 	}
 
-	if (state->lck->data == NULL) {
+	if (state->parser_state.lck->data == NULL) {
 		tevent_req_received(req);
 		return NT_STATUS_NOT_FOUND;
 	}
 
-	lck = talloc_move(mem_ctx, &state->lck);
+	lck = talloc_move(mem_ctx, &state->parser_state.lck);
 
 	if (DEBUGLEVEL >= 10) {
 		DBG_DEBUG("share_mode_data:\n");
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 94aacd8..9c27fdc 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -25,7 +25,6 @@
 #include "popt_common.h"
 #include "dbwrap/dbwrap.h"
 #include "dbwrap/dbwrap_open.h"
-#include "dbwrap/dbwrap_watch.h"
 #include "messages.h"
 #include "util_tdb.h"
 
@@ -280,13 +279,6 @@ static int dbwrap_tool_exists(struct db_context *db,
 	return (result)?0:1;
 }
 
-
-static int delete_fn(struct db_record *rec, void *priv)
-{
-	dbwrap_record_delete(rec);
-	return 0;
-}
-
 /**
  * dbwrap_tool_erase: erase the whole data base
  * the keyname argument is not used.
@@ -295,11 +287,11 @@ static int dbwrap_tool_erase(struct db_context *db,
 			     const char *keyname,
 			     const char *data)
 {
-	NTSTATUS status;
+	int ret;
 
-	status = dbwrap_traverse(db, delete_fn, NULL, NULL);
+	ret = dbwrap_wipe(db);
 
-	if (!NT_STATUS_IS_OK(status)) {
+	if (ret != 0) {
 		d_fprintf(stderr, "ERROR erasing the database\n");
 		return -1;
 	}
@@ -309,8 +301,9 @@ static int dbwrap_tool_erase(struct db_context *db,
 
 static int listkey_fn(struct db_record *rec, void *private_data)
 {
-	int length = dbwrap_record_get_key(rec).dsize;
-	unsigned char *p = (unsigned char *)dbwrap_record_get_key(rec).dptr;
+	TDB_DATA key = dbwrap_record_get_key(rec);
+	size_t length = key.dsize;
+	unsigned char *p = (unsigned char *)key.dptr;
 
 	while (length--) {
 		if (isprint(*p) && !strchr("\"\\", *p)) {
@@ -435,19 +428,18 @@ int main(int argc, const char **argv)
 			  "USAGE: %s [options] <database> <op> [<key> [<type> "
 			  "[<value>]]]\n"
 			  "       ops: fetch, store, delete, exists, "
-			  "erase, listkeys, listwatchers\n"
+			  "erase, listkeys\n"
 			  "       types: int32, uint32, string, hex\n",
 			 argv[0]);
 		goto done;
 	}
 
-	if ((persistent == 0 && non_persistent == 0) ||
-	    (persistent == 1 && non_persistent == 1))
-	{
+	if ((persistent + non_persistent) != 1) {
 		d_fprintf(stderr, "ERROR: you must specify exactly one "
 			  "of --persistent and --non-persistent\n");
 		goto done;
-	} else if (non_persistent == 1) {
+	}
+	if (non_persistent == 1) {
 		tdb_flags |= TDB_CLEAR_IF_FIRST;
 	}
 
@@ -508,7 +500,7 @@ int main(int argc, const char **argv)
 		d_fprintf(stderr,
 			  "ERROR: invalid op '%s' specified\n"
 			  "       supported ops: fetch, store, delete, exists, "
-			  "erase, listkeys, listwatchers\n",
+			  "erase, listkeys\n",
 			  opname);
 		goto done;
 	}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list