From: Ezra Peisach Date: Mon, 18 Jun 2001 01:44:03 +0000 (+0000) Subject: * logger.c (klog_vsyslog): If krb5_klog_init() is not called, do X-Git-Tag: krb5-1.3-alpha1~1410 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c62cfd3f33f8b2f975505d01144913544e96e7b5;p=krb5.git * logger.c (klog_vsyslog): If krb5_klog_init() is not called, do not pass a NULL pointer to vsprintf for a %s format. Also, if syslog() exists on the system, fallback to using this so the message is not dropped on the floor. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13357 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog index 25ee6af38..346843ac5 100644 --- a/src/lib/kadm5/ChangeLog +++ b/src/lib/kadm5/ChangeLog @@ -1,3 +1,10 @@ +2001-06-17 Ezra Peisach + + * logger.c (klog_vsyslog): If krb5_klog_init() is not called, do + not pass a NULL pointer to vsprintf for a %s format. Also, if + syslog() exists on the system, fallback to using this so the + message is not dropped on the floor. + 2001-06-04 Ezra Peisach * logger.c (krb5_klog_init): Cleanup assignments in diff --git a/src/lib/kadm5/logger.c b/src/lib/kadm5/logger.c index 3946e7e6c..9448018ba 100644 --- a/src/lib/kadm5/logger.c +++ b/src/lib/kadm5/logger.c @@ -864,7 +864,9 @@ klog_vsyslog(priority, format, arglist) #endif /* HAVE_STRFTIME */ #ifdef VERBOSE_LOGS sprintf(cp, " %s %s[%ld](%s): ", - log_control.log_hostname, log_control.log_whoami, (long) getpid(), + log_control.log_hostname ? log_control.log_hostname : "", + log_control.log_whoami ? log_control.log_whoami : "", + (long) getpid(), severity2string(priority)); #else sprintf(cp, " "); @@ -880,6 +882,17 @@ klog_vsyslog(priority, format, arglist) ((int *) arglist)[4], ((int *) arglist)[5]); #endif /* HAVE_VSPRINTF */ + /* + * If the user did not use krb5_klog_init() instead of dropping + * the request on the floor, syslog it - if it exists + */ +#ifdef HAVE_SYSLOG + if (log_control.log_nentries == 0) { + /* Log the message with our header trimmed off */ + syslog(priority, "%s", syslogp); + } +#endif + /* * Now that we have the message formatted, perform the output to each * logging specification.