b6b438
From 0e97b1a6d9e46a3810d89bd6bcb863eded30399a Mon Sep 17 00:00:00 2001
b6b438
From: Andreas Schneider <asn@samba.org>
b6b438
Date: Wed, 13 Nov 2019 10:06:20 +0100
b6b438
Subject: [PATCH 150/187] auth:pycreds: Check return code of
b6b438
 netlogon_creds_client_authenticator()
b6b438
b6b438
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14195
b6b438
b6b438
Signed-off-by: Andreas Schneider <asn@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
(cherry picked from commit d3fffca5e9ab45b43fa3f460ad6051356c9a00a9)
b6b438
---
b6b438
 auth/credentials/pycredentials.c | 11 ++++++++---
b6b438
 1 file changed, 8 insertions(+), 3 deletions(-)
b6b438
b6b438
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
b6b438
index 1aef16a0145..84407314d48 100644
b6b438
--- a/auth/credentials/pycredentials.c
b6b438
+++ b/auth/credentials/pycredentials.c
b6b438
@@ -644,6 +644,7 @@ static PyObject *py_creds_new_client_authenticator(PyObject *self,
b6b438
 	struct cli_credentials *creds = NULL;
b6b438
 	struct netlogon_creds_CredentialState *nc = NULL;
b6b438
 	PyObject *ret = NULL;
b6b438
+	NTSTATUS status;
b6b438
 
b6b438
 	creds = PyCredentials_AsCliCredentials(self);
b6b438
 	if (creds == NULL) {
b6b438
@@ -660,9 +661,13 @@ static PyObject *py_creds_new_client_authenticator(PyObject *self,
b6b438
 		return NULL;
b6b438
 	}
b6b438
 
b6b438
-	netlogon_creds_client_authenticator(
b6b438
-		nc,
b6b438
-		&auth);
b6b438
+	status = netlogon_creds_client_authenticator(nc, &auth);
b6b438
+	if (!NT_STATUS_IS_OK(status)) {
b6b438
+		PyErr_SetString(PyExc_ValueError,
b6b438
+				"Failed to create client authenticator");
b6b438
+		return NULL;
b6b438
+	}
b6b438
+
b6b438
 	ret = Py_BuildValue("{s"PYARG_BYTES_LEN"si}",
b6b438
 			    "credential",
b6b438
 			    (const char *) &auth.cred, sizeof(auth.cred),
b6b438
-- 
b6b438
2.23.0
b6b438