src = os.path.join(dirpath, filename)
dst = os.path.join(dst_dirpath, filename)
# create an empty file with metadata
- smbd.create_file(dst, service)
+ smbd.create_file(dst, session_info, service)
ntacl_sddl_str = ntacls_helper.getntacl(src, session_info, as_sddl=True)
_create_ntacl_file(dst, ntacl_sddl_str)
dst = os.path.join(dst_dirpath, filename)
if not os.path.isfile(dst):
# dst must be absolute path for smbd API
- smbd.create_file(dst, service)
+ smbd.create_file(dst, session_info, service)
ntacl_sddl_str = _read_ntacl_file(src)
if ntacl_sddl_str:
"""
filepath = os.path.join(self.service_root, 'a-file')
- smbd.create_file(filepath, self.service)
+ smbd.create_file(filepath, system_session_unix(), self.service)
self.assertTrue(os.path.isfile(filepath))
mode = os.stat(filepath).st_mode
{
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 files_struct *fsp = NULL;
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;