Skip Menu |
 

Date: Wed, 22 Aug 2007 13:06:40 -0700 (PDT)
From: Brian Kantor <brian@karoshi.ucsd.edu>
To: krb5-bugs@mit.edu
Subject: 'syslog' logging in krb5-1.6.2 error
Download (untitled) / with headers
text/plain 1.5KiB
An entry of

[logging]
default = SYSLOG:INFO:LOCAL0

in /etc/krb5.conf, with NO logging specifications in kdc.conf, causes
both krb5kdc and kadmind to log entries twice in syslog.

This is caused by a duplication of logging destinations in the
list of log outputs.

The following patch to lib/kadm5/logger.c provides a workaround
to keep this from occuring.
- Brian

diff -ubB {krb5-1.6.2-dist,krb5-1.6.2}/src/lib/kadm5/logger.c

--- krb5-1.6.2-dist/src/lib/kadm5/logger.c Wed Apr 4 14:08:05 2007
+++ krb5-1.6.2/src/lib/kadm5/logger.c Wed Aug 22 11:59:59 2007
@@ -356,7 +356,9 @@
const char *logging_profent[3];
const char *logging_defent[3];
char **logging_specs;
+ int n;
char *cp, *cp2;
char savec = '\0';
int error;
@@ -635,8 +648,19 @@
if (log_control.log_entries[i].log_type == K_LOG_NONE) {
fprintf(stderr, lspec_parse_err_1, whoami, cp);
fprintf(stderr, lspec_parse_err_2, whoami);
+ continue;
}
- else
+
+ /* check for duplicate log specs */
+ for (n=0; n < i; n++) {
+ /* XXX workaround: do more extensive checking someday */
+ if (log_control.log_entries[i].log_type == log_control.log_entries[n].log_type) {
+ log_control.log_entries[i].log_type = K_LOG_NONE;
+ continue;
+ }
+ }
+
ngood++;
}
}
@@ -674,8 +700,9 @@
gethostname(log_control.log_hostname, MAXHOSTNAMELEN);
log_control.log_hostname[MAXHOSTNAMELEN] = '\0';
}
+
#ifdef HAVE_OPENLOG
- if (do_openlog) {
+ if (do_openlog && !log_control.log_opened) {
openlog(whoami, LOG_NDELAY|LOG_PID, log_facility);
log_control.log_opened = 1;
}