2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
5 * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
6 * der GNU General Public License (GPL), wie von der Free Software Foundation
7 * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
8 * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
9 * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
10 * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
12 * $Id: conf.c,v 1.41 2002/11/30 22:15:49 alex Exp $
14 * conf.h: Konfiguration des ngircd
30 #include <sys/types.h>
48 LOCAL BOOLEAN Use_Log = TRUE;
51 LOCAL VOID Set_Defaults PARAMS(( VOID ));
52 LOCAL VOID Read_Config PARAMS(( VOID ));
53 LOCAL VOID Validate_Config PARAMS(( VOID ));
55 LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
56 LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
57 LOCAL VOID Handle_SERVER PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
58 LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
60 LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... ));
75 /* Konfiguration einlesen, ueberpruefen und ausgeben. */
86 /* Wenn stdin ein ein TTY ist: auf Taste warten */
87 if( isatty( fileno( stdout )))
89 puts( "OK, press enter to see a dump of your service configuration ..." );
92 else puts( "Ok, dump of your server configuration follows:\n" );
95 printf( " ServerName = %s\n", Conf_ServerName );
96 printf( " ServerInfo = %s\n", Conf_ServerInfo );
97 printf( " ServerPwd = %s\n", Conf_ServerPwd );
98 printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 );
99 printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
100 printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
101 printf( " MotdFile = %s\n", Conf_MotdFile );
102 printf( " Ports = " );
103 for( i = 0; i < Conf_ListenPorts_Count; i++ )
105 if( i != 0 ) printf( ", " );
106 printf( "%u", Conf_ListenPorts[i] );
109 pwd = getpwuid( Conf_UID );
110 if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
111 else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
112 grp = getgrgid( Conf_GID );
113 if( grp ) printf( " ServerGID = %s\n", grp->gr_name );
114 else printf( " ServerGID = %ld\n", (LONG)Conf_GID );
115 printf( " PingTimeout = %d\n", Conf_PingTimeout );
116 printf( " PongTimeout = %d\n", Conf_PongTimeout );
117 printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
118 printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
119 if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
120 else printf( " MaxConnections = -1\n" );
123 for( i = 0; i < Conf_Oper_Count; i++ )
125 if( ! Conf_Oper[i].name[0] ) continue;
127 /* gueltiger Operator-Block: ausgeben */
128 puts( "[OPERATOR]" );
129 printf( " Name = %s\n", Conf_Oper[i].name );
130 printf( " Password = %s\n", Conf_Oper[i].pwd );
134 for( i = 0; i < Conf_Server_Count; i++ )
136 if( ! Conf_Server[i].name[0] ) continue;
137 if( ! Conf_Server[i].host[0] ) continue;
139 /* gueltiger Server-Block: ausgeben */
141 printf( " Name = %s\n", Conf_Server[i].name );
142 printf( " Host = %s\n", Conf_Server[i].host );
143 printf( " Port = %d\n", Conf_Server[i].port );
144 printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
145 printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
146 printf( " Group = %d\n", Conf_Server[i].group );
150 for( i = 0; i < Conf_Channel_Count; i++ )
152 if( ! Conf_Channel[i].name[0] ) continue;
154 /* gueltiger Channel-Block: ausgeben */
156 printf( " Name = %s\n", Conf_Channel[i].name );
157 printf( " Modes = %s\n", Conf_Channel[i].modes );
158 printf( " Topic = %s\n", Conf_Channel[i].topic );
169 /* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */
171 strcpy( Conf_ServerName, "" );
172 sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
173 strcpy( Conf_ServerPwd, "" );
175 strcpy( Conf_ServerAdmin1, "" );
176 strcpy( Conf_ServerAdmin2, "" );
177 strcpy( Conf_ServerAdminMail, "" );
179 strcpy( Conf_MotdFile, MOTD_FILE );
181 Conf_ListenPorts_Count = 0;
183 Conf_UID = Conf_GID = 0;
185 Conf_PingTimeout = 120;
186 Conf_PongTimeout = 20;
188 Conf_ConnectRetry = 60;
191 Conf_Server_Count = 0;
192 Conf_Channel_Count = 0;
194 Conf_OperCanMode = FALSE;
196 Conf_MaxConnections = 0;
203 /* Konfigurationsdatei einlesen. */
205 CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
209 fd = fopen( NGIRCd_ConfFile, "r" );
212 /* Keine Konfigurationsdatei gefunden */
213 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
214 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
218 Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
221 strcpy( section, "" );
224 if( ! fgets( str, LINE_LEN, fd )) break;
228 /* Kommentarzeilen und leere Zeilen ueberspringen */
229 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
231 /* Anfang eines Abschnittes? */
232 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
234 strcpy( section, str );
235 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
236 if( strcasecmp( section, "[OPERATOR]" ) == 0 )
238 if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
241 /* neuen Operator initialisieren */
242 strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
243 strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
248 if( strcasecmp( section, "[SERVER]" ) == 0 )
250 if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
253 /* neuen Server ("Peer") initialisieren */
254 strcpy( Conf_Server[Conf_Server_Count].host, "" );
255 strcpy( Conf_Server[Conf_Server_Count].ip, "" );
256 strcpy( Conf_Server[Conf_Server_Count].name, "" );
257 strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
258 strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
259 Conf_Server[Conf_Server_Count].port = 0;
260 Conf_Server[Conf_Server_Count].group = -1;
261 Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
262 Conf_Server[Conf_Server_Count].res_stat = NULL;
267 if( strcasecmp( section, "[CHANNEL]" ) == 0 )
269 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
272 /* neuen vordefinierten Channel initialisieren */
273 strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
274 strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
275 strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
276 Conf_Channel_Count++;
280 Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
283 if( section[0] == 0x1 ) continue;
285 /* In Variable und Argument zerlegen */
286 ptr = strchr( str, '=' );
289 Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
293 var = str; ngt_TrimStr( var );
294 arg = ptr + 1; ngt_TrimStr( arg );
296 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
297 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
298 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
299 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
300 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
305 /* Wenn kein Port definiert wurde, Port 6667 als Default benutzen */
306 if( Conf_ListenPorts_Count < 1 )
308 Conf_ListenPorts_Count = 1;
309 Conf_ListenPorts[0] = 6667;
315 Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
323 assert( Var != NULL );
324 assert( Arg != NULL );
326 if( strcasecmp( Var, "Name" ) == 0 )
328 /* Der Server-Name */
329 strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
330 Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
331 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
334 if( strcasecmp( Var, "Info" ) == 0 )
336 /* Server-Info-Text */
337 strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
338 Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
339 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
342 if( strcasecmp( Var, "Password" ) == 0 )
344 /* Server-Passwort */
345 strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
346 Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
347 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
350 if( strcasecmp( Var, "AdminInfo1" ) == 0 )
352 /* Server-Info-Text */
353 strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
354 Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
355 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
358 if( strcasecmp( Var, "AdminInfo2" ) == 0 )
360 /* Server-Info-Text */
361 strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
362 Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
363 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
366 if( strcasecmp( Var, "AdminEMail" ) == 0 )
368 /* Server-Info-Text */
369 strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
370 Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
371 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
374 if( strcasecmp( Var, "Ports" ) == 0 )
376 /* Ports, durch "," getrennt, auf denen der Server
377 * Verbindungen annehmen soll */
378 ptr = strtok( Arg, "," );
383 if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
386 if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port;
387 else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
389 ptr = strtok( NULL, "," );
393 if( strcasecmp( Var, "MotdFile" ) == 0 )
395 /* Datei mit der "message of the day" (MOTD) */
396 strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
397 Conf_MotdFile[FNAME_LEN - 1] = '\0';
398 if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
401 if( strcasecmp( Var, "ServerUID" ) == 0 )
403 /* UID, mit der der Daemon laufen soll */
404 pwd = getpwnam( Arg );
405 if( pwd ) Conf_UID = pwd->pw_uid;
409 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
412 Conf_UID = (UINT)atoi( Arg );
416 if( strcasecmp( Var, "ServerGID" ) == 0 )
418 /* GID, mit der der Daemon laufen soll */
419 grp = getgrnam( Arg );
420 if( grp ) Conf_GID = grp->gr_gid;
424 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
427 Conf_GID = (UINT)atoi( Arg );
431 if( strcasecmp( Var, "PingTimeout" ) == 0 )
434 Conf_PingTimeout = atoi( Arg );
435 if( Conf_PingTimeout < 5 )
437 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
438 Conf_PingTimeout = 5;
442 if( strcasecmp( Var, "PongTimeout" ) == 0 )
445 Conf_PongTimeout = atoi( Arg );
446 if( Conf_PongTimeout < 5 )
448 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
449 Conf_PongTimeout = 5;
453 if( strcasecmp( Var, "ConnectRetry" ) == 0 )
455 /* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
456 Conf_ConnectRetry = atoi( Arg );
457 if( Conf_ConnectRetry < 5 )
459 Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
460 Conf_ConnectRetry = 5;
464 if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
466 /* Koennen IRC-Operatoren immer MODE benutzen? */
467 if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
468 else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
469 else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
470 else Conf_OperCanMode = FALSE;
473 if( strcasecmp( Var, "MaxConnections" ) == 0 )
475 /* Maximale Anzahl von Verbindungen. Werte <= 0 stehen
476 * fuer "kein Limit". */
478 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
481 Conf_MaxConnections = atol( Arg );
485 Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
486 } /* Handle_GLOBAL */
490 Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
493 assert( Var != NULL );
494 assert( Arg != NULL );
495 assert( Conf_Oper_Count > 0 );
497 if( strcasecmp( Var, "Name" ) == 0 )
499 /* Name des IRC Operator */
500 strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
501 Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
502 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
505 if( strcasecmp( Var, "Password" ) == 0 )
507 /* Passwort des IRC Operator */
508 strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
509 Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
510 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
514 Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
515 } /* Handle_OPERATOR */
519 Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
524 assert( Var != NULL );
525 assert( Arg != NULL );
527 if( strcasecmp( Var, "Host" ) == 0 )
529 /* Hostname des Servers */
530 strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
531 Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
532 if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
535 if( strcasecmp( Var, "Name" ) == 0 )
537 /* Name des Servers ("Nick") */
538 strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
539 Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
540 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
543 if( strcasecmp( Var, "MyPassword" ) == 0 )
545 /* Passwort dieses Servers, welches empfangen werden muss */
546 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
547 Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
548 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
551 if( strcasecmp( Var, "PeerPassword" ) == 0 )
553 /* Passwort des anderen Servers, welches gesendet werden muss */
554 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
555 Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
556 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
559 if( strcasecmp( Var, "Port" ) == 0 )
561 /* Port, zu dem Verbunden werden soll */
563 if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
564 else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
567 if( strcasecmp( Var, "Group" ) == 0 )
571 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
574 Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
578 Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
579 } /* Handle_SERVER */
583 Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
586 assert( Var != NULL );
587 assert( Arg != NULL );
589 if( strcasecmp( Var, "Name" ) == 0 )
591 /* Hostname des Servers */
592 strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
593 Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
594 if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
597 if( strcasecmp( Var, "Modes" ) == 0 )
599 /* Name des Servers ("Nick") */
600 strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
601 Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
602 if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
605 if( strcasecmp( Var, "Topic" ) == 0 )
607 /* Passwort des Servers */
608 strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
609 Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
610 if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
614 Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
615 } /* Handle_CHANNEL */
619 Validate_Config( VOID )
621 /* Konfiguration ueberpruefen */
623 if( ! Conf_ServerName[0] )
625 /* Kein Servername konfiguriert */
626 Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
627 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
632 if( ! Conf_ServerAdminMail[0] )
634 /* Keine Server-Information konfiguriert */
635 Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
636 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
641 if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
643 /* Keine Server-Information konfiguriert */
644 Log( LOG_WARNING, "No administrative information configured but required by RFC!" );
646 } /* Validate_Config */
650 LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
652 LOCAL VOID Config_Error( Level, Format, va_alist )
658 /* Fehler! Auf Console und/oder ins Log schreiben */
660 CHAR msg[MAX_LOG_MSG_LEN];
663 assert( Format != NULL );
665 /* String mit variablen Argumenten zusammenbauen ... */
667 va_start( ap, Format );
671 vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
674 /* Im "normalen Betrieb" soll der Log-Mechanismus des ngIRCd verwendet
675 * werden, beim Testen der Konfiguration jedoch nicht, hier sollen alle
676 * Meldungen direkt auf die Konsole ausgegeben werden: */
677 if( Use_Log ) Log( Level, "%s", msg );