--- a/lib/os.h
+++ b/lib/os.h
@@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void);
 
 BOOL os_signal_init();
 
+BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ());
+
 BOOL os_lock_exclusive(int fd);
 
 BOOL os_lock_shared(int fd);
--- a/servers/session_server.c
+++ b/servers/session_server.c
@@ -286,6 +286,7 @@ BOOL session_server(struct config *confi
     fd_set readfds;
     pid_t child;
     unsigned long timeout = 0L;
+    BOOL sighup_seen = NIL;
 
     if (config->direct_enable) {
         ssl_portlist
@@ -348,6 +349,18 @@ BOOL session_server(struct config *confi
             } else {
                 rc = select(maxfd + 1, &readfds, NIL, NIL, NIL);
             }
+	    if (sighup_seen) {
+		log_misc("SIGHUP received - reexec daemon");
+		close(sockfd);
+		if (config->direct_enable) {
+		    /* Find some way to pass this information along
+		       to the new invocation somehow later. */
+		    portlist_close_all(ssl_portlist);
+		    portlist_close_all(plain_portlist);
+		}
+		log_misc_free();
+		return (T);
+	    }
         }
         while ((rc < 0) && (errno == EINTR));
 
--- a/shared/log.c
+++ b/shared/log.c
@@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config
     return (log_open(log_misc_ptr, log_name));
 }
 
+void log_misc_free()
+{
+    if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0))
+        return;
+    log_free(log_misc_ptr);
+}
+
 /* log_misc_ping() *******************************************************
  *
  * Reopen misc log file if required
--- a/shared/log.h
+++ b/shared/log.h
@@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log
 BOOL
 log_misc_init(struct config *config, char *progname, char *misc_log_name);
 
+void log_misc_free();
+
 BOOL log_misc_ping();
 
 void log_misc(char *fmt, ...);
