Issue #18519, #18408: Fix sqlite authorizer callback

If a previous call to the authorizer callback failed and raised an exception,
don't call the Python authorizer callback, but just return SQLITE_DENY.
This commit is contained in:
Victor Stinner 2013-07-21 13:05:38 +02:00
parent b97cc49c3a
commit 41801f5812

View file

@ -883,6 +883,8 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co
gilstate = PyGILState_Ensure();
#endif
if (!PyErr_Occurred()) {
ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source);
if (!ret) {
@ -903,6 +905,12 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co
}
Py_DECREF(ret);
}
}
else {
/* A previous call to the authorizer callback failed and raised an
exception: don't call the Python authorizer callback */
rc = SQLITE_DENY;
}
#ifdef WITH_THREAD
PyGILState_Release(gilstate);