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