[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Oct 8 14:49:02 MDT 2010


The branch, master has been updated
       via  615482a s3: Hang the isilon kernel oplocks off the NULL context
       via  703e438 s3: Hang the irix kernel oplocks off the NULL ctx
       via  613a0b6 s3: Hang the linux kernel oplocks off the NULL ctx
       via  ef96bfe s3: Call printer_list_parent_init in the parent
       via  8125807 s3: Remove talloc_autofree_context() from get_printer_list_db()
       via  1e98d58 s3: Remove talloc_autofree_context() from loadparm.c
       via  220aa31 s3: Add a little test for the echo responder
       via  5e482ae s3: Implement echo_TestSleep
       via  e36e67f tevent: Do not use talloc_autofree_context
       via  b5ed09c Move talloc_enable_null_tracking() to the s3 daemons
      from  584ac76 s4:ldap.py - split it up and move SAM related stuff to sam.py

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


- Log -----------------------------------------------------------------
commit 615482a83d6c18ead7d18624f157170effdebdf8
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 22:01:28 2010 +0200

    s3: Hang the isilon kernel oplocks off the NULL context
    
    All I see is a fd_event that does not need a special destructor.
    
    Tim, Steven, I've added the #error as well for you to remove after review.
    
    Thanks,
    
    Volker
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Oct  8 20:48:11 UTC 2010 on sn-devel-104

commit 703e4385991feb7a1c18651a03a9562a3964b8d6
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 21:50:17 2010 +0200

    s3: Hang the irix kernel oplocks off the NULL ctx
    
    Just a fd_event to be cleaned up. The pipe is closed implicitly.

commit 613a0b6c00690a9509129be8ae6a78101e3a21e8
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 21:48:38 2010 +0200

    s3: Hang the linux kernel oplocks off the NULL ctx
    
    The destructor that is called removes the signal handler. But at process
    exit the signal handling is lost anyway.

commit ef96bfe88530474a05fdb86955efa3a290f3d547
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 21:42:08 2010 +0200

    s3: Call printer_list_parent_init in the parent
    
    Simo, please check!

commit 812580736ac58a4f0b5d119790c53797f0a85d6e
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 21:38:26 2010 +0200

    s3: Remove talloc_autofree_context() from get_printer_list_db()
    
    Another db that does not need explicit closing

commit 1e98d5859daceb7d2cbe550803aaec382d2bae86
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 7 21:29:19 2010 +0200

    s3: Remove talloc_autofree_context() from loadparm.c
    
    None of these uses requires a special destructor

commit 220aa311d100814be6d396dff96f3825fc01985f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 6 18:46:43 2010 +0200

    s3: Add a little test for the echo responder

commit 5e482aeebf43f95aa003c68d25f7773a944b227e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 6 18:45:41 2010 +0200

    s3: Implement echo_TestSleep

commit e36e67fe047dca505b675c4b6b79b9670a9ad91b
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 24 19:13:05 2010 +0200

    tevent: Do not use talloc_autofree_context

commit b5ed09c3afe2c9122db6eec6dd994588d7d6a2c1
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Sep 24 18:45:52 2010 +0200

    Move talloc_enable_null_tracking() to the s3 daemons

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

Summary of changes:
 lib/talloc/talloc.c               |    7 --
 lib/tevent/tevent.c               |    5 +-
 lib/tevent/tevent_signal.c        |    2 +-
 source3/Makefile.in               |    3 +-
 source3/nmbd/nmbd.c               |    8 ++-
 source3/param/loadparm.c          |   11 ++--
 source3/printing/printer_list.c   |    2 +-
 source3/rpc_server/srv_echo_nt.c  |    2 +-
 source3/smbd/oplock.c             |    7 +-
 source3/smbd/server.c             |   13 +++-
 source3/torture/proto.h           |    1 +
 source3/torture/test_async_echo.c |  142 +++++++++++++++++++++++++++++++++++++
 source3/torture/torture.c         |    1 +
 source3/winbindd/winbindd.c       |    8 ++-
 14 files changed, 186 insertions(+), 26 deletions(-)
 create mode 100644 source3/torture/test_async_echo.c


Changeset truncated at 500 lines:

diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index cafe4d6..84947a7 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1013,13 +1013,6 @@ _PUBLIC_ void *talloc_init(const char *fmt, ...)
 	void *ptr;
 	const char *name;
 
-	/*
-	 * samba3 expects talloc_report_depth_cb(NULL, ...)
-	 * reports all talloc'ed memory, so we need to enable
-	 * null_tracking
-	 */
-	talloc_enable_null_tracking();
-
 	ptr = __talloc(NULL, 0);
 	if (unlikely(ptr == NULL)) return NULL;
 
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index a91e568..4849bc1 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -88,7 +88,7 @@ bool tevent_register_backend(const char *name, const struct tevent_ops *ops)
 		}
 	}
 
