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_mkdir()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
5cef3a13b8
commit
7121d47579
@ -564,7 +564,7 @@ def backup_offline(src_service_path, dest_tarfile_path, samdb_conn, smb_conf_pat
|
||||
src = os.path.join(dirpath, dirname)
|
||||
dst = os.path.join(dst_dirpath, dirname)
|
||||
# mkdir with metadata
|
||||
smbd.mkdir(dst, service)
|
||||
smbd.mkdir(dst, session_info, service)
|
||||
ntacl_sddl_str = ntacls_helper.getntacl(src, session_info, as_sddl=True)
|
||||
_create_ntacl_file(dst, ntacl_sddl_str)
|
||||
|
||||
@ -621,7 +621,7 @@ def backup_restore(src_tarfile_path, dst_service_path, samdb_conn, smb_conf_path
|
||||
dst = os.path.join(dst_dirpath, dirname)
|
||||
if not os.path.isdir(dst):
|
||||
# dst must be absolute path for smbd API
|
||||
smbd.mkdir(dst, service)
|
||||
smbd.mkdir(dst, session_info, service)
|
||||
|
||||
ntacl_sddl_str = _read_ntacl_file(src)
|
||||
if ntacl_sddl_str:
|
||||
|
@ -111,7 +111,7 @@ class NtaclsBackupRestoreTests(SmbdBaseTests):
|
||||
"""
|
||||
|
||||
dirpath = os.path.join(self.service_root, 'a-dir')
|
||||
smbd.mkdir(dirpath, self.service)
|
||||
smbd.mkdir(dirpath, system_session_unix(), self.service)
|
||||
mode = os.stat(dirpath).st_mode
|
||||
|
||||
# This works in conjunction with the TEST_UMASK in smbd_base
|
||||
|
@ -971,10 +971,13 @@ static PyObject *py_smbd_mkdir(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
const char * const kwnames[] = {
|
||||
"fname",
|
||||
"session_info",
|
||||
"service",
|
||||
NULL
|
||||
};
|
||||
char *fname, *service = NULL;
|
||||
PyObject *py_session = Py_None;
|
||||
struct auth_session_info *session_info = NULL;
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
struct connection_struct *conn = NULL;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
@ -983,16 +986,33 @@ static PyObject *py_smbd_mkdir(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args,
|
||||
kwargs,
|
||||
"s|z",
|
||||
"sO|z",
|
||||
discard_const_p(char *,
|
||||
kwnames),
|
||||
&fname,
|
||||
&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;
|
||||
|
Loading…
Reference in New Issue
Block a user