summaryrefslogtreecommitdiff
path: root/Modules/syslogmodule.c
diff options
context:
space:
mode:
authorSaiyang Gou <gousaiyang@163.com>2020-02-12 23:47:42 -0800
committerGitHub <noreply@github.com>2020-02-13 07:47:42 +0000
commit7514f4f6254f4a2d13ea8e5632a8e5f22b637e0b (patch)
tree9010a9077eaee0c66eea85e36f60086de6fba731 /Modules/syslogmodule.c
parent597ebed748d0b0c061f8c108bd98270d103286c1 (diff)
downloadcpython-git-7514f4f6254f4a2d13ea8e5632a8e5f22b637e0b.tar.gz
bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, `resource`, `shutil`, `signal`, `syslog` (GH-18407)
Diffstat (limited to 'Modules/syslogmodule.c')
-rw-r--r--Modules/syslogmodule.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 539224f2c5..24517925c3 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -144,6 +144,10 @@ syslog_openlog(PyObject * self, PyObject * args, PyObject *kwds)
return NULL;
}
+ if (PySys_Audit("syslog.openlog", "sll", ident, logopt, facility) < 0) {
+ return NULL;
+ }
+
openlog(ident, logopt, facility);
S_log_open = 1;
@@ -170,6 +174,10 @@ syslog_syslog(PyObject * self, PyObject * args)
if (message == NULL)
return NULL;
+ if (PySys_Audit("syslog.syslog", "is", priority, message) < 0) {
+ return NULL;
+ }
+
/* if log is not opened, open it now */
if (!S_log_open) {
PyObject *openargs;
@@ -194,6 +202,9 @@ syslog_syslog(PyObject * self, PyObject * args)
static PyObject *
syslog_closelog(PyObject *self, PyObject *unused)
{
+ if (PySys_Audit("syslog.closelog", NULL) < 0) {
+ return NULL;
+ }
if (S_log_open) {
closelog();
Py_CLEAR(S_ident_o);
@@ -209,6 +220,9 @@ syslog_setlogmask(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "l;mask for priority", &maskpri))
return NULL;
+ if (PySys_Audit("syslog.setlogmask", "(O)", args ? args : Py_None) < 0) {
+ return NULL;
+ }
omaskpri = setlogmask(maskpri);
return PyLong_FromLong(omaskpri);
}