]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pysmbd: remove explicit talloc_stackframe() from get_conn() and name it get_conn_tos()
authorStefan Metzmacher <metze@samba.org>
Thu, 24 May 2018 14:16:19 +0000 (16:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jun 2018 18:52:21 +0000 (20:52 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/pysmbd.c

index ae361e977074b21ee280cfdef1cb06a1b7c06954..638a673764074aeb17f04874f3d2d6ca80a7260e 100644 (file)
@@ -43,33 +43,29 @@ static int conn_free_wrapper(connection_struct *conn)
        return 0;
 };
 
-static connection_struct *get_conn(TALLOC_CTX *mem_ctx, const char *service)
+static connection_struct *get_conn_tos(const char *service)
 {
        connection_struct *conn;
-       TALLOC_CTX *frame = talloc_stackframe();
        int snum = -1;
        NTSTATUS status;
 
        if (!posix_locking_init(false)) {
                PyErr_NoMemory();
-               TALLOC_FREE(frame);
                return NULL;
        }
 
        if (service) {
                snum = lp_servicenumber(service);
                if (snum == -1) {
-                       TALLOC_FREE(frame);
                        PyErr_SetString(PyExc_RuntimeError, "unknown service");
                        return NULL;
                }
        }
 
-       status = create_conn_struct(mem_ctx, NULL, NULL, &conn, snum, "/",
+       status = create_conn_struct(talloc_tos(), NULL, NULL, &conn, snum, "/",
                                            NULL);
        PyErr_NTSTATUS_IS_ERR_RAISE(status);
 
-       TALLOC_FREE(frame);
        /* Ignore read-only and share restrictions */
        conn->read_only = false;
        conn->share_access = SEC_RIGHTS_FILE_ALL;
@@ -395,7 +391,7 @@ static PyObject *py_smbd_set_simple_acl(PyObject *self, PyObject *args, PyObject
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -436,7 +432,7 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs)
 
        frame = talloc_stackframe();
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -495,7 +491,7 @@ static PyObject *py_smbd_unlink(PyObject *self, PyObject *args, PyObject *kwargs
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -561,7 +557,7 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kw
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -596,7 +592,7 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args, PyObject *kw
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -638,7 +634,7 @@ static PyObject *py_smbd_set_sys_acl(PyObject *self, PyObject *args, PyObject *k
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;
@@ -679,7 +675,7 @@ static PyObject *py_smbd_get_sys_acl(PyObject *self, PyObject *args, PyObject *k
                return NULL;
        }
 
-       conn = get_conn(frame, service);
+       conn = get_conn_tos(service);
        if (!conn) {
                TALLOC_FREE(frame);
                return NULL;