krb5 commit: Remove logging default severity

Greg Hudson ghudson at mit.edu
Wed Jan 17 18:16:02 EST 2018


https://github.com/krb5/krb5/commit/6ce8fd4cfa2e9b1e92debd204a5b2ddf053cca55
commit 6ce8fd4cfa2e9b1e92debd204a5b2ddf053cca55
Author: Greg Hudson <ghudson at mit.edu>
Date:   Mon Jan 8 11:14:06 2018 -0500

    Remove logging default severity
    
    The default severity for syslog outputs was only used for com_err()
    messages (which are rare so far), and doesn't really make sense;
    severity is a property of an individual message, not of a device.
    Remove the severity field in a backward-compatible manner.
    
    ticket: 8630

 doc/admin/conf_files/kdc_conf.rst |   12 +++-------
 src/lib/kadm5/logger.c            |   41 +------------------------------------
 2 files changed, 5 insertions(+), 48 deletions(-)

diff --git a/doc/admin/conf_files/kdc_conf.rst b/doc/admin/conf_files/kdc_conf.rst
index 3af1c37..3959079 100644
--- a/doc/admin/conf_files/kdc_conf.rst
+++ b/doc/admin/conf_files/kdc_conf.rst
@@ -599,19 +599,15 @@ Logging specifications may have the following forms:
 **SYSLOG**\ [\ **:**\ *severity*\ [\ **:**\ *facility*\ ]]
     This causes the daemon's logging messages to go to the system log.
 
-    The severity argument specifies the default severity of system log
-    messages.  This may be any of the following severities supported
-    by the syslog(3) call, minus the ``LOG_`` prefix: **EMERG**,
-    **ALERT**, **CRIT**, **ERR**, **WARNING**, **NOTICE**, **INFO**,
-    and **DEBUG**.
+    For backward compatibility, a severity argument may be specified,
+    and must be specified in order to specify a facility.  This
+    argument will be ignored.
 
     The facility argument specifies the facility under which the
     messages are logged.  This may be any of the following facilities
     supported by the syslog(3) call minus the LOG\_ prefix: **KERN**,
     **USER**, **MAIL**, **DAEMON**, **AUTH**, **LPR**, **NEWS**,
-    **UUCP**, **CRON**, and **LOCAL0** through **LOCAL7**.
-
-    If no severity is specified, the default is **ERR**.  If no
+    **UUCP**, **CRON**, and **LOCAL0** through **LOCAL7**.  If no
     facility is specified, the default is **AUTH**.
 
 In the following example, the logging messages from the KDC will go to
diff --git a/src/lib/kadm5/logger.c b/src/lib/kadm5/logger.c
index e113af9..771ab67 100644
--- a/src/lib/kadm5/logger.c
+++ b/src/lib/kadm5/logger.c
@@ -116,7 +116,6 @@ struct log_entry {
         } log_file;
         struct log_syslog {
             int         ls_facility;
-            int         ls_severity;
         } log_syslog;
         struct log_device {
             FILE        *ld_filep;
@@ -127,7 +126,6 @@ struct log_entry {
 #define lfu_filep       log_union.log_file.lf_filep
 #define lfu_fname       log_union.log_file.lf_fname
 #define lsu_facility    log_union.log_syslog.ls_facility
-#define lsu_severity    log_union.log_syslog.ls_severity
 #define ldu_filep       log_union.log_device.ld_filep
 #define ldu_devname     log_union.log_device.ld_devname
 
@@ -332,9 +330,8 @@ krb5_klog_init(krb5_context kcontext, char *ename, char *whoami, krb5_boolean do
                 else if (!strncasecmp(cp, "SYSLOG", 6)) {
                     error = 0;
                     log_control.log_entries[i].lsu_facility = LOG_AUTH;
-                    log_control.log_entries[i].lsu_severity = LOG_ERR;
                     /*
-                     * Is there a severify specified?
+                     * Is there a severify (which is now ignored) specified?
                      */
                     if (cp[6] == ':') {
                         /*
@@ -348,41 +345,6 @@ krb5_klog_init(krb5_context kcontext, char *ename, char *whoami, krb5_boolean do
                         }
 
                         /*
-                         * Match a severity.
-                         */
-                        if (!strcasecmp(&cp[7], "ERR")) {
-                            log_control.log_entries[i].lsu_severity = LOG_ERR;
-                        }
-                        else if (!strcasecmp(&cp[7], "EMERG")) {
-                            log_control.log_entries[i].lsu_severity =
-                                LOG_EMERG;
-                        }
-                        else if (!strcasecmp(&cp[7], "ALERT")) {
-                            log_control.log_entries[i].lsu_severity =
-                                LOG_ALERT;
-                        }
-                        else if (!strcasecmp(&cp[7], "CRIT")) {
-                            log_control.log_entries[i].lsu_severity = LOG_CRIT;
-                        }
-                        else if (!strcasecmp(&cp[7], "WARNING")) {
-                            log_control.log_entries[i].lsu_severity =
-                                LOG_WARNING;
-                        }
-                        else if (!strcasecmp(&cp[7], "NOTICE")) {
-                            log_control.log_entries[i].lsu_severity =
-                                LOG_NOTICE;
-                        }
-                        else if (!strcasecmp(&cp[7], "INFO")) {
-                            log_control.log_entries[i].lsu_severity = LOG_INFO;
-                        }
-                        else if (!strcasecmp(&cp[7], "DEBUG")) {
-                            log_control.log_entries[i].lsu_severity =
-                                LOG_DEBUG;
-                        }
-                        else
-                            error = 1;
-
-                        /*
                          * If there is a facility present, then parse that.
                          */
                         if (cp2) {
@@ -535,7 +497,6 @@ krb5_klog_init(krb5_context kcontext, char *ename, char *whoami, krb5_boolean do
         log_control.log_entries->log_type = K_LOG_SYSLOG;
         log_control.log_entries->log_2free = (krb5_pointer) NULL;
         log_facility = log_control.log_entries->lsu_facility = LOG_AUTH;
-        log_control.log_entries->lsu_severity = LOG_ERR;
         do_openlog = 1;
         log_control.log_nentries = 1;
     }


More information about the cvs-krb5 mailing list