[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Fri Feb 8 16:10:02 UTC 2019


The branch, master has been updated
       via  8a8286842d8 s4/registry/py: use unsigned ParseTuple format for unsigned value
       via  7b9d4580e9c s4/messaging/py: use better format strings for variable types
       via  1e8d0d80d95 s4/librpc/py_misc: ParseTuple format should match actual types
       via  96cdacae147 s3/libsmb/py: match input argument types with C types
       via  8294e68a417 py_tevent: add_timer takes float argument
      from  076f30b0607 winbindd: Enhance xids2sids debugging

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


- Log -----------------------------------------------------------------
commit 8a8286842d8770df322c4493632496341d707f0c
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 7 17:36:02 2019 +1300

    s4/registry/py: use unsigned ParseTuple format for unsigned value
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Fri Feb  8 17:09:51 CET 2019 on sn-devel-144

commit 7b9d4580e9cfdd30d4348d6dd6e7333e9b62553f
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 7 17:34:52 2019 +1300

    s4/messaging/py: use better format strings for variable types
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

commit 1e8d0d80d95ff3f9f5f05153d14b24b7122e0d43
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 7 17:11:41 2019 +1300

    s4/librpc/py_misc: ParseTuple format should match actual types
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

commit 96cdacae1475847fa5005370a4fcb5fcacfb4dbc
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 7 17:04:43 2019 +1300

    s3/libsmb/py: match input argument types with C types
    
    If PyArg_ParseTupleAndKeywords() is given, say, an "H" format (meaning
    unsigned short int) but the referenced variable is a plain unsigned
    int, the top 16 bits of the variable will be left undefined. In that
    case we should use an "I" format (and/or initialize the variable).
    
    In many cases the change is fairly innocuous, such as when "i" and "I"
    are mixed (for signed and unsigned ints respectively), but the
    resulting write is the same size and probably gives the same result in
    practice.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

commit 8294e68a4175e6116b38869866c42a1b7ba55b6a
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Feb 7 17:00:28 2019 +1300

    py_tevent: add_timer takes float argument
    
    We were already using it that way.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Noel Power <npower at samba.org>

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

Summary of changes:
 lib/tevent/pytevent.c               | 8 ++++++--
 source3/libsmb/pylibsmb.c           | 6 +++---
 source4/lib/messaging/pymessaging.c | 8 ++++----
 source4/lib/registry/pyregistry.c   | 2 +-
 source4/librpc/ndr/py_misc.c        | 2 +-
 5 files changed, 15 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 369ec6e02c8..97976df32d3 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -478,9 +478,13 @@ static PyObject *py_tevent_context_add_timer(TeventContext_Object *self, PyObjec
 {
 	struct timeval next_event;
 	PyObject *callback;
-	if (!PyArg_ParseTuple(args, "lO", &next_event, &callback))
+	double secs, usecs;
+	if (!PyArg_ParseTuple(args, "dO", &secs, &callback)){
 		return NULL;
-
+	}
+	next_event.tv_sec = secs;
+	usecs = (secs - next_event.tv_sec) * 1000000.0;
+	next_event.tv_usec = usecs;
 	return py_tevent_context_add_timer_internal(self, next_event, callback);
 }
 
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 5f3e6a8c724..da2e5e12d0d 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -856,7 +856,7 @@ static PyObject *py_cli_write(struct py_cli_state *self, PyObject *args,
 		"fnum", "buffer", "offset", "mode", NULL };
 
 	if (!ParseTupleAndKeywords(
-		    args, kwds, "I" PYARG_BYTES_LEN "K|I", kwlist,
+		    args, kwds, "i" PYARG_BYTES_LEN "K|I", kwlist,
 		    &fnum, &buf, &buflen, &offset, &mode)) {
 		return NULL;
 	}
@@ -1012,7 +1012,7 @@ static PyObject *py_cli_read(struct py_cli_state *self, PyObject *args,
 		"fnum", "offset", "size", NULL };
 
 	if (!ParseTupleAndKeywords(
-		    args, kwds, "IKI", kwlist, &fnum, &offset,
+		    args, kwds, "iKI", kwlist, &fnum, &offset,
 		    &size)) {
 		return NULL;
 	}
@@ -1230,7 +1230,7 @@ static PyObject *py_cli_list(struct py_cli_state *self,
 	PyObject *result = NULL;
 	const char *kwlist[] = { "directory", "mask", "attribs", NULL };
 
-	if (!ParseTupleAndKeywords(args, kwds, "z|sH:list", kwlist,
+	if (!ParseTupleAndKeywords(args, kwds, "z|sI:list", kwlist,
 				   &base_dir, &user_mask, &attribute)) {
 		return NULL;
 	}
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index c43caf54b48..0681b349220 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -55,7 +55,7 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
 		unsigned long long pid;
 		int task_id, vnn;
 
-		if (!PyArg_ParseTuple(object, "KII", &pid, &task_id, &vnn)) {
+		if (!PyArg_ParseTuple(object, "Kii", &pid, &task_id, &vnn)) {
 			return false;
 		}
 		server_id->pid = pid;
@@ -65,14 +65,14 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
 	} else if (PyTuple_Size(object) == 2) {
 		unsigned long long pid;
 		int task_id;
-		if (!PyArg_ParseTuple(object, "KI", &pid, &task_id))
+		if (!PyArg_ParseTuple(object, "Ki", &pid, &task_id))
 			return false;
 		*server_id = cluster_id(pid, task_id);
 		return true;
 	} else {
 		unsigned long long pid = getpid();
 		int task_id;
-		if (!PyArg_ParseTuple(object, "I", &task_id))
+		if (!PyArg_ParseTuple(object, "i", &task_id))
 			return false;
 		*server_id = cluster_id(pid, task_id);
 		return true;
@@ -157,7 +157,7 @@ static PyObject *py_imessaging_send(PyObject *self, PyObject *args, PyObject *kw
 	const char *kwnames[] = { "target", "msg_type", "data", NULL };
 	Py_ssize_t length;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#:send", 
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OIs#:send",
 		discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) {
 
 		return NULL;
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index 5d7f7f212b8..78b47b8286d 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -214,7 +214,7 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
 	WERROR result;
 	struct hive_key *key = PyHiveKey_AsHiveKey(self);
 
-	if (!PyArg_ParseTuple(args, "siz#", &name, &type, &value.data, &value_length)) {
+	if (!PyArg_ParseTuple(args, "sIz#", &name, &type, &value.data, &value_length)) {
 		return NULL;
 	}
 	value.length = value_length;
diff --git a/source4/librpc/ndr/py_misc.c b/source4/librpc/ndr/py_misc.c
index 181f19aec92..187fdb784cf 100644
--- a/source4/librpc/ndr/py_misc.c
+++ b/source4/librpc/ndr/py_misc.c
@@ -144,7 +144,7 @@ static int py_policy_handle_init(PyObject *self, PyObject *args, PyObject *kwarg
 	struct policy_handle *handle = pytalloc_get_ptr(self);
 	const char *kwnames[] = { "uuid", "type", NULL };
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|si", discard_const_p(char *, kwnames), &str, &handle->handle_type))
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sI", discard_const_p(char *, kwnames), &str, &handle->handle_type))
 		return -1;
 
 	if (str != NULL) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list