[PATCH] pyauth: Remove the imessaging_ctx parameter

Gary Lockyer gary at catalyst.net.nz
Tue Oct 2 20:01:19 UTC 2018


Remove the imessaging_ctx parameter from the pyauth constructor. The
pyauth code expects this to be a imessaging_context struct.  The
imessaging code returns a wrapper structure that contains the
imessaging_context and the talloc context it's allocated on.  As no code
uses this, and to save others a wasted afternoon I've removed the
parameter.  Could I get a review? CI run results
https://gitlab.com/catalyst-samba/samba/pipelines/31618803

Thanks
Gary

-------------- next part --------------
From b1024932382585c1396458dd9bbddcdfffe336fc Mon Sep 17 00:00:00 2001
From: Gary Lockyer <gary at catalyst.net.nz>
Date: Mon, 1 Oct 2018 12:20:44 +1300
Subject: [PATCH] pyauth: Remove imessaging_ctx parameter to new

The pyauth code assumes the messaging context code is a py_talloc
object.  But the code in pymessaging returns a wrapped talloc object.
Removing the parameter as it's not currently used by any code.

Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
---
 source4/auth/pyauth.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c
index ada89ef0c8f..b8d7a4c8d96 100644
--- a/source4/auth/pyauth.c
+++ b/source4/auth/pyauth.c
@@ -265,23 +265,25 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
 {
 	PyObject *py_lp_ctx = Py_None;
 	PyObject *py_ldb = Py_None;
-	PyObject *py_imessaging_ctx = Py_None;
 	PyObject *py_auth_context = Py_None;
 	PyObject *py_methods = Py_None;
 	TALLOC_CTX *mem_ctx;
 	struct auth4_context *auth_context;
-	struct imessaging_context *imessaging_context = NULL;
 	struct loadparm_context *lp_ctx;
 	struct tevent_context *ev;
 	struct ldb_context *ldb = NULL;
 	NTSTATUS nt_status;
 	const char **methods;
 
-	const char * const kwnames[] = { "lp_ctx", "messaging_ctx", "ldb", "methods", NULL };
+	const char *const kwnames[] = {"lp_ctx", "ldb", "methods", NULL};
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOO",
+	if (!PyArg_ParseTupleAndKeywords(args,
+					 kwargs,
+					 "|OOO",
 					 discard_const_p(char *, kwnames),
-					 &py_lp_ctx, &py_imessaging_ctx, &py_ldb, &py_methods))
+					 &py_lp_ctx,
+					 &py_ldb,
+					 &py_methods))
 		return NULL;
 
 	mem_ctx = talloc_new(NULL);
@@ -306,12 +308,9 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
 		return NULL;
 	}
 
-	if (py_imessaging_ctx != Py_None) {
-		imessaging_context = pytalloc_get_type(py_imessaging_ctx, struct imessaging_context);
-	}
-
 	if (py_methods == Py_None && py_ldb == Py_None) {
-		nt_status = auth_context_create(mem_ctx, ev, imessaging_context, lp_ctx, &auth_context);
+		nt_status = auth_context_create(
+		    mem_ctx, ev, NULL, lp_ctx, &auth_context);
 	} else {
 		if (py_methods != Py_None) {
 			methods = PyList_AsStringList(mem_ctx, py_methods, "methods");
@@ -322,9 +321,8 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
 		} else {
 			methods = auth_methods_from_lp(mem_ctx, lp_ctx);
 		}
-		nt_status = auth_context_create_methods(mem_ctx, methods, ev, 
-							imessaging_context, lp_ctx,
-							ldb, &auth_context);
+		nt_status = auth_context_create_methods(
+		    mem_ctx, methods, ev, NULL, lp_ctx, ldb, &auth_context);
 	}
 
 	if (!NT_STATUS_IS_OK(nt_status)) {
-- 
2.17.1

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


More information about the samba-technical mailing list