The branch, master has been updated
       via  cb7220d Fix the PyDoc comments in samba.smb.SMB and add a 
security_info argument to both get_acl and set_acl to allow the caller to 
specify what info is wanted. Defaults to 0 which means all info.
      from  d86e701 s4:ldap.py - re-introduce the 
"(dn=CN=ldaptestUSER3,CN=Users,DC=wallnoefer2,DC=local)" test

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


- Log -----------------------------------------------------------------
commit cb7220d72124b89f316c181c674982dbe5f6c372
Author: Richard Sharpe <[email protected]>
Date:   Sun Mar 25 17:27:11 2012 -0700

    Fix the PyDoc comments in samba.smb.SMB and add a security_info argument to 
both get_acl and set_acl to allow the caller to specify what info is wanted. 
Defaults to 0 which means all info.
    
    Autobuild-User: Richard Sharpe <[email protected]>
    Autobuild-Date: Mon Mar 26 04:05:25 CEST 2012 on sn-devel-104

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

Summary of changes:
 source4/libcli/pysmb.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c
index 2f9a579..b4eba14 100644
--- a/source4/libcli/pysmb.c
+++ b/source4/libcli/pysmb.c
@@ -302,9 +302,10 @@ static PyObject *py_smb_getacl(pytalloc_Object *self, 
PyObject *args, PyObject *
        union smb_fileinfo fio;
        struct smb_private_data *spdata;
        const char *filename;
+       int sinfo = 0;
        int fnum;
 
-       if (!PyArg_ParseTuple(args, "s:get_acl", &filename)) {
+       if (!PyArg_ParseTuple(args, "s|i:get_acl", &filename, &sinfo)) {
                return NULL;
        }
 
@@ -335,7 +336,10 @@ static PyObject *py_smb_getacl(pytalloc_Object *self, 
PyObject *args, PyObject *
 
        fio.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
        fio.query_secdesc.in.file.fnum = fnum;
-       fio.query_secdesc.in.secinfo_flags = SECINFO_OWNER |
+       if (sinfo)
+               fio.query_secdesc.in.secinfo_flags = sinfo;
+       else
+               fio.query_secdesc.in.secinfo_flags = SECINFO_OWNER |
                                                SECINFO_GROUP |
                                                SECINFO_DACL |
                                                SECINFO_PROTECTED_DACL |
@@ -344,7 +348,6 @@ static PyObject *py_smb_getacl(pytalloc_Object *self, 
PyObject *args, PyObject *
                                                SECINFO_PROTECTED_SACL |
                                                SECINFO_UNPROTECTED_SACL;
 
-
        status = smb_raw_query_secdesc(spdata->tree, self->talloc_ctx, &fio);
        smbcli_close(spdata->tree, fnum);
 
@@ -367,9 +370,10 @@ static PyObject *py_smb_setacl(pytalloc_Object *self, 
PyObject *args, PyObject *
        const char *filename;
        PyObject *py_sd;
        struct security_descriptor *sd;
+       uint32_t sinfo = 0;
        int fnum;
 
-       if (!PyArg_ParseTuple(args, "sO:set_acl", &filename, &py_sd)) {
+       if (!PyArg_ParseTuple(args, "sO|i:get_acl", &filename, &py_sd, &sinfo)) 
{
                return NULL;
        }
 
@@ -410,7 +414,18 @@ static PyObject *py_smb_setacl(pytalloc_Object *self, 
PyObject *args, PyObject *
 
        fio.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
        fio.set_secdesc.in.file.fnum = fnum;
-       fio.set_secdesc.in.secinfo_flags = 0;
+       if (sinfo)
+               fio.set_secdesc.in.secinfo_flags = sinfo;
+       else
+               fio.set_secdesc.in.secinfo_flags = SECINFO_OWNER |
+                                               SECINFO_GROUP |
+                                               SECINFO_DACL |
+                                               SECINFO_PROTECTED_DACL |
+                                               SECINFO_UNPROTECTED_DACL |
+                                               SECINFO_SACL |
+                                               SECINFO_PROTECTED_SACL |
+                                               SECINFO_UNPROTECTED_SACL;
+
        fio.set_secdesc.in.sd = sd;
 
        status = smb_raw_set_secdesc(spdata->tree, &fio);
@@ -447,10 +462,10 @@ static PyMethodDef py_smb_methods[] = {
                "chkpath(path) -> True or False\n\n \
                Return true if path exists, false otherwise." },
        { "get_acl", (PyCFunction)py_smb_getacl, METH_VARARGS,
-               "get_acl(path) -> security_descriptor object\n\n \
+               "get_acl(path[, security_info=0]) -> security_descriptor 
object\n\n \
                Get security descriptor for file." },
        { "set_acl", (PyCFunction)py_smb_setacl, METH_VARARGS,
-               "set_acl(path, security_descriptor) -> None\n\n \
+               "set_acl(path, security_descriptor[, security_info=0]) -> 
None\n\n \
                Set security descriptor for file." },
        { NULL },
 };
@@ -522,7 +537,7 @@ static PyTypeObject PySMB = {
        .tp_new = py_smb_new,
        .tp_flags = Py_TPFLAGS_DEFAULT,
        .tp_methods = py_smb_methods,
-       .tp_doc = "SMB(hostname, service[, lp[, creds]]) -> SMB connection 
object\n",
+       .tp_doc = "SMB(hostname, service[, creds[, lp]]) -> SMB connection 
object\n",
 
 };
 


-- 
Samba Shared Repository

Reply via email to