The branch, master has been updated
       via  7542d8d s4:pyglue: PyArg_ParseTuple("I") requires an 'unsigned int' 
argument
       via  5d68c4e s4:py_net: PyArg_ParseTuple("i") requires an 'int' argument
       via  3b11ee1 s4:pyregistry: PyArg_ParseTuple("z#") requires an 'int' 
argument instead of 'size_t'
       via  100565b s4:pycredentials: PyArg_ParseTuple("i") requires an 'int' 
argument.
       via  604b380 pidl:Samba4/Python: PyArg_ParseTuple with "s#" returns 
'int' instead of 'size_t'
       via  a5fdf05 pyldb: fix uninitialized memory bug in PyArg_ParseTuple() 
argument
      from  43f3d6a s3-net: Fixed typo in net conf

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


- Log -----------------------------------------------------------------
commit 7542d8d03d31373d55acc2e232ef15aa26bec89f
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 14:34:11 2011 +0200

    s4:pyglue: PyArg_ParseTuple("I") requires an 'unsigned int' argument
    
    If we pass variable references we don't get implicit casting!
    
    metze
    
    Autobuild-User: Stefan Metzmacher <[email protected]>
    Autobuild-Date: Mon Aug  8 18:01:19 CEST 2011 on sn-devel-104

commit 5d68c4eb4462dff6cccd8425653b0f8c860ff4b1
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 14:31:40 2011 +0200

    s4:py_net: PyArg_ParseTuple("i") requires an 'int' argument
    
    If we pass variable references we don't get implicit casting!
    
    metze

commit 3b11ee1db1bbe966900fc917e3358937d1b23d62
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 14:30:00 2011 +0200

    s4:pyregistry: PyArg_ParseTuple("z#") requires an 'int' argument instead of 
'size_t'
    
    If we pass variables by reference we don't get implicit type casting.
    
    metze

commit 100565b8cce0c0e843bdd4158bc4047f346037fd
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 14:21:42 2011 +0200

    s4:pycredentials: PyArg_ParseTuple("i") requires an 'int' argument.
    
    If we pass variable references we don't get implicit casting!
    
    metze

commit 604b380203912c6ba126596d1c0a67bc7a5f6cd0
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 14:00:31 2011 +0200

    pidl:Samba4/Python: PyArg_ParseTuple with "s#" returns 'int' instead of 
'size_t'
    
    If we pass variable references we don't get implicit casting!
    
    metze

commit a5fdf05d6cfb45db319bb33cf6f601a71b2507ed
Author: Stefan Metzmacher <[email protected]>
Date:   Mon Aug 8 13:21:18 2011 +0200

    pyldb: fix uninitialized memory bug in PyArg_ParseTuple() argument
    
    "s#", &str, &len) required 'len' as 'int' not as 'Py_ssize_t'.
    With Py_ssize_t the 2nd half of a 64bit Py_ssize_t, will be
    uninitialized as 'int' is only 32bit.
    
    metze

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

Summary of changes:
 lib/ldb/pyldb.c                          |    2 +-
 pidl/lib/Parse/Pidl/Samba4/Python.pm     |    9 +++++-
 source4/auth/credentials/pycredentials.c |   36 +++++++++++++++++++++++++-----
 source4/lib/registry/pyregistry.c        |    5 +++-
 source4/libnet/py_net.c                  |    5 +++-
 source4/scripting/python/pyglue.c        |    6 ++++-
 6 files changed, 51 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index 87b2307..218505d 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -3201,7 +3201,7 @@ static PyObject *py_valid_attr_name(PyObject *self, 
PyObject *args)
 static PyObject *py_binary_encode(PyObject *self, PyObject *args)
 {
        char *str, *encoded;
-       Py_ssize_t size;
+       int size = 0;
        struct ldb_val val;
        PyObject *ret;
 
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm 
b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index db2d79d..1622e71 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -276,9 +276,14 @@ sub PythonStruct($$$$$$)
                $self->indent;
                $self->pidl("$cname *object = ($cname 
*)py_talloc_get_ptr(py_obj);");
                $self->pidl("DATA_BLOB blob;");
+               $self->pidl("int blob_length = 0;");
                $self->pidl("enum ndr_err_code err;");
-               $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", 
&blob.data, &blob.length))");
-               $self->pidl("\treturn NULL;");
+               $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", 
&blob.data, &blob_length)) {");
+               $self->indent;
+               $self->pidl("return NULL;");
+               $self->deindent;
+               $self->pidl("}");
+               $self->pidl("blob.length = blob_length;");
                $self->pidl("");
                $self->pidl("err = ndr_pull_struct_blob_all(&blob, 
py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
                $self->pidl("if (err != NDR_ERR_SUCCESS) {");
diff --git a/source4/auth/credentials/pycredentials.c 
b/source4/auth/credentials/pycredentials.c
index 5083174..b77d476 100644
--- a/source4/auth/credentials/pycredentials.c
+++ b/source4/auth/credentials/pycredentials.c
@@ -60,8 +60,12 @@ static PyObject *py_creds_set_username(py_talloc_Object 
*self, PyObject *args)
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        return 
PyBool_FromLong(cli_credentials_set_username(PyCredentials_AsCliCredentials(self),
 newval, obt));
 }
@@ -76,8 +80,12 @@ static PyObject *py_creds_set_password(py_talloc_Object 
*self, PyObject *args)
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        return 
PyBool_FromLong(cli_credentials_set_password(PyCredentials_AsCliCredentials(self),
 newval, obt));
 }
