[Python-checkins] cpython: #14416: conditionally add LOG_AUTHPRIV facility and LOG_ODELAY to syslog.

r.david.murray python-checkins at python.org
Thu Mar 29 13:16:19 CEST 2012


http://hg.python.org/cpython/rev/dc8e61044055
changeset:   75981:dc8e61044055
user:        R David Murray <rdmurray at bitdance.com>
date:        Thu Mar 29 07:15:45 2012 -0400
summary:
  #14416: conditionally add LOG_AUTHPRIV facility and LOG_ODELAY to syslog.

Unlike the other facilities, we don't use a fallback for AUTHPRIV if it
doesn't exist.  Because it is intended for logging sensitive log messages, it
is better that a program trying to log such messages fail than that it log
them insecurely.

Initial patch by Federico Reghenzani.

files:
  Doc/library/syslog.rst |  10 ++++++----
  Misc/ACKS              |   1 +
  Misc/NEWS              |   3 +++
  Modules/syslogmodule.c |   8 ++++++++
  4 files changed, 18 insertions(+), 4 deletions(-)


diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst
--- a/Doc/library/syslog.rst
+++ b/Doc/library/syslog.rst
@@ -78,12 +78,14 @@
 Facilities:
    :const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:`LOG_DAEMON`,
    :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:`LOG_UUCP`,
-   :const:`LOG_CRON`, :const:`LOG_SYSLOG` and :const:`LOG_LOCAL0` to
-   :const:`LOG_LOCAL7`.
+   :const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to
+   :const:`LOG_LOCAL7`, and, if defined in ``<syslog.h>``,
+   :const:`LOG_AUTHPRIV`.
 
 Log options:
-   :const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, :const:`LOG_NOWAIT`
-   and :const:`LOG_PERROR` if defined in ``<syslog.h>``.
+   :const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined
+   in ``<syslog.h>``, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and
+   :const:`LOG_PERROR`.
 
 
 Examples
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -832,6 +832,7 @@
 Gareth Rees
 Steve Reeves
 Lennart Regebro
+Federico Reghenzani
 Ofir Reichenberg
 Sean Reifschneider
 Michael P. Reilly
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,9 @@
 Library
 -------
 
+- Issue #14416: syslog now defines the LOG_ODELAY and LOG_AUTHPRIV constants
+  if they are defined in <syslog.h>.
+
 - IDLE can be launched as python -m idlelib
 
 - Issue #14295: Add unittest.mock
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -291,6 +291,9 @@
     PyModule_AddIntConstant(m, "LOG_PID",         LOG_PID);
     PyModule_AddIntConstant(m, "LOG_CONS",        LOG_CONS);
     PyModule_AddIntConstant(m, "LOG_NDELAY",  LOG_NDELAY);
+#ifdef LOG_ODELAY
+    PyModule_AddIntConstant(m, "LOG_ODELAY",  LOG_ODELAY);
+#endif
 #ifdef LOG_NOWAIT
     PyModule_AddIntConstant(m, "LOG_NOWAIT",  LOG_NOWAIT);
 #endif
@@ -331,5 +334,10 @@
     PyModule_AddIntConstant(m, "LOG_CRON",        LOG_CRON);
     PyModule_AddIntConstant(m, "LOG_UUCP",        LOG_UUCP);
     PyModule_AddIntConstant(m, "LOG_NEWS",        LOG_NEWS);
+
+#ifdef LOG_AUTHPRIV
+    PyModule_AddIntConstant(m, "LOG_AUTHPRIV",    LOG_AUTHPRIV);
+#endif
+
     return m;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list