#14416: conditionally add LOG_AUTHPRIV facility and LOG_ODELAY to syslog.
authorR David Murray <rdmurray@bitdance.com>
Thu, 29 Mar 2012 11:15:45 +0000 (07:15 -0400)
committerR David Murray <rdmurray@bitdance.com>
Thu, 29 Mar 2012 11:15:45 +0000 (07:15 -0400)
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.

Doc/library/syslog.rst
Misc/ACKS
Misc/NEWS
Modules/syslogmodule.c

index 645c326678f35afb34f37512601a7b8f218b865e..aa0f5a176c599dfb734681c6b2813afc1b526cd5 100644 (file)
@@ -78,12 +78,14 @@ Priority levels (high to low):
 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
index 4e6597dea1a16c6c33d5cab828425cb83962cecf..632d004f511750438f0939ecb88074d9943bbad2 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -832,6 +832,7 @@ Terry Reedy
 Gareth Rees
 Steve Reeves
 Lennart Regebro
+Federico Reghenzani
 Ofir Reichenberg
 Sean Reifschneider
 Michael P. Reilly
index 2acf6c0cb46cdfd71876a55d7d9846f81cc4fe24..fd4abd88c8f7b8e6ca02f516af131c68cbd67978 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,9 @@ Core and Builtins
 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
index c7a2487d29b0fa8d6cf0714701850282bd041c35..8b877cfdbc25bede90c0117f9b231ea6fec72e8f 100644 (file)
@@ -291,6 +291,9 @@ PyInit_syslog(void)
     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 @@ PyInit_syslog(void)
     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;
 }