2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
11 * Configuration management (reading, parsing & validation)
17 static char UNUSED id[] = "$Id: conf.c,v 1.44 2002/12/14 13:36:19 alex Exp $";
29 #include <sys/types.h>
47 LOCAL BOOLEAN Use_Log = TRUE;
50 LOCAL VOID Set_Defaults PARAMS(( VOID ));
51 LOCAL VOID Read_Config PARAMS(( VOID ));
52 LOCAL VOID Validate_Config PARAMS(( VOID ));
54 LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
55 LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
56 LOCAL VOID Handle_SERVER PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
57 LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
59 LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... ));
74 /* Read configuration, validate and output it. */
85 /* If stdin is a valid tty wait for a key: */
86 if( isatty( fileno( stdout )))
88 puts( "OK, press enter to see a dump of your service configuration ..." );
91 else puts( "Ok, dump of your server configuration follows:\n" );
94 printf( " ServerName = %s\n", Conf_ServerName );
95 printf( " ServerInfo = %s\n", Conf_ServerInfo );
96 printf( " ServerPwd = %s\n", Conf_ServerPwd );
97 printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 );
98 printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
99 printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
100 printf( " MotdFile = %s\n", Conf_MotdFile );
101 printf( " Ports = " );
102 for( i = 0; i < Conf_ListenPorts_Count; i++ )
104 if( i != 0 ) printf( ", " );
105 printf( "%u", Conf_ListenPorts[i] );
108 pwd = getpwuid( Conf_UID );
109 if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
110 else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
111 grp = getgrgid( Conf_GID );
112 if( grp ) printf( " ServerGID = %s\n", grp->gr_name );
113 else printf( " ServerGID = %ld\n", (LONG)Conf_GID );
114 printf( " PingTimeout = %d\n", Conf_PingTimeout );
115 printf( " PongTimeout = %d\n", Conf_PongTimeout );
116 printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
117 printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
118 if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
119 else printf( " MaxConnections = -1\n" );
120 if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins );
121 else printf( " MaxJoins = -1\n" );
124 for( i = 0; i < Conf_Oper_Count; i++ )
126 if( ! Conf_Oper[i].name[0] ) continue;
128 /* Valid "Operator" section */
129 puts( "[OPERATOR]" );
130 printf( " Name = %s\n", Conf_Oper[i].name );
131 printf( " Password = %s\n", Conf_Oper[i].pwd );
135 for( i = 0; i < Conf_Server_Count; i++ )
137 if( ! Conf_Server[i].name[0] ) continue;
139 /* Valid "Server" section */
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 /* Valid "Channel" section */
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 /* Initialize configuration variables with default values. */
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 = -1;
204 /* Read configuration file. */
206 CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
210 fd = fopen( NGIRCd_ConfFile, "r" );
213 /* No configuration file found! */
214 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
215 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
219 Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
222 strcpy( section, "" );
225 if( ! fgets( str, LINE_LEN, fd )) break;
229 /* Skip comments and empty lines */
230 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
232 /* Is this the beginning of a new section? */
233 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
235 strcpy( section, str );
236 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
237 if( strcasecmp( section, "[OPERATOR]" ) == 0 )
239 if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
242 /* Initialize new operator structure */
243 strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
244 strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
249 if( strcasecmp( section, "[SERVER]" ) == 0 )
251 if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
254 /* Initialize new server structure */
255 strcpy( Conf_Server[Conf_Server_Count].host, "" );
256 strcpy( Conf_Server[Conf_Server_Count].ip, "" );
257 strcpy( Conf_Server[Conf_Server_Count].name, "" );
258 strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
259 strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
260 Conf_Server[Conf_Server_Count].port = 0;
261 Conf_Server[Conf_Server_Count].group = -1;
262 Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
263 Conf_Server[Conf_Server_Count].res_stat = NULL;
268 if( strcasecmp( section, "[CHANNEL]" ) == 0 )
270 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
273 /* Initialize new channel structure */
274 strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
275 strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
276 strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
277 Conf_Channel_Count++;
281 Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
284 if( section[0] == 0x1 ) continue;
286 /* Split line into variable name and parameters */
287 ptr = strchr( str, '=' );
290 Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
294 var = str; ngt_TrimStr( var );
295 arg = ptr + 1; ngt_TrimStr( arg );
297 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
298 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
299 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
300 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
301 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
306 /* If there are no ports configured use the default: 6667 */
307 if( Conf_ListenPorts_Count < 1 )
309 Conf_ListenPorts_Count = 1;
310 Conf_ListenPorts[0] = 6667;
316 Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
324 assert( Var != NULL );
325 assert( Arg != NULL );
327 if( strcasecmp( Var, "Name" ) == 0 )
330 strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
331 Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
332 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
335 if( strcasecmp( Var, "Info" ) == 0 )
337 /* Info text of server */
338 strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
339 Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
340 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
343 if( strcasecmp( Var, "Password" ) == 0 )
345 /* Global server password */
346 strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
347 Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
348 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
351 if( strcasecmp( Var, "AdminInfo1" ) == 0 )
353 /* Administrative info #1 */
354 strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
355 Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
356 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
359 if( strcasecmp( Var, "AdminInfo2" ) == 0 )
361 /* Administrative info #2 */
362 strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
363 Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
364 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
367 if( strcasecmp( Var, "AdminEMail" ) == 0 )
369 /* Administrative email contact */
370 strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
371 Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
372 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
375 if( strcasecmp( Var, "Ports" ) == 0 )
377 /* Ports on that the server should listen. More port numbers
378 * must be separated by "," */
379 ptr = strtok( Arg, "," );
384 if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
387 if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port;
388 else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
390 ptr = strtok( NULL, "," );
394 if( strcasecmp( Var, "MotdFile" ) == 0 )
396 /* "Message of the day" (MOTD) file */
397 strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
398 Conf_MotdFile[FNAME_LEN - 1] = '\0';
399 if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
402 if( strcasecmp( Var, "ServerUID" ) == 0 )
404 /* UID the daemon should switch to */
405 pwd = getpwnam( Arg );
406 if( pwd ) Conf_UID = pwd->pw_uid;
410 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
413 Conf_UID = (UINT)atoi( Arg );
417 if( strcasecmp( Var, "ServerGID" ) == 0 )
419 /* GID the daemon should use */
420 grp = getgrnam( Arg );
421 if( grp ) Conf_GID = grp->gr_gid;
425 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
428 Conf_GID = (UINT)atoi( Arg );
432 if( strcasecmp( Var, "PingTimeout" ) == 0 )
435 Conf_PingTimeout = atoi( Arg );
436 if( Conf_PingTimeout < 5 )
438 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
439 Conf_PingTimeout = 5;
443 if( strcasecmp( Var, "PongTimeout" ) == 0 )
446 Conf_PongTimeout = atoi( Arg );
447 if( Conf_PongTimeout < 5 )
449 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
450 Conf_PongTimeout = 5;
454 if( strcasecmp( Var, "ConnectRetry" ) == 0 )
456 /* Seconds between connection attempts to other servers */
457 Conf_ConnectRetry = atoi( Arg );
458 if( Conf_ConnectRetry < 5 )
460 Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
461 Conf_ConnectRetry = 5;
465 if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
467 /* Are IRC operators allowed to use MODE in channels they aren't Op in? */
468 if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
469 else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
470 else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
471 else Conf_OperCanMode = FALSE;
474 if( strcasecmp( Var, "MaxConnections" ) == 0 )
476 /* Maximum number of connections. Values <= 0 are equal to "no 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 );
484 if( strcasecmp( Var, "MaxJoins" ) == 0 )
486 /* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */
488 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
491 Conf_MaxJoins = atoi( Arg );
495 Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
496 } /* Handle_GLOBAL */
500 Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
503 assert( Var != NULL );
504 assert( Arg != NULL );
505 assert( Conf_Oper_Count > 0 );
507 if( strcasecmp( Var, "Name" ) == 0 )
509 /* Name of IRC operator */
510 strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
511 Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
512 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
515 if( strcasecmp( Var, "Password" ) == 0 )
517 /* Password of IRC operator */
518 strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
519 Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
520 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
524 Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
525 } /* Handle_OPERATOR */
529 Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
534 assert( Var != NULL );
535 assert( Arg != NULL );
537 if( strcasecmp( Var, "Host" ) == 0 )
539 /* Hostname of the server */
540 strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
541 Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
542 if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
545 if( strcasecmp( Var, "Name" ) == 0 )
547 /* Name of the server ("Nick"/"ID") */
548 strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
549 Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
550 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
553 if( strcasecmp( Var, "MyPassword" ) == 0 )
555 /* Password of this server which is sent to the peer */
556 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
557 Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
558 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
561 if( strcasecmp( Var, "PeerPassword" ) == 0 )
563 /* Passwort of the peer which must be received */
564 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
565 Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
566 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
569 if( strcasecmp( Var, "Port" ) == 0 )
571 /* Port to which this server should connect */
573 if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
574 else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
577 if( strcasecmp( Var, "Group" ) == 0 )
581 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
584 Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
588 Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
589 } /* Handle_SERVER */
593 Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
596 assert( Var != NULL );
597 assert( Arg != NULL );
599 if( strcasecmp( Var, "Name" ) == 0 )
601 /* Name of the channel */
602 strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
603 Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
604 if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
607 if( strcasecmp( Var, "Modes" ) == 0 )
610 strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
611 Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
612 if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
615 if( strcasecmp( Var, "Topic" ) == 0 )
618 strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
619 Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
620 if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
624 Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
625 } /* Handle_CHANNEL */
629 Validate_Config( VOID )
631 /* Validate configuration settings. */
633 if( ! Conf_ServerName[0] )
635 /* No server name configured! */
636 Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
637 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
642 if( ! Conf_ServerAdminMail[0] )
644 /* No administrative contact configured! */
645 Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
646 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
651 if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
653 /* No administrative information configured! */
654 Log( LOG_WARNING, "No administrative information configured but required by RFC!" );
656 } /* Validate_Config */
660 LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
662 LOCAL VOID Config_Error( Level, Format, va_alist )
668 /* Error! Write to console and/or logfile. */
670 CHAR msg[MAX_LOG_MSG_LEN];
673 assert( Format != NULL );
676 va_start( ap, Format );
680 vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
683 /* During "normal operations" the log functions of the daemon should
684 * be used, but during testing of the configuration file, all messages
685 * should go directly to the console: */
686 if( Use_Log ) Log( Level, "%s", msg );