diff options
-rw-r--r-- | python/samba/tests/posixacl.py | 16 | ||||
-rw-r--r-- | source3/smbd/pysmbd.c | 24 |
2 files changed, 30 insertions, 10 deletions
diff --git a/python/samba/tests/posixacl.py b/python/samba/tests/posixacl.py index a5d9547c1a5..f2734f54120 100644 --- a/python/samba/tests/posixacl.py +++ b/python/samba/tests/posixacl.py @@ -197,7 +197,7 @@ class PosixAclMappingTests(SmbdBaseTests): facl = getntacl(self.lp, self.tempf, self.get_session_info()) anysid = security.dom_sid(security.SID_NT_SELF) self.assertEquals(facl.as_sddl(anysid), acl) - posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS, self.get_session_info()) def test_setposixacl_getntacl(self): smbd.set_simple_acl(self.tempf, 0o750, self.get_session_info()) @@ -248,7 +248,7 @@ class PosixAclMappingTests(SmbdBaseTests): def test_setposixacl_getposixacl(self): smbd.set_simple_acl(self.tempf, 0o640, self.get_session_info()) - posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS, self.get_session_info()) self.assertEquals(posix_acl.count, 4, self.print_posix_acl(posix_acl)) self.assertEquals(posix_acl.acl[0].a_type, smb_acl.SMB_ACL_USER_OBJ) @@ -265,7 +265,7 @@ class PosixAclMappingTests(SmbdBaseTests): def test_setposixacl_dir_getposixacl(self): smbd.set_simple_acl(self.tempdir, 0o750, self.get_session_info()) - posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS, self.get_session_info()) self.assertEquals(posix_acl.count, 4, self.print_posix_acl(posix_acl)) self.assertEquals(posix_acl.acl[0].a_type, smb_acl.SMB_ACL_USER_OBJ) @@ -286,7 +286,7 @@ class PosixAclMappingTests(SmbdBaseTests): (BA_gid, BA_type) = s4_passdb.sid_to_id(BA_sid) self.assertEquals(BA_type, idmap.ID_TYPE_BOTH) smbd.set_simple_acl(self.tempf, 0o670, self.get_session_info(), BA_gid) - posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS, self.get_session_info()) self.assertEquals(posix_acl.count, 5, self.print_posix_acl(posix_acl)) @@ -314,7 +314,7 @@ class PosixAclMappingTests(SmbdBaseTests): session_info, use_ntvfs=False) facl = getntacl(self.lp, self.tempf, session_info) self.assertEquals(facl.as_sddl(domsid), acl) - posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS, session_info) nwrap_module_so_path = os.getenv('NSS_WRAPPER_MODULE_SO_PATH') nwrap_module_fn_prefix = os.getenv('NSS_WRAPPER_MODULE_FN_PREFIX') @@ -458,7 +458,7 @@ class PosixAclMappingTests(SmbdBaseTests): session_info, use_ntvfs=False) facl = getntacl(self.lp, self.tempdir, session_info) self.assertEquals(facl.as_sddl(domsid), acl) - posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS, session_info) LA_sid = security.dom_sid(str(domsid) + "-" + str(security.DOMAIN_RID_ADMINISTRATOR)) BA_sid = security.dom_sid(security.SID_BUILTIN_ADMINISTRATORS) @@ -551,7 +551,7 @@ class PosixAclMappingTests(SmbdBaseTests): session_info, use_ntvfs=False) facl = getntacl(self.lp, self.tempdir, session_info) self.assertEquals(facl.as_sddl(domsid), acl) - posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempdir, smb_acl.SMB_ACL_TYPE_ACCESS, session_info) LA_sid = security.dom_sid(str(domsid) + "-" + str(security.DOMAIN_RID_ADMINISTRATOR)) BA_sid = security.dom_sid(security.SID_BUILTIN_ADMINISTRATORS) @@ -657,7 +657,7 @@ class PosixAclMappingTests(SmbdBaseTests): session_info, use_ntvfs=False) facl = getntacl(self.lp, self.tempf, session_info) self.assertEquals(facl.as_sddl(domsid), acl) - posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS) + posix_acl = smbd.get_sys_acl(self.tempf, smb_acl.SMB_ACL_TYPE_ACCESS, session_info) nwrap_module_so_path = os.getenv('NSS_WRAPPER_MODULE_SO_PATH') nwrap_module_fn_prefix = os.getenv('NSS_WRAPPER_MODULE_FN_PREFIX') diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 19e8d9e9a00..f28acd93f77 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -900,11 +900,14 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k const char * const kwnames[] = { "fname", "acl_type", + "session_info", "service", NULL }; char *fname; PyObject *py_acl; + PyObject *py_session = Py_None; + struct auth_session_info *session_info = NULL; struct smb_acl_t *acl; int acl_type; TALLOC_CTX *frame = talloc_stackframe(); @@ -912,16 +915,33 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k char *service = NULL; struct smb_filename *smb_fname = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "si|z", + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO|z", discard_const_p(char *, kwnames), &fname, &acl_type, + &py_session, &service)) { TALLOC_FREE(frame); return NULL; } - conn = get_conn_tos(service, NULL); + if (!py_check_dcerpc_type(py_session, + "samba.dcerpc.auth", + "session_info")) { + TALLOC_FREE(frame); + 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)); + TALLOC_FREE(frame); + return NULL; + } + + conn = get_conn_tos(service, session_info); if (!conn) { TALLOC_FREE(frame); return NULL; |