]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth:pycreds: Check return code of netlogon_creds_client_authenticator()
authorAndreas Schneider <asn@samba.org>
Wed, 13 Nov 2019 09:06:20 +0000 (10:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 14 Nov 2019 08:01:44 +0000 (08:01 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14195

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c

index 446f30970a2f68c9d0bf1081e93afedb5396f6ef..7427e286dca14742e512f18c34b68638da5884bc 100644 (file)
@@ -832,6 +832,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) {
@@ -848,9 +849,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),