auth:credentials: Check for NT hash being NULL
authorJo Sutton <josutton@catalyst.net.nz>
Mon, 6 May 2024 23:43:48 +0000 (11:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 16 May 2024 02:11:36 +0000 (02:11 +0000)
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c

index 0bcb894f92068c00a73e844140ce4752bfa0d149..8008bd0418d5b424cf6625dcb9fd7b1e87277999 100644 (file)
@@ -544,6 +544,9 @@ static PyObject *py_creds_get_nt_hash(PyObject *self, PyObject *unused)
                return NULL;
        }
        ntpw = cli_credentials_get_nt_hash(creds, creds);
+       if (ntpw == NULL) {
+               Py_RETURN_NONE;
+       }
 
        ret = PyBytes_FromStringAndSize(discard_const_p(char, ntpw->hash), 16);
        TALLOC_FREE(ntpw);