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.42 2002/12/12 11:26:08 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" );
122 for( i = 0; i < Conf_Oper_Count; i++ )
124 if( ! Conf_Oper[i].name[0] ) continue;
126 /* Valid "Operator" section */
127 puts( "[OPERATOR]" );
128 printf( " Name = %s\n", Conf_Oper[i].name );
129 printf( " Password = %s\n", Conf_Oper[i].pwd );
133 for( i = 0; i < Conf_Server_Count; i++ )
135 if( ! Conf_Server[i].name[0] ) continue;
137 /* Valid "Server" section */
139 printf( " Name = %s\n", Conf_Server[i].name );
140 printf( " Host = %s\n", Conf_Server[i].host );
141 printf( " Port = %d\n", Conf_Server[i].port );
142 printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
143 printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
144 printf( " Group = %d\n", Conf_Server[i].group );
148 for( i = 0; i < Conf_Channel_Count; i++ )
150 if( ! Conf_Channel[i].name[0] ) continue;
152 /* Valid "Channel" section */
154 printf( " Name = %s\n", Conf_Channel[i].name );
155 printf( " Modes = %s\n", Conf_Channel[i].modes );
156 printf( " Topic = %s\n", Conf_Channel[i].topic );
167 /* Initialize configuration variables with default values. */
169 strcpy( Conf_ServerName, "" );
170 sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
171 strcpy( Conf_ServerPwd, "" );
173 strcpy( Conf_ServerAdmin1, "" );
174 strcpy( Conf_ServerAdmin2, "" );
175 strcpy( Conf_ServerAdminMail, "" );
177 strcpy( Conf_MotdFile, MOTD_FILE );
179 Conf_ListenPorts_Count = 0;
181 Conf_UID = Conf_GID = 0;
183 Conf_PingTimeout = 120;
184 Conf_PongTimeout = 20;
186 Conf_ConnectRetry = 60;
189 Conf_Server_Count = 0;
190 Conf_Channel_Count = 0;
192 Conf_OperCanMode = FALSE;
194 Conf_MaxConnections = 0;
201 /* Read configuration file. */
203 CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
207 fd = fopen( NGIRCd_ConfFile, "r" );
210 /* No configuration file found! */
211 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
212 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
216 Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
219 strcpy( section, "" );
222 if( ! fgets( str, LINE_LEN, fd )) break;
226 /* Skip comments and empty lines */
227 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
229 /* Is this the beginning of a new section? */
230 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
232 strcpy( section, str );
233 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
234 if( strcasecmp( section, "[OPERATOR]" ) == 0 )
236 if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
239 /* Initialize new operator structure */
240 strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
241 strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
246 if( strcasecmp( section, "[SERVER]" ) == 0 )
248 if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
251 /* Initialize new server structure */
252 strcpy( Conf_Server[Conf_Server_Count].host, "" );
253 strcpy( Conf_Server[Conf_Server_Count].ip, "" );
254 strcpy( Conf_Server[Conf_Server_Count].name, "" );
255 strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
256 strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
257 Conf_Server[Conf_Server_Count].port = 0;
258 Conf_Server[Conf_Server_Count].group = -1;
259 Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
260 Conf_Server[Conf_Server_Count].res_stat = NULL;
265 if( strcasecmp( section, "[CHANNEL]" ) == 0 )
267 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
270 /* Initialize new channel structure */
271 strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
272 strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
273 strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
274 Conf_Channel_Count++;
278 Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
281 if( section[0] == 0x1 ) continue;
283 /* Split line into variable name and parameters */
284 ptr = strchr( str, '=' );
287 Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
291 var = str; ngt_TrimStr( var );
292 arg = ptr + 1; ngt_TrimStr( arg );
294 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
295 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
296 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
297 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
298 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
303 /* If there are no ports configured use the default: 6667 */
304 if( Conf_ListenPorts_Count < 1 )
306 Conf_ListenPorts_Count = 1;
307 Conf_ListenPorts[0] = 6667;
313 Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
321 assert( Var != NULL );
322 assert( Arg != NULL );
324 if( strcasecmp( Var, "Name" ) == 0 )
327 strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
328 Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
329 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
332 if( strcasecmp( Var, "Info" ) == 0 )
334 /* Info text of server */
335 strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
336 Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
337 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
340 if( strcasecmp( Var, "Password" ) == 0 )
342 /* Global server password */
343 strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
344 Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
345 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
348 if( strcasecmp( Var, "AdminInfo1" ) == 0 )
350 /* Administrative info #1 */
351 strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
352 Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
353 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
356 if( strcasecmp( Var, "AdminInfo2" ) == 0 )
358 /* Administrative info #2 */
359 strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
360 Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
361 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
364 if( strcasecmp( Var, "AdminEMail" ) == 0 )
366 /* Administrative email contact */
367 strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
368 Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
369 if( strlen( Arg ) > CLIENT_INFO_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
372 if( strcasecmp( Var, "Ports" ) == 0 )
374 /* Ports on that the server should listen. More port numbers
375 * must be separated by "," */
376 ptr = strtok( Arg, "," );
381 if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
384 if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port;
385 else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
387 ptr = strtok( NULL, "," );
391 if( strcasecmp( Var, "MotdFile" ) == 0 )
393 /* "Message of the day" (MOTD) file */
394 strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
395 Conf_MotdFile[FNAME_LEN - 1] = '\0';
396 if( strlen( Arg ) > FNAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
399 if( strcasecmp( Var, "ServerUID" ) == 0 )
401 /* UID the daemon should switch to */
402 pwd = getpwnam( Arg );
403 if( pwd ) Conf_UID = pwd->pw_uid;
407 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
410 Conf_UID = (UINT)atoi( Arg );
414 if( strcasecmp( Var, "ServerGID" ) == 0 )
416 /* GID the daemon should use */
417 grp = getgrnam( Arg );
418 if( grp ) Conf_GID = grp->gr_gid;
422 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
425 Conf_GID = (UINT)atoi( Arg );
429 if( strcasecmp( Var, "PingTimeout" ) == 0 )
432 Conf_PingTimeout = atoi( Arg );
433 if( Conf_PingTimeout < 5 )
435 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
436 Conf_PingTimeout = 5;
440 if( strcasecmp( Var, "PongTimeout" ) == 0 )
443 Conf_PongTimeout = atoi( Arg );
444 if( Conf_PongTimeout < 5 )
446 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
447 Conf_PongTimeout = 5;
451 if( strcasecmp( Var, "ConnectRetry" ) == 0 )
453 /* Seconds between connection attempts to other servers */
454 Conf_ConnectRetry = atoi( Arg );
455 if( Conf_ConnectRetry < 5 )
457 Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
458 Conf_ConnectRetry = 5;
462 if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
464 /* Are IRC operators allowed to use MODE in channels they aren't Op in? */
465 if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
466 else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
467 else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
468 else Conf_OperCanMode = FALSE;
471 if( strcasecmp( Var, "MaxConnections" ) == 0 )
473 /* Maximum number of connections. Values <= 0 are equal to "no limit". */
475 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
478 Conf_MaxConnections = atol( Arg );
482 Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
483 } /* Handle_GLOBAL */
487 Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
490 assert( Var != NULL );
491 assert( Arg != NULL );
492 assert( Conf_Oper_Count > 0 );
494 if( strcasecmp( Var, "Name" ) == 0 )
496 /* Name of IRC operator */
497 strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
498 Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
499 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
502 if( strcasecmp( Var, "Password" ) == 0 )
504 /* Password of IRC operator */
505 strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
506 Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
507 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
511 Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
512 } /* Handle_OPERATOR */
516 Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
521 assert( Var != NULL );
522 assert( Arg != NULL );
524 if( strcasecmp( Var, "Host" ) == 0 )
526 /* Hostname of the server */
527 strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
528 Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
529 if( strlen( Arg ) > HOST_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
532 if( strcasecmp( Var, "Name" ) == 0 )
534 /* Name of the server ("Nick"/"ID") */
535 strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
536 Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
537 if( strlen( Arg ) > CLIENT_ID_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
540 if( strcasecmp( Var, "MyPassword" ) == 0 )
542 /* Password of this server which is sent to the peer */
543 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, CLIENT_PASS_LEN - 1 );
544 Conf_Server[Conf_Server_Count - 1].pwd_in[CLIENT_PASS_LEN - 1] = '\0';
545 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
548 if( strcasecmp( Var, "PeerPassword" ) == 0 )
550 /* Passwort of the peer which must be received */
551 strncpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, CLIENT_PASS_LEN - 1 );
552 Conf_Server[Conf_Server_Count - 1].pwd_out[CLIENT_PASS_LEN - 1] = '\0';
553 if( strlen( Arg ) > CLIENT_PASS_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
556 if( strcasecmp( Var, "Port" ) == 0 )
558 /* Port to which this server should connect */
560 if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
561 else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
564 if( strcasecmp( Var, "Group" ) == 0 )
568 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
571 Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
575 Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
576 } /* Handle_SERVER */
580 Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
583 assert( Var != NULL );
584 assert( Arg != NULL );
586 if( strcasecmp( Var, "Name" ) == 0 )
588 /* Name of the channel */
589 strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
590 Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
591 if( strlen( Arg ) > CHANNEL_NAME_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
594 if( strcasecmp( Var, "Modes" ) == 0 )
597 strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
598 Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
599 if( strlen( Arg ) > CHANNEL_MODE_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
602 if( strcasecmp( Var, "Topic" ) == 0 )
605 strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
606 Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
607 if( strlen( Arg ) > CHANNEL_TOPIC_LEN - 1 ) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
611 Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
612 } /* Handle_CHANNEL */
616 Validate_Config( VOID )
618 /* Validate configuration settings. */
620 if( ! Conf_ServerName[0] )
622 /* No server name configured! */
623 Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
624 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
629 if( ! Conf_ServerAdminMail[0] )
631 /* No administrative contact configured! */
632 Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
633 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
638 if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
640 /* No administrative information configured! */
641 Log( LOG_WARNING, "No administrative information configured but required by RFC!" );
643 } /* Validate_Config */
647 LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
649 LOCAL VOID Config_Error( Level, Format, va_alist )
655 /* Error! Write to console and/or logfile. */
657 CHAR msg[MAX_LOG_MSG_LEN];
660 assert( Format != NULL );
663 va_start( ap, Format );
667 vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
670 /* During "normal operations" the log functions of the daemon should
671 * be used, but during testing of the configuration file, all messages
672 * should go directly to the console: */
673 if( Use_Log ) Log( Level, "%s", msg );