mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
bpo-43762: Add audit events for loading of sqlite3 extensions (GH-25246)
This commit is contained in:
parent
52cd6d5e1b
commit
7244c0060d
7 changed files with 86 additions and 0 deletions
|
|
@ -1154,6 +1154,11 @@ pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
|
|||
{
|
||||
int rc;
|
||||
|
||||
if (PySys_Audit("sqlite3.enable_load_extension",
|
||||
"OO", self, onoff ? Py_True : Py_False) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1185,6 +1190,10 @@ pysqlite_connection_load_extension_impl(pysqlite_Connection *self,
|
|||
int rc;
|
||||
char* errmsg;
|
||||
|
||||
if (PySys_Audit("sqlite3.load_extension", "Os", self, extension_name) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,14 @@ static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
|
|||
}
|
||||
|
||||
result = PyObject_Call(factory, args, kwargs);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PySys_Audit("sqlite3.connect/handle", "O", self) < 0) {
|
||||
Py_DECREF(result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue