auth/pycreds/encrypt_netr_crypt_password: don't segfault
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sun, 7 Jul 2019 01:47:51 +0000 (13:47 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 22 Jul 2019 22:20:26 +0000 (22:20 +0000)
Non-talloc objects were treated as talloc objects, to no good effect

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c
selftest/knownfail.d/python-segfaults

index 5002bb86e1c1b5f03e2aeb44e24a5b9d81911842..91e9276473db8fd51aac9443014fdf08c8f85d15 100644 (file)
@@ -909,7 +909,12 @@ static PyObject *py_creds_encrypt_netr_crypt_password(PyObject *self,
        if (!PyArg_ParseTuple(args, "|O", &py_cp)) {
                return NULL;
        }
+
        pwd = pytalloc_get_type(py_cp, struct netr_CryptPassword);
+       if (pwd == NULL) {
+               /* pytalloc_get_type sets TypeError */
+               return NULL;
+       }
        data.length = sizeof(struct netr_CryptPassword);
        data.data   = (uint8_t *)pwd;
        status = netlogon_creds_session_encrypt(creds->netlogon_creds, data);
index 76fc645c2b6565f16901640a0352c8229dce6e61..1be0566dcb1eab45e2509718e14dff7419b27e90 100644 (file)
@@ -1,2 +1 @@
-samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_encrypt_netr_crypt_password
 samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_init__3