mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
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 <sharpe@samba.org> Autobuild-Date: Mon Mar 26 04:05:25 CEST 2012 on sn-devel-104
This commit is contained in:
parent
d86e701b7c
commit
cb7220d721
@ -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",
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user