]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/sighandlers.c
Support for server certificate validation on server links [S2S-TLS]
[ngircd-alex.git] / src / ngircd / sighandlers.c
index effef44d8fb8b391e1b222eb2eaabee296632e48..4ed1a1255f4498b3820856dd8736d2a86cf0d33c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <time.h>
 
-#include "imp.h"
 #include "conn.h"
-#include "conf-ssl.h"
 #include "channel.h"
 #include "conf.h"
 #include "io.h"
 #include "log.h"
 #include "ngircd.h"
+
 #include "sighandlers.h"
 
 static int signalpipe[2];
@@ -41,21 +41,23 @@ static const int signals_catch[] = {
        SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
 };
 
-#ifdef DEBUG
 
 static void
 Dump_State(void)
 {
-       Log(LOG_DEBUG, "--- Internal server state: %s ---",
+       LogDebug("--- Internal server state: %s ---",
            Client_ID(Client_ThisServer()));
-       Log(LOG_DEBUG, "time()=%ld", time(NULL));
+#ifdef HAVE_LONG_LONG
+       LogDebug("time()=%llu", (unsigned long long)time(NULL));
+#else
+       LogDebug("time()=%lu", (unsigned long)time(NULL));
+#endif
        Conf_DebugDump();
        Conn_DebugDump();
        Client_DebugDump();
-       Log(LOG_DEBUG, "--- End of state dump ---");
+       LogDebug("--- End of state dump ---");
 } /* Dump_State */
 
-#endif
 
 static void
 Signal_Block(int sig)
@@ -115,7 +117,7 @@ Rehash(void)
        if (strcmp(old_name, Conf_ServerName) != 0 ) {
                strlcpy(Conf_ServerName, old_name, sizeof Conf_ServerName);
                Log(LOG_ERR,
-                   "Can't change \"ServerName\" on runtime! Ignored new name.");
+                   "Can't change server name (\"Name\") on runtime! Ignored new name.");
        }
        if (old_nicklen != Conf_MaxNickLength) {
                Conf_MaxNickLength = old_nicklen;
@@ -128,7 +130,7 @@ Rehash(void)
 
        if (!ConnSSL_InitLibrary())
                Log(LOG_WARNING,
-                   "Re-Initializing of SSL failed, using old keys!");
+                   "Re-Initializing of SSL failed!");
 
        /* Start listening on sockets */
        Conn_InitListeners( );
@@ -150,6 +152,14 @@ Rehash(void)
 static void
 Signal_Handler(int Signal)
 {
+       if (Signal != SIGCHLD) {
+#ifdef HAVE_STRSIGNAL
+               Log(LOG_INFO, "Got signal \"%s\" ...", strsignal(Signal));
+#else
+               Log(LOG_INFO, "Got signal %d ...", Signal);
+#endif
+       }
+
        switch (Signal) {
        case SIGTERM:
        case SIGINT:
@@ -162,7 +172,6 @@ Signal_Handler(int Signal)
                while (waitpid( -1, NULL, WNOHANG) > 0)
                        ;
                return;
-#ifdef DEBUG
        case SIGUSR1:
                if (! NGIRCd_Debug) {
                        Log(LOG_INFO|LOG_snotice,
@@ -185,7 +194,6 @@ Signal_Handler(int Signal)
 #endif /* SNIFFER */
                }
                return;
-#endif
        }
 
        /*
@@ -214,7 +222,6 @@ Signal_Handler_BH(int Signal)
                /* re-read configuration */
                Rehash();
                break;
-#ifdef DEBUG
        case SIGUSR2:
                if (NGIRCd_Debug) {
                        Log(LOG_INFO|LOG_snotice,
@@ -223,8 +230,7 @@ Signal_Handler_BH(int Signal)
                }
                break;
        default:
-               Log(LOG_DEBUG, "Got signal %d! Ignored.", Signal);
-#endif
+               LogDebug("Got signal %d! Ignored.", Signal);
        }
        Signal_Unblock(Signal);
 }