From 760e36ddbcb8543f99fd34d97e8b6851dd022c1f Mon Sep 17 00:00:00 2001 From: Joe Guo Date: Wed, 4 Jul 2018 10:05:50 +1200 Subject: pysmbd: add session_info arg to get_conn_tos Add session_info arg, so caller can pass it in to reuse authentication info later. This will improve performance a lot while doing ntacl operations on large amount of files, e.g.: sysvolreset. Modification for upstream caller will come in following patches. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13521 Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Gary Lockyer --- source3/smbd/pysmbd.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'source3/smbd/pysmbd.c') diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index b220fbe691f..faf4565fff9 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -44,7 +44,10 @@ extern const struct generic_mapping file_generic_mapping; #define DIRECTORY_FLAGS O_RDONLY #endif -static connection_struct *get_conn_tos(const char *service) + +static connection_struct *get_conn_tos( + const char *service, + const struct auth_session_info *session_info) { struct conn_struct_tos *c = NULL; int snum = -1; @@ -66,7 +69,7 @@ static connection_struct *get_conn_tos(const char *service) status = create_conn_struct_tos(NULL, snum, "/", - NULL, + session_info, &c); PyErr_NTSTATUS_IS_ERR_RAISE(status); @@ -410,7 +413,7 @@ static PyObject *py_smbd_set_simple_acl(PyObject *self, PyObject *args, PyObject return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -451,7 +454,7 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs) frame = talloc_stackframe(); - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -510,7 +513,7 @@ static PyObject *py_smbd_unlink(PyObject *self, PyObject *args, PyObject *kwargs return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -576,7 +579,7 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kw return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -611,7 +614,7 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args, PyObject *kw return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -653,7 +656,7 @@ static PyObject *py_smbd_set_sys_acl(PyObject *self, PyObject *args, PyObject *k return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -694,7 +697,7 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -739,7 +742,7 @@ static PyObject *py_smbd_mkdir(PyObject *self, PyObject *args, PyObject *kwargs) return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; @@ -792,7 +795,7 @@ static PyObject *py_smbd_create_file(PyObject *self, PyObject *args, PyObject *k return NULL; } - conn = get_conn_tos(service); + conn = get_conn_tos(service, NULL); if (!conn) { TALLOC_FREE(frame); return NULL; -- cgit v1.2.1