-	e = talloc(talloc_autofree_context(), struct tevent_ops_list);
+	e = talloc(NULL, struct tevent_ops_list);
 	if (e == NULL) return false;
 
 	e->name = name;
@@ -104,8 +104,7 @@ bool tevent_register_backend(const char *name, const struct tevent_ops *ops)
 void tevent_set_default_backend(const char *backend)
 {
 	talloc_free(tevent_default_backend);
-	tevent_default_backend = talloc_strdup(talloc_autofree_context(),
-					       backend);
+	tevent_default_backend = talloc_strdup(NULL, backend);
 }
 
 /*
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 45f65cf..dbab8a8 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -210,7 +210,7 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
 	/* the sig_state needs to be on a global context as it can last across
 	   multiple event contexts */
 	if (sig_state == NULL) {
-		sig_state = talloc_zero(talloc_autofree_context(), struct tevent_sig_state);
+		sig_state = talloc_zero(NULL, struct tevent_sig_state);
 		if (sig_state == NULL) {
 			return NULL;
 		}
diff --git a/source3/Makefile.in b/source3/Makefile.in
index c80a874..4d2587f 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1192,6 +1192,7 @@ NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(LIBNMB_OBJ) \
 SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/utable.o \
 		torture/denytest.o torture/mangle_test.o \
 		torture/nbench.o \
+		torture/test_async_echo.o \
 		torture/test_posix_append.o
 
 SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) $(TLDAP_OBJ) \
@@ -1199,7 +1200,7 @@ SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) $(TLDAP_OBJ) \
 	@LIBWBCLIENT_STATIC@ \
         ../nsswitch/libwbclient/wbc_async.o \
         ../nsswitch/libwbclient/wb_reqtrans.o \
-	$(LIBNDR_GEN_OBJ0)
+	$(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBCLI_ECHO_OBJ)
 
 MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 5678c8e..fcbe508 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -780,9 +780,15 @@ static bool open_sockets(bool isdaemon, int port)
 	POPT_COMMON_SAMBA
 	{ NULL }
 	};
-	TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+	TALLOC_CTX *frame;
 	NTSTATUS status;
 
+	/*
+	 * Do this before any other talloc operation
+	 */
+	talloc_enable_null_tracking();
+	frame = talloc_stackframe();
+
 	load_case_tables();
 
 	global_nmb_port = NMB_PORT;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 4567f36..f9a908d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -5326,7 +5326,7 @@ static void init_globals(bool reinit_globals)
 	Globals.bWinbindTrustedDomainsOnly = False;
 	Globals.bWinbindNestedGroups = True;
 	Globals.winbind_expand_groups = 1;
-	Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL);
+	Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
 	Globals.bWinbindRefreshTickets = False;
 	Globals.bWinbindOfflineLogon = False;
 
@@ -6109,7 +6109,7 @@ const char **lp_parm_string_list(int snum, const char *type, const char *option,
 		return (const char **)def;
 
 	if (data->list==NULL) {
-		data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL);
+		data->list = str_list_make_v3(NULL, data->value, NULL);
 	}
 
 	return (const char **)data->list;
@@ -7420,7 +7420,7 @@ static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
 {
 	TALLOC_FREE(Globals.szNetbiosAliases);
-	Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL);
+	Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
 	return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
 }
 
@@ -7718,8 +7718,7 @@ static void init_copymap(struct service *pservice)
 
 	TALLOC_FREE(pservice->copymap);
 
