[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sat Jan 26 08:14:04 MST 2013


The branch, master has been updated
       via  b9f1c88 s4-process_single: Use pid,task_id as cluster_id in process_single just like process_prefork
       via  a321dd3 pymessaging: Pass around the server_id struct to python callbacks rather than the tuple
       via  a305432 pymessaging: Use correct unsigned types for server ID tuple elememnts
       via  1d1ea72 ldb: Ensure to decrement the transaction_active whenever we delete a transaction
       via  1ea6fab ldb: fix a warning by converting from TDB_DATA to struct ldb_val
      from  d79485a Regression test for bug #9587 - archive flag is always set on directories.

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


- Log -----------------------------------------------------------------
commit b9f1c8887ed1c8c29259021d4f2b9a549caa4061
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri Jan 25 23:00:12 2013 +1100

    s4-process_single: Use pid,task_id as cluster_id in process_single just like process_prefork
    
    This avoids two different process single task servers (eg the drepl
    server) sharing the same server id.  The task id starts at 2^31 to
    avoid collision with the fd based scheme for connections.
    
    Fix-bug: https://bugzilla.samba.org/show_bug.cgi?id=9598
    
    Reported-by: Matthieu Patou <mat at matws.net>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Sat Jan 26 16:13:05 CET 2013 on sn-devel-104

commit a321dd3aafa0f6ec8b39cd4fc64146dfbf24ce65
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jan 26 09:09:23 2013 +1100

    pymessaging: Pass around the server_id struct to python callbacks rather than the tuple
    
    This is not used currently, but may avoid going to and from the python types when we do not need to.
    
    Andrew Bartlett
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit a3054323d3fa1dadff1675e7f8ec672a991d8e56
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jan 26 08:58:46 2013 +1100

    pymessaging: Use correct unsigned types for server ID tuple elememnts
    
    This is needed if we start using the top bits of these values.
    
    Andrew Bartlett
    
    Reviewed-by: Matthieu Patou <mat at matws.net>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 1d1ea72574cfa22ee6207d0e9787d0271db3b5c2
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Jan 26 09:35:21 2013 +1100

    ldb: Ensure to decrement the transaction_active whenever we delete a transaction
    
    This is in the error path for prepare_commit, which rarely fails, but
    when it does we need to ensure that when a new transaction is opened,
    that it really starts a new transaction.
    
    We bump the version to recognise critical fix for the AD DC
    
    Without this fix, a single invalid inbound replicated link disables
    all subsequent replication as we operate without a transaction (which
    is refused by ldb_tdb).
    
    Andrew Bartlett
    
    Reviewed-by: Matthieu Patou <mat at matws.net>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 1ea6fabcde6cbd57aed06926193ac68f5887e96b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 24 14:21:51 2013 +0100

    ldb: fix a warning by converting from TDB_DATA to struct ldb_val
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 lib/ldb/ABI/{ldb-1.1.14.sigs => ldb-1.1.15.sigs}   |    0
 ...ldb-util-1.1.10.sigs => pyldb-util-1.1.15.sigs} |    0
 lib/ldb/common/ldb.c                               |    1 +
 lib/ldb/tools/ldbdump.c                            |    6 ++++-
 lib/ldb/wscript                                    |    2 +-
 source4/lib/messaging/pymessaging.c                |   20 ++++++++++++++----
 source4/smbd/process_single.c                      |   21 ++++++++++++-------
 7 files changed, 35 insertions(+), 15 deletions(-)
 copy lib/ldb/ABI/{ldb-1.1.14.sigs => ldb-1.1.15.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.1.15.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ABI/ldb-1.1.14.sigs b/lib/ldb/ABI/ldb-1.1.15.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-1.1.14.sigs
copy to lib/ldb/ABI/ldb-1.1.15.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-1.1.15.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.1.15.sigs
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index 7a997f7..3dc6d87 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -408,6 +408,7 @@ int ldb_transaction_prepare_commit(struct ldb_context *ldb)
 
 	status = module->ops->prepare_commit(module);
 	if (status != LDB_SUCCESS) {
+		ldb->transaction_active--;
 		/* if a module fails the prepare then we need
 		   to call the end transaction for everyone */
 		FIRST_OP(ldb, del_transaction);
diff --git a/lib/ldb/tools/ldbdump.c b/lib/ldb/tools/ldbdump.c
index edf7b5e..3197d19 100644
--- a/lib/ldb/tools/ldbdump.c
+++ b/lib/ldb/tools/ldbdump.c
@@ -31,11 +31,15 @@ static struct ldb_context *ldb;
 bool show_index = false;
 bool validate_contents = false;
 
-static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA _dbuf, void *state)
 {
 	int ret, i, j;
 	struct ldb_dn *dn = state;
 	struct ldb_message *msg = talloc_zero(NULL, struct ldb_message);
+	struct ldb_val dbuf = {
+		.data = _dbuf.dptr,
+		.length = _dbuf.dsize,
+	};
 	struct ldb_ldif ldif = {
 		.msg = msg,
 		.changetype = LDB_CHANGETYPE_NONE
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 8a36b5d..1ae5438 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '1.1.14'
+VERSION = '1.1.15'
 
 blddir = 'bin'
 
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index cb79d72..3901d4d 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -51,10 +51,10 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
 		return true;
 	}
 	if (PyTuple_Size(object) == 3) {
-		return PyArg_ParseTuple(object, "iii", &server_id->pid, &server_id->task_id, &server_id->vnn);
+		return PyArg_ParseTuple(object, "KII", &server_id->pid, &server_id->task_id, &server_id->vnn);
 	} else {
 		int pid, task_id;
-		if (!PyArg_ParseTuple(object, "ii", &pid, &task_id))
+		if (!PyArg_ParseTuple(object, "KI", &pid, &task_id))
 			return false;
 		*server_id = cluster_id(pid, task_id);
 		return true;
@@ -163,10 +163,20 @@ static void py_msg_callback_wrapper(struct imessaging_context *msg, void *privat
 			       uint32_t msg_type, 
 			       struct server_id server_id, DATA_BLOB *data)
 {
-	PyObject *callback = (PyObject *)private_data;
+	PyObject *py_server_id, *callback = (PyObject *)private_data;
 
-	PyObject_CallFunction(callback, discard_const_p(char, "i(iii)s#"), msg_type,
-			      server_id.pid, server_id.task_id, server_id.vnn,
+	struct server_id *p_server_id = talloc(NULL, struct server_id);
+	if (!p_server_id) {
+		PyErr_NoMemory();
+		return;
+	}
+	*p_server_id = server_id;
+
+	py_server_id = py_return_ndr_struct("samba.dcerpc.server_id", "server_id", p_server_id, p_server_id);
+	talloc_unlink(NULL, p_server_id);
+
+	PyObject_CallFunction(callback, discard_const_p(char, "i(O)s#"), msg_type,
+			      py_server_id,
 			      data->data, data->length);
 }
 
diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c
index ff67750..a1b785e 100644
--- a/source4/smbd/process_single.c
+++ b/source4/smbd/process_single.c
@@ -91,15 +91,20 @@ static void single_new_task(struct tevent_context *ev,
 			    void (*new_task)(struct tevent_context *, struct loadparm_context *, struct server_id, void *), 
 			    void *private_data)
 {
-	/* start our taskids at 1, zero is reserved for the top
-	   level samba task */
-	static uint32_t taskid = 1;
+	pid_t pid = getpid();
+	/* start our taskids at MAX_INT32, the first 2^31 tasks are is reserved for fd numbers */
+	static uint32_t taskid = INT32_MAX;
        
-	/* We use 1 so we cannot collide in with cluster ids generated
-	 * in the accept connection above, and unlikly to collide with
-	 * PIDs from process model standard (don't run samba as
-	 * init) */
-	new_task(ev, lp_ctx, cluster_id(1, taskid++), private_data);
+	/*
+	 * We use the PID so we cannot collide in with cluster ids
+	 * generated in other single mode tasks, and, and won't
+	 * collide with PIDs from process model starndard because a the
+	 * combination of pid/task_id should be unique system-wide
+	 *
+	 * Using the pid unaltered makes debugging of which process
+	 * owns the messaging socket easier.
+	 */
+	new_task(ev, lp_ctx, cluster_id(pid, taskid++), private_data);
 }
 
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list