s4/pyauth: check ldb argument in py_user_session()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 24 Apr 2018 00:37:02 +0000 (12:37 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Feb 2019 02:36:17 +0000 (03:36 +0100)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/pyauth.c

index 26d8277887e091fdee6c7a391d023468f7190615..a9a1ee10fcfb259047372de6b4bcb104186d73eb 100644 (file)
@@ -190,6 +190,10 @@ static PyObject *py_user_session(PyObject *module, PyObject *args, PyObject *kwa
        }
 
        ldb_ctx = pyldb_Ldb_AsLdbContext(py_ldb);
+       if (ldb_ctx == NULL) {
+               talloc_free(mem_ctx);
+               return NULL;
+       }
 
        if (py_dn == Py_None) {
                user_dn = NULL;