-	pservice->copymap = bitmap_talloc(talloc_autofree_context(),
-					  NUMPARAMETERS);
+	pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
 	if (!pservice->copymap)
 		DEBUG(0,
 		      ("Couldn't allocate copymap!! (size %d)\n",
@@ -7853,7 +7852,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
 		case P_LIST:
 			TALLOC_FREE(*((char ***)parm_ptr));
 			*(char ***)parm_ptr = str_list_make_v3(
-				talloc_autofree_context(), pszParmValue, NULL);
+				NULL, pszParmValue, NULL);
 			break;
 
 		case P_STRING:
diff --git a/source3/printing/printer_list.c b/source3/printing/printer_list.c
index 8e9e06a..edc398b 100644
--- a/source3/printing/printer_list.c
+++ b/source3/printing/printer_list.c
@@ -35,7 +35,7 @@ static struct db_context *get_printer_list_db(void)
 	if (db != NULL) {
 		return db;
 	}
-	db = db_open(talloc_autofree_context(), PL_DB_NAME(), 0,
+	db = db_open(NULL, PL_DB_NAME(), 0,
 		     TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
 		     O_RDWR|O_CREAT, 0644);
 	return db;
diff --git a/source3/rpc_server/srv_echo_nt.c b/source3/rpc_server/srv_echo_nt.c
index e8d96ff..87b2491 100644
--- a/source3/rpc_server/srv_echo_nt.c
+++ b/source3/rpc_server/srv_echo_nt.c
@@ -100,7 +100,7 @@ NTSTATUS _echo_TestCall2(struct pipes_struct *p, struct echo_TestCall2 *r)
 
 uint32 _echo_TestSleep(struct pipes_struct *p, struct echo_TestSleep *r)
 {
-	p->rng_fault_state = True;
+	smb_msleep(r->in.seconds * 1000);
 	return 0;
 }
 
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 03bf211..6f4d578 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -922,11 +922,12 @@ bool init_oplocks(struct messaging_context *msg_ctx)
 
 	if (lp_kernel_oplocks()) {
 #if HAVE_KERNEL_OPLOCKS_IRIX
-		koplocks = irix_init_kernel_oplocks(talloc_autofree_context());
+		koplocks = irix_init_kernel_oplocks(NULL);
 #elif HAVE_KERNEL_OPLOCKS_LINUX
-		koplocks = linux_init_kernel_oplocks(talloc_autofree_context());
+		koplocks = linux_init_kernel_oplocks(NULL);
 #elif HAVE_ONEFS
-		koplocks = onefs_init_kernel_oplocks(talloc_autofree_context());
+#error Isilon, please check if the NULL context is okay here. Thanks!
+		koplocks = onefs_init_kernel_oplocks(NULL);
 #endif
 	}
 
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 07261b1..cdf4320 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -31,6 +31,7 @@
 #include "secrets.h"
 #include "memcache.h"
 #include "ctdbd_conn.h"
+#include "printing/printer_list.h"
 
 #include "../librpc/gen_ndr/srv_dfs.h"
 #include "../librpc/gen_ndr/srv_dssetup.h"
@@ -857,11 +858,17 @@ extern void build_options(bool screen);
 	POPT_TABLEEND
 	};
 	struct smbd_parent_context *parent = NULL;
-	TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */
+	TALLOC_CTX *frame;
 	NTSTATUS status;
 	uint64_t unique_id;
 	struct rpc_srv_callbacks spoolss_cb;
 
+	/*
+	 * Do this before any other talloc operation
+	 */
+	talloc_enable_null_tracking();
+	frame = talloc_stackframe();
+
 	/* Initialize the event context, it will panic on error */
 	smbd_event_context();
 
@@ -1134,6 +1141,10 @@ extern void build_options(bool screen);
 		exit(1);
 	}
 
+	if (!printer_list_parent_init()) {
+		exit(1);
+	}
+
 	if (!W_ERROR_IS_OK(registry_init_full()))
 		exit(1);
 
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index 4f9a180..6300434 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -84,5 +84,6 @@ bool torture_casetable(int dummy);
 bool run_posix_append(int dummy);
 
 bool run_nbench2(int dummy);
+bool run_async_echo(int dummy);
 
 #endif /* __TORTURE_H__ */
