]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/ngircd.c
Enlarged buffer for version string ;-)
[ngircd-alex.git] / src / ngircd / ngircd.c
index 4690e7dd5c8d6c340781238d62294473fabd373e..1166c7b74881ade1349e508fc1cb578b04c534d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
  *
  * 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
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: ngircd.c,v 1.66 2002/12/26 13:17:57 alex Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.74 2003/03/07 14:50:13 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -43,6 +43,10 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.66 2002/12/26 13:17:57 alex Exp $";
 #include "parse.h"
 #include "irc.h"
 
+#ifdef RENDEZVOUS
+#include "rendezvous.h"
+#endif
+
 #include "exp.h"
 #include "ngircd.h"
 
@@ -73,8 +77,8 @@ main( int argc, const char *argv[] )
 #ifdef SNIFFER
        NGIRCd_Sniffer = FALSE;
 #endif
-       strcpy( NGIRCd_ConfFile, SYSCONFDIR );
-       strcat( NGIRCd_ConfFile, CONFIG_FILE );
+       strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile ));
+       strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile ));
 
        /* Kommandozeile parsen */
        for( i = 1; i < argc; i++ )
@@ -88,11 +92,10 @@ main( int argc, const char *argv[] )
                        {
                                if( i + 1 < argc )
                                {
-                                       /* Ok, danach kommt noch ein Parameter */
-                                       strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
-                                       NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
+                                       /* Ok, there's an parameter left */
+                                       strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile ));
 
-                                       /* zum uebernaechsten Parameter */
+                                       /* next parameter */
                                        i++; ok = TRUE;
                                }
                        }
@@ -155,11 +158,10 @@ main( int argc, const char *argv[] )
                                {
                                        if(( ! argv[i][n + 1] ) && ( i + 1 < argc ))
                                        {
-                                               /* Ok, danach kommt ein Leerzeichen */
-                                               strncpy( NGIRCd_ConfFile, argv[i + 1], FNAME_LEN - 1 );
-                                               NGIRCd_ConfFile[FNAME_LEN - 1] = '\0';
+                                               /* Ok, next character is a blank */
+                                               strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile ));
 
-                                               /* zum uebernaechsten Parameter */
+                                               /* go to the following parameter */
                                                i++; n = (LONG)strlen( argv[i] );
                                                ok = TRUE;
                                        }
@@ -260,6 +262,9 @@ main( int argc, const char *argv[] )
                Lists_Init( );
                Channel_Init( );
                Client_Init( );
+#ifdef RENDEZVOUS
+               Rendezvous_Init( );
+#endif
                Conn_Init( );
 
                /* Wenn als root ausgefuehrt und eine andere UID
@@ -322,6 +327,9 @@ main( int argc, const char *argv[] )
 
                /* Alles abmelden */
                Conn_Exit( );
+#ifdef RENDEZVOUS
+               Rendezvous_Exit( );
+#endif
                Client_Exit( );
                Channel_Exit( );
                Lists_Exit( );
@@ -349,7 +357,7 @@ NGIRCd_Version( VOID )
 GLOBAL CHAR *
 NGIRCd_VersionAddition( VOID )
 {
-       STATIC CHAR txt[64];
+       STATIC CHAR txt[200];
 
        strcpy( txt, "" );
 
@@ -361,6 +369,14 @@ NGIRCd_VersionAddition( VOID )
        if( txt[0] ) strcat( txt, "+" );
        strcat( txt, "ZLIB" );
 #endif
+#ifdef USE_TCPWRAP
+       if( txt[0] ) strcat( txt, "+" );
+       strcat( txt, "TCPWRAP" );
+#endif
+#ifdef RENDEZVOUS
+       if( txt[0] ) strcat( txt, "+" );
+       strcat( txt, "RENDEZVOUS" );
+#endif
 #ifdef DEBUG
        if( txt[0] ) strcat( txt, "+" );
        strcat( txt, "DEBUG" );
@@ -378,12 +394,12 @@ NGIRCd_VersionAddition( VOID )
        strcat( txt, "IRCPLUS" );
 #endif
        
-       if( txt[0] ) strcat( txt, "-" );
-       strcat( txt, TARGET_CPU );
-       strcat( txt, "/" );
-       strcat( txt, TARGET_VENDOR );
-       strcat( txt, "/" );
-       strcat( txt, TARGET_OS );
+       if( txt[0] ) strlcat( txt, "-", sizeof( txt ));
+       strlcat( txt, TARGET_CPU, sizeof( txt ));
+       strlcat( txt, "/", sizeof( txt ));
+       strlcat( txt, TARGET_VENDOR, sizeof( txt ));
+       strlcat( txt, "/", sizeof( txt ));
+       strlcat( txt, TARGET_OS, sizeof( txt ));
 
        return txt;
 } /* NGIRCd_VersionAddition */
@@ -401,10 +417,11 @@ NGIRCd_Rehash( VOID )
        Conn_ExitListeners( );
 
        /* Alten Server-Namen merken */
+       assert( sizeof( old_name ) == sizeof( Conf_ServerName ));
        strcpy( old_name, Conf_ServerName );
 
        /* Konfiguration neu lesen ... */
-       Conf_Init( );
+       Conf_Rehash( );
 
        /* Alten Server-Namen wiederherstellen: dieser
         * kann nicht zur Laufzeit geaendert werden ... */
@@ -507,7 +524,7 @@ LOCAL VOID
 Show_Version( VOID )
 {
        puts( NGIRCd_Version( ));
-       puts( "Copyright (c)2001,2002 by Alexander Barton (<alex@barton.de>)." );
+       puts( "Copyright (c)2001-2003 by Alexander Barton (<alex@barton.de>)." );
        puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
        puts( "This is free software; see the source for copying conditions. There is NO" );
        puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );