+Wed Jul 8 04:30:22 1998 Geoffrey King <gjking@mit.edu>
+
+ * adm_proto.h: Added prototype for new function krb5_klog_reopen()
+
Thu Apr 16 23:50:08 1998 Tom Yu <tlyu@mit.edu>
* configure.in: Search for /var/tmp first when determining rcache
krb5_boolean));
void krb5_klog_close KRB5_PROTOTYPE((krb5_context));
int krb5_klog_syslog KRB5_PROTOTYPE((int, const char *, ...));
+void krb5_klog_reopen KRB5_PROTOTYPE((krb5_context));
/* alt_prof.c */
krb5_error_code krb5_aprof_init
+Wed Jul 8 04:36:28 1998 Geoffrey King <gjking@mit.edu>
+
+ * extern.h: Added declaration for new variable
+ signal_requests_hup, which is set when the KDC
+ is sent a SIGHUP
+
+ * extern.c: Added definition for signal_requests_hup
+
+ * main.c: Added new signal handling code for SIGHUP, including
+ the new function request_hup()
+
+ * network.c: Check signal_requests_hup in the main KDC loop
+
Fri May 8 18:46:59 1998 Theodore Y. Ts'o <tytso@mit.edu>
* kerberos_v4.c (krb4_stime): Print 4 digit years in Krb4 log
krb5_rcache kdc_rcache = (krb5_rcache) NULL;
volatile int signal_requests_exit = 0; /* gets set when signal hits */
+volatile int signal_requests_hup = 0; /* ditto */
extern krb5_rcache kdc_rcache; /* replay cache */
extern volatile int signal_requests_exit;
+extern volatile int signal_requests_hup;
#endif /* __KRB5_KDC_EXTERN__ */
void usage PROTOTYPE((char *));
krb5_sigtype request_exit PROTOTYPE((int));
+krb5_sigtype request_hup PROTOTYPE((int));
void setup_signal_handlers PROTOTYPE((void));
static char *kdc_current_rcname = (char *) NULL;
static int rkey_init_done = 0;
+#ifdef POSIX_SIGNALS
+static struct sigaction s_action;
+#endif /* POSIX_SIGNALS */
+
#define KRB5_KDC_MAX_REALMS 32
#ifdef USE_RCACHE
#endif
}
+krb5_sigtype
+request_hup(signo)
+ int signo;
+{
+ signal_requests_hup = 1;
+
+#ifdef POSIX_SIGTYPE
+ return;
+#else
+ return(0);
+#endif
+}
+
void
setup_signal_handlers()
{
+#ifdef POSIX_SIGNALS
+ (void) sigemptyset(&s_action.sa_mask);
+ s_action.saflags = 0;
+ s_action.sa_handler = request_exit;
+ (void) sigaction(SIGINT, &s_action, (struct sigaction *) NULL);
+ (void) sigaction(SIGTERM, &s_action, (struct sigaction *) NULL);
+ s_action.sa_handler = request_hup;
+ (void) sigaction(SIGHUP, &s_action, (struct sigaction *) NULL);
+#else /* POSIX_SIGNALS */
signal(SIGINT, request_exit);
- signal(SIGHUP, request_exit);
signal(SIGTERM, request_exit);
+ signal(SIGHUP, request_hup);
+#endif /* POSIX_SIGNALS */
return;
}
return errout;
}
+
+
+
return KDC5_NONET;
while (!signal_requests_exit) {
+ if (signal_requests_hup) {
+ krb5_klog_reopen();
+ signal_requests_hup = 0;
+ }
readfds = select_fds;
nfound = select(select_nfds, &readfds, 0, 0, 0);
if (nfound == -1) {
+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
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) */
+