diff --git a/source3/torture/test_async_echo.c b/source3/torture/test_async_echo.c
new file mode 100644
index 0000000..13d4679
--- /dev/null
+++ b/source3/torture/test_async_echo.c
@@ -0,0 +1,142 @@
+/*
+   Unix SMB/CIFS implementation.
+   Run the async echo responder
+   Copyright (C) Volker Lendecke 2010
+
+   This program is free software; you can redistribute it and/or modify
+   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/>.
+*/
+
+#include "includes.h"
+#include "torture/proto.h"
+#include "librpc/gen_ndr/cli_echo.h"
+
+static void rpccli_sleep_done(struct tevent_req *req)
+{
+	int *done = (int *)tevent_req_callback_data_void(req);
+	NTSTATUS status;
+	uint32_t result;
+
+	status = rpccli_echo_TestSleep_recv(req, talloc_tos(), &result);
+	TALLOC_FREE(req);
+	printf("sleep returned %s, %d\n", nt_errstr(status), (int)result);
+	*done -= 1;
+}
+
+static void cli_echo_done(struct tevent_req *req)
+{
+	int *done = (int *)tevent_req_callback_data_void(req);
+	NTSTATUS status;
+
+	status = cli_echo_recv(req);
+	TALLOC_FREE(req);
+	printf("echo returned %s\n", nt_errstr(status));
+	*done -= 1;
+}
+
+static void cli_close_done(struct tevent_req *req)
+{
+	int *done = (int *)tevent_req_callback_data_void(req);
+	NTSTATUS status;
+	size_t written;
+
+	status = cli_write_andx_recv(req, &written);
+	TALLOC_FREE(req);
+	printf("close returned %s\n", nt_errstr(status));
+	*done -= 1;
+}
+
+bool run_async_echo(int dummy)
+{
+	struct cli_state *cli = NULL;
+	struct rpc_pipe_client *p;
+	struct tevent_context *ev;
+	struct tevent_req *req;
+	NTSTATUS status;
+	bool ret = false;
+	int i, num_reqs;
+	uint8_t buf[32768];
+
+	printf("Starting ASYNC_ECHO\n");
+
+	ev = tevent_context_init(talloc_tos());
+	if (ev == NULL) {
+		printf("tevent_context_init failed\n");
+		goto fail;
+	}
+
+	if (!torture_open_connection(&cli, 0)) {
+		printf("torture_open_connection failed\n");
+		goto fail;
+	}
+	status = cli_rpc_pipe_open_noauth(cli, &ndr_table_rpcecho.syntax_id,
+					  &p);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("Could not open echo pipe: %s\n", nt_errstr(status));
+		goto fail;
+	}
+
+	num_reqs = 0;
+
+	req = rpccli_echo_TestSleep_send(ev, ev, p, 15);
+	if (req == NULL) {
+		printf("rpccli_echo_TestSleep_send failed\n");
+		goto fail;
+	}
+	tevent_req_set_callback(req, rpccli_sleep_done, &num_reqs);
+	num_reqs += 1;
+
+	req = cli_echo_send(ev, ev, cli, 1, data_blob_const("hello", 5));
+	if (req == NULL) {
+		printf("cli_echo_send failed\n");
+		goto fail;
+	}
+	tevent_req_set_callback(req, cli_echo_done, &num_reqs);
+	num_reqs += 1;
+
+	memset(buf, 0, sizeof(buf));
+
+	for (i=0; i<10; i++) {
+		req = cli_write_andx_send(ev, ev, cli, 4711, 0, buf, 0, sizeof(buf));
+		if (req == NULL) {
+			printf("cli_close_send failed\n");
+			goto fail;
+		}
+		tevent_req_set_callback(req, cli_close_done, &num_reqs);
+		num_reqs += 1;
+
+		req = cli_echo_send(ev, ev, cli, 1, data_blob_const("hello", 5));
+		if (req == NULL) {
+			printf("cli_echo_send failed\n");
+			goto fail;
+		}
+		tevent_req_set_callback(req, cli_echo_done, &num_reqs);
+		num_reqs += 1;
+	}
+
+	while (num_reqs > 0) {
+		if (tevent_loop_once(ev) != 0) {
+			printf("tevent_loop_once failed\n");
+			goto fail;
+		}
+	}
+
+	TALLOC_FREE(p);
+
+	ret = true;
+fail:
+	if (cli != NULL) {
+		torture_close_connection(cli);
+	}
+	return ret;
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 122c694..abec611 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -7777,6 +7777,7 @@ static struct {
 	{"OPEN", run_opentest, 0},
 	{"POSIX", run_simple_posix_open_test, 0},
 	{"POSIX-APPEND", run_posix_append, 0},
+	{"ASYNC-ECHO", run_async_echo, 0},
 	{ "UID-REGRESSION-TEST", run_uid_regression_test, 0},
 	{ "SHORTNAME-TEST", run_shortname_test, 0},
 #if 1
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 0c9cdcf..d2344fd 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1124,9 +1124,15 @@ int main(int argc, char **argv, char **envp)
 	};
 	poptContext pc;
 	int opt;
-	TALLOC_CTX *frame = talloc_stackframe();
+	TALLOC_CTX *frame;
 	NTSTATUS status;
 
+	/*
+	 * Do this before any other talloc operation
+	 */
+	talloc_enable_null_tracking();
+	frame = talloc_stackframe();
+
 	/* glibc (?) likes to print "User defined signal 1" and exit if a
 	   SIGUSR[12] is received before a handler is installed */
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list