mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
pysmbd: add "session_info" arg to py_smbd_chown()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
e6d40e6f9c
commit
da2a9857d0
@ -1707,7 +1707,7 @@ def setsysvolacl(samdb, netlogon, sysvol, uid, gid, domainsid, dnsdomain,
|
||||
raise ProvisioningError("Your filesystem or build does not support posix ACLs, which s3fs requires. "
|
||||
"Try the mounting the filesystem with the 'acl' option.")
|
||||
try:
|
||||
smbd.chown(file.name, uid, gid)
|
||||
smbd.chown(file.name, uid, gid, system_session_unix())
|
||||
except OSError:
|
||||
raise ProvisioningError("Unable to chown a file on your filesystem. "
|
||||
"You may not be running provision as root.")
|
||||
|
@ -224,7 +224,7 @@ class PosixAclMappingTests(SmbdBaseTests):
|
||||
SO_sid = security.dom_sid(security.SID_BUILTIN_SERVER_OPERATORS)
|
||||
(SO_id, SO_type) = s4_passdb.sid_to_id(SO_sid)
|
||||
self.assertEquals(SO_type, idmap.ID_TYPE_BOTH)
|
||||
smbd.chown(self.tempdir, BA_id, SO_id)
|
||||
smbd.chown(self.tempdir, BA_id, SO_id, self.get_session_info())
|
||||
smbd.set_simple_acl(self.tempdir, 0o750, self.get_session_info())
|
||||
facl = getntacl(self.lp, self.tempdir, direct_db_access=False)
|
||||
acl = "O:BAG:SOD:(A;;0x001f01ff;;;BA)(A;;0x001200a9;;;SO)(A;;;;;WD)(A;OICIIO;0x001f01ff;;;CO)(A;OICIIO;0x001200a9;;;CG)(A;OICIIO;0x001200a9;;;WD)"
|
||||
|
@ -500,6 +500,7 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
"fname",
|
||||
"uid",
|
||||
"gid",
|
||||
"session_info",
|
||||
"service",
|
||||
NULL
|
||||
};
|
||||
@ -507,21 +508,38 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
int ret;
|
||||
NTSTATUS status;
|
||||
char *fname, *service = NULL;
|
||||
PyObject *py_session = Py_None;
|
||||
struct auth_session_info *session_info = NULL;
|
||||
int uid, gid;
|
||||
TALLOC_CTX *frame;
|
||||
struct files_struct *fsp = NULL;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sii|z",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siiO|z",
|
||||
discard_const_p(char *, kwnames),
|
||||
&fname,
|
||||
&uid,
|
||||
&gid,
|
||||
&py_session,
|
||||
&service))
|
||||
return NULL;
|
||||
|
||||
if (!py_check_dcerpc_type(py_session,
|
||||
"samba.dcerpc.auth",
|
||||
"session_info")) {
|
||||
return NULL;
|
||||
}
|
||||
session_info = pytalloc_get_type(py_session,
|
||||
struct auth_session_info);
|
||||
if (session_info == NULL) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"Expected auth_session_info for session_info argument got %s",
|
||||
pytalloc_get_name(py_session));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
frame = talloc_stackframe();
|
||||
|
||||
conn = get_conn_tos(service, NULL);
|
||||
conn = get_conn_tos(service, session_info);
|
||||
if (!conn) {
|
||||
TALLOC_FREE(frame);
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user