summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorGeoffrey King <gjking@mit.edu>1998-07-08 09:12:05 +0000
committerGeoffrey King <gjking@mit.edu>1998-07-08 09:12:05 +0000
commita1d3d95f0c0d1593559f5df28cd9cbf4f82ae8f9 (patch)
tree86426a9cbdb26068ec48142e52ae1e99eb606ac0 /src/lib
parentbc69faa9f3d5a26b60b843a76c0a7cf3d30cfbeb (diff)
These additions cause the KDC to react to SIGHUP by closing and
reopening its log files, so that logfile management utilities may now compress old logs and then kill -HUP the KDC process to get them to use fresh log files. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10627 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/kadm5/ChangeLog5
-rw-r--r--src/lib/kadm5/logger.c39
2 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog
index 26a14ad6c7..ae8bb7e1b1 100644
--- a/src/lib/kadm5/ChangeLog
+++ b/src/lib/kadm5/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jul 8 04:48:50 1998 Geoffrey J. King <gjking@mit.edu>
+
+ * logger.c: Add the function krb5_klog_reopen() which closes
+ and reopens the log files.
+
Mon Apr 6 19:40:05 1998 Tom Yu <tlyu@voltage-multiplier.mit.edu>
* Makefile.in (includes): Don't call mkdir unless the directory
diff --git a/src/lib/kadm5/logger.c b/src/lib/kadm5/logger.c
index 379b5ffda8..2677e448df 100644
--- a/src/lib/kadm5/logger.c
+++ b/src/lib/kadm5/logger.c
@@ -942,4 +942,43 @@ krb5_klog_syslog(priority, format, va_alist)
va_end(pvar);
return(retval);
}
+
+/*
+ * krb5_klog_reopen() - Close and reopen any open (non-syslog) log files.
+ * This function is called when a SIGHUP is received
+ * so that external log-archival utilities may
+ * alert the Kerberos daemons that they should get
+ * a new file descriptor for the give filename.
+ */
+void
+krb5_klog_reopen(kcontext)
+krb5_context kcontext;
+{
+ int lindex;
+ FILE *f;
+
+ /*
+ * Only logs which are actually files need to be closed
+ * and reopened in response to a SIGHUP
+ */
+ for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
+ if (log_control.log_entries[lindex].log_type == K_LOG_FILE) {
+ fclose(log_control.log_entries[lindex].lfu_filep);
+ /*
+ * In case the old logfile did not get moved out of the
+ * way, open for append to prevent squashing the old logs.
+ */
+ f = fopen(log_control.log_entries[lindex].lfu_fname, "a+");
+ if (f) {
+ log_control.log_entries[lindex].lfu_filep = f;
+ } else {
+ fprintf(stderr, "Couldn't open log file %s: %s\n",
+ log_control.log_entries[lindex].lfu_fname,
+ error_message(errno));
+ }
+ }
+ }
+}
+
#endif /* !defined(_MSDOS) */
+