pygensec: insist on proper AuthContext in start_server
[nivanova/samba-autobuild/.git] / source4 / auth / gensec / pygensec.c
index d27fe28648a807bfe9e6f8fc4aca7974041b3f6c..d8f782f8d191138eae85995f43915cf641a73fe7 100644 (file)
@@ -176,7 +176,15 @@ static PyObject *py_gensec_start_server(PyTypeObject *type, PyObject *args, PyOb
        }
 
        if (py_auth_context != Py_None) {
-               auth_context = pytalloc_get_type(py_auth_context, struct auth4_context);
+               bool ok = py_check_dcerpc_type(py_auth_context,
+                                              "samba.auth",
+                                              "AuthContext");
+               if (!ok) {
+                       return NULL;
+               }
+
+               auth_context = pytalloc_get_type(py_auth_context,
+                                                struct auth4_context);
                if (!auth_context) {
                        PyErr_Format(PyExc_TypeError,
                                     "Expected auth.AuthContext for auth_context argument, got %s",