@@ -91,8 +99,12 @@ static PyObject *py_creds_set_domain(py_talloc_Object *self, 
PyObject *args)
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        return 
PyBool_FromLong(cli_credentials_set_domain(PyCredentials_AsCliCredentials(self),
 newval, obt));
 }
@@ -106,8 +118,12 @@ static PyObject *py_creds_set_realm(py_talloc_Object 
*self, PyObject *args)
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        return 
PyBool_FromLong(cli_credentials_set_realm(PyCredentials_AsCliCredentials(self), 
newval, obt));
 }
@@ -135,8 +151,12 @@ static PyObject *py_creds_set_workstation(py_talloc_Object 
*self, PyObject *args
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        return 
PyBool_FromLong(cli_credentials_set_workstation(PyCredentials_AsCliCredentials(self),
 newval, obt));
 }
@@ -171,8 +191,12 @@ static PyObject *py_creds_parse_string(py_talloc_Object 
*self, PyObject *args)
 {
        char *newval;
        enum credentials_obtained obt = CRED_SPECIFIED;
-       if (!PyArg_ParseTuple(args, "s|i", &newval, &obt))
+       int _obt = obt;
+
+       if (!PyArg_ParseTuple(args, "s|i", &newval, &_obt)) {
                return NULL;
+       }
+       obt = _obt;
 
        cli_credentials_parse_string(PyCredentials_AsCliCredentials(self), 
newval, obt);
        Py_RETURN_NONE;
diff --git a/source4/lib/registry/pyregistry.c 
b/source4/lib/registry/pyregistry.c
index 5719bbd..a3317c7 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -212,11 +212,14 @@ static PyObject *py_hive_key_set_value(PyObject *self, 
PyObject *args)
        char *name;
        uint32_t type;
        DATA_BLOB value;
+       int value_length = 0;
        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;
 
        if (value.data != NULL)
                result = hive_key_set_value(key, name, type, value);
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 895d277..b43f69b 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -44,6 +44,7 @@ typedef struct {
 static PyObject *py_net_join_member(py_net_Object *self, PyObject *args, 
PyObject *kwargs)
 {
        struct libnet_Join_member r;
+       int _level = 0;
        NTSTATUS status;
        PyObject *result;
        TALLOC_CTX *mem_ctx;
@@ -51,8 +52,10 @@ static PyObject *py_net_join_member(py_net_Object *self, 
PyObject *args, PyObjec
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssi:Join", 
discard_const_p(char *, kwnames),
                                         &r.in.domain_name, &r.in.netbios_name, 
-                                        &r.in.level))
+                                        &_level)) {
                return NULL;
+       }
+       r.in.level = _level;
 
        mem_ctx = talloc_new(self->mem_ctx);
        if (mem_ctx == NULL) {
diff --git a/source4/scripting/python/pyglue.c 
b/source4/scripting/python/pyglue.c
index 8a82f35..cc312ba 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -63,9 +63,13 @@ static PyObject *py_generate_random_password(PyObject *self, 
PyObject *args)
 static PyObject *py_unix2nttime(PyObject *self, PyObject *args)
 {
        time_t t;
+       unsigned int _t;
        NTTIME nt;
-       if (!PyArg_ParseTuple(args, "I", &t))
+
+       if (!PyArg_ParseTuple(args, "I", &_t)) {
                return NULL;
+       }
+       t = _t;
 
        unix_to_nt_time(&nt, t);
 


-- 
Samba Shared Repository

Reply via email to