1
0
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_set_nt_acl

Add session_info arg as optional and pass it down to get_conn_tos.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13521

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Joe Guo 2018-07-04 10:18:30 +12:00 committed by Andrew Bartlett
parent 760e36ddbc
commit aec40e3a39

View File

@ -556,20 +556,26 @@ static PyObject *py_smbd_have_posix_acls(PyObject *self)
*/
static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kwargs)
{
const char * const kwnames[] = { "fname", "security_info_sent", "sd", "service", NULL };
const char * const kwnames[] = {
"fname", "security_info_sent", "sd",
"service", "session_info", NULL };
NTSTATUS status;
char *fname, *service = NULL;
int security_info_sent;
PyObject *py_sd;
struct security_descriptor *sd;
PyObject *py_session = Py_None;
struct auth_session_info *session_info = NULL;
connection_struct *conn;
TALLOC_CTX *frame;
frame = talloc_stackframe();
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"siO|z", discard_const_p(char *, kwnames),
&fname, &security_info_sent, &py_sd, &service)) {
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "siO|zO",
discard_const_p(char *, kwnames),
&fname, &security_info_sent, &py_sd,
&service, &py_session)) {
TALLOC_FREE(frame);
return NULL;
}
@ -579,7 +585,24 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kw
return NULL;
}
conn = get_conn_tos(service, NULL);
if (py_session != Py_None) {
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) {
PyErr_Format(PyExc_TypeError,
"Expected auth_session_info for session_info argument got %s",
talloc_get_name(pytalloc_get_ptr(py_session)));
return NULL;
}
}
conn = get_conn_tos(service, session_info);
if (!conn) {
TALLOC_FREE(frame);
return NULL;