auth:creds: Check return code of cli_credentials_guess()
authorAndreas Schneider <asn@samba.org>
Tue, 22 Jun 2021 07:24:38 +0000 (09:24 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 29 Jun 2021 02:19:35 +0000 (02:19 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c

index 7405704906abd9f165306f1a578e6b39738d53b0..798cdb41a00cdda99da33eafffeaa80b5e33a9f9 100644 (file)
@@ -661,6 +661,7 @@ static PyObject *py_creds_guess(PyObject *self, PyObject *args)
        struct loadparm_context *lp_ctx;
        TALLOC_CTX *mem_ctx;
        struct cli_credentials *creds;
+       bool ok;
 
        creds = PyCredentials_AsCliCredentials(self);
        if (creds == NULL) {
@@ -683,9 +684,11 @@ static PyObject *py_creds_guess(PyObject *self, PyObject *args)
                return NULL;
        }
 
-       cli_credentials_guess(creds, lp_ctx);
-
+       ok = cli_credentials_guess(creds, lp_ctx);
        talloc_free(mem_ctx);
+       if (!ok) {
+               return NULL;
+       }
 
        Py_RETURN_NONE;
 }