]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth/credentials: Fix NULL dereference
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Sun, 23 Apr 2023 23:13:38 +0000 (11:13 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 5 May 2023 02:54:31 +0000 (02:54 +0000)
We should not pass a NULL pointer to netlogon_creds_session_encrypt().

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c

index 41a9d597435e90608498dc90b16adb3a2ce2f1f3..ac9ccd4ae27ed1eecc7e1bd19775bd73a59b3145 100644 (file)
@@ -1033,6 +1033,11 @@ static PyObject *py_creds_encrypt_samr_password(PyObject *self,
                return NULL;
        }
 
+       if (creds->netlogon_creds == NULL) {
+               PyErr_Format(PyExc_ValueError, "NetLogon credentials not set");
+               return NULL;
+       }
+
        if (!PyArg_ParseTuple(args, "O", &py_cp)) {
                return NULL;
        }