diff options
author | Simo Sorce <idra@samba.org> | 2003-08-02 20:06:57 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2003-08-02 20:06:57 +0000 |
commit | 04bf12b176d5abe06b7f1401810369bcafe0b611 (patch) | |
tree | 8bb6627c3ffa4cab902787b874206f8012a33e3a /source3/python/py_ntsec.c | |
parent | 7efce478976e2ac71bcaf4e4d1049bb263634711 (diff) | |
download | samba-04bf12b176d5abe06b7f1401810369bcafe0b611.tar.gz samba-04bf12b176d5abe06b7f1401810369bcafe0b611.tar.bz2 samba-04bf12b176d5abe06b7f1401810369bcafe0b611.zip |
port latest changes from SAMBA_3_0 tree
(This used to be commit 3101c236b8241dc0183995ffceed551876427de4)
Diffstat (limited to 'source3/python/py_ntsec.c')
-rw-r--r-- | source3/python/py_ntsec.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/source3/python/py_ntsec.c b/source3/python/py_ntsec.c index 47524d8e19..3d408e0bda 100644 --- a/source3/python/py_ntsec.c +++ b/source3/python/py_ntsec.c @@ -58,14 +58,14 @@ BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace) return True; } - *dict = PyDict_New(); - - PyDict_SetItemString(*dict, "type", PyInt_FromLong(ace->type)); - PyDict_SetItemString(*dict, "flags", PyInt_FromLong(ace->flags)); - PyDict_SetItemString(*dict, "mask", PyInt_FromLong(ace->info.mask)); + *dict = Py_BuildValue("{sisisi}", "type", ace->type, + "flags", ace->flags, + "mask", ace->info.mask); - if (py_from_SID(&obj, &ace->trustee)) + if (py_from_SID(&obj, &ace->trustee)) { PyDict_SetItemString(*dict, "trustee", obj); + Py_DECREF(obj); + } return True; } @@ -125,10 +125,6 @@ BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl) return True; } - *dict = PyDict_New(); - - PyDict_SetItemString(*dict, "revision", PyInt_FromLong(acl->revision)); - ace_list = PyList_New(acl->num_aces); for (i = 0; i < acl->num_aces; i++) { @@ -138,7 +134,8 @@ BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl) PyList_SetItem(ace_list, i, obj); } - PyDict_SetItemString(*dict, "ace_list", ace_list); + *dict = Py_BuildValue("{sisN}", "revision", acl->revision, + "ace_list", ace_list); return True; } @@ -181,19 +178,29 @@ BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd) *dict = PyDict_New(); - PyDict_SetItemString(*dict, "revision", PyInt_FromLong(sd->revision)); + obj = PyInt_FromLong(sd->revision); + PyDict_SetItemString(*dict, "revision", obj); + Py_DECREF(obj); - if (py_from_SID(&obj, sd->owner_sid)) + if (py_from_SID(&obj, sd->owner_sid)) { PyDict_SetItemString(*dict, "owner_sid", obj); + Py_DECREF(obj); + } - if (py_from_SID(&obj, sd->grp_sid)) + if (py_from_SID(&obj, sd->grp_sid)) { PyDict_SetItemString(*dict, "group_sid", obj); + Py_DECREF(obj); + } - if (py_from_ACL(&obj, sd->dacl)) + if (py_from_ACL(&obj, sd->dacl)) { PyDict_SetItemString(*dict, "dacl", obj); + Py_DECREF(obj); + } - if (py_from_ACL(&obj, sd->sacl)) + if (py_from_ACL(&obj, sd->sacl)) { PyDict_SetItemString(*dict, "sacl", obj); + Py_DECREF(obj); + } return True; } |