[Patches] Preparation for tevent impersonation (part1)

Stefan Metzmacher metze at samba.org
Wed Jun 13 18:54:33 UTC 2018


Hi Jeremy,

> In patch [PATCH 06/40] pysmbd: remove explicit talloc_stackframe() from  get_conn() and name it get_conn_tos()
> 
> py_smbd_set_simple_acl()
> py_smbd_chown()
> 
> are missing a TALLOC_FREE(frame) in their error paths.
> 
> -       conn = get_conn(frame, service);
> +       conn = get_conn_tos(service);
>         if (!conn) {
>>>>>> NEEDS	TALLOC_FREE(frame);
>                 return NULL;
>         }
> 
> This is an existing bug, but probably should be fixed
> either in patch 06/40 or in an additional patch after
> it.

I have the attached patch before 06.

> I'm still reviewing the rest, but I just wanted to say
> I *love* the cleanups in the code.

Thanks!

metze
-------------- next part --------------
From 973a83368ab9491c11b46b337670f95baf5dfbbc Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 24 May 2018 16:16:19 +0200
Subject: [PATCH] pysmbd: fix some talloc_stackframe() memory leaks

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/smbd/pysmbd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index 700ce78a7732..a89d80620f1a 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -281,6 +281,7 @@ static SMB_ACL_T make_simple_acl(gid_t gid, mode_t chmod_mode)
 	SMB_ACL_T acl = sys_acl_init(frame);
 
 	if (!acl) {
+		TALLOC_FREE(frame);
 		return NULL;
 	}
 
@@ -365,6 +366,8 @@ static SMB_ACL_T make_simple_acl(gid_t gid, mode_t chmod_mode)
 		TALLOC_FREE(frame);
 		return NULL;
 	}
+
+	TALLOC_FREE(frame);
 	return acl;
 }
 
@@ -392,6 +395,7 @@ static PyObject *py_smbd_set_simple_acl(PyObject *self, PyObject *args, PyObject
 
 	conn = get_conn(frame, service);
 	if (!conn) {
+		TALLOC_FREE(frame);
 		return NULL;
 	}
 
@@ -433,6 +437,7 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs)
 
 	conn = get_conn(frame, service);
 	if (!conn) {
+		TALLOC_FREE(frame);
 		return NULL;
 	}
 
-- 
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180613/ea273fca/signature.sig>


More information about the samba-technical mailing list