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.49 2002/12/26 16:25:43 alex Exp $";
29 #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(( BOOLEAN TestOnly ));
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, ... ));
68 Validate_Config( FALSE );
75 /* Read configuration, validate and output it. */
85 Validate_Config( TRUE );
87 /* If stdin is a valid tty wait for a key: */
88 if( isatty( fileno( stdout )))
90 puts( "OK, press enter to see a dump of your service configuration ..." );
93 else puts( "Ok, dump of your server configuration follows:\n" );
96 printf( " ServerName = %s\n", Conf_ServerName );
97 printf( " ServerInfo = %s\n", Conf_ServerInfo );
98 printf( " ServerPwd = %s\n", Conf_ServerPwd );
99 printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 );
100 printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
101 printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
102 printf( " MotdFile = %s\n", Conf_MotdFile );
103 printf( " Ports = " );
104 for( i = 0; i < Conf_ListenPorts_Count; i++ )
106 if( i != 0 ) printf( ", " );
107 printf( "%u", Conf_ListenPorts[i] );
110 pwd = getpwuid( Conf_UID );
111 if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
112 else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
113 grp = getgrgid( Conf_GID );
114 if( grp ) printf( " ServerGID = %s\n", grp->gr_name );
115 else printf( " ServerGID = %ld\n", (LONG)Conf_GID );
116 printf( " PingTimeout = %d\n", Conf_PingTimeout );
117 printf( " PongTimeout = %d\n", Conf_PongTimeout );
118 printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
119 printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
120 if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
121 else printf( " MaxConnections = -1\n" );
122 if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins );
123 else printf( " MaxJoins = -1\n" );
126 for( i = 0; i < Conf_Oper_Count; i++ )
128 if( ! Conf_Oper[i].name[0] ) continue;
130 /* Valid "Operator" section */
131 puts( "[OPERATOR]" );
132 printf( " Name = %s\n", Conf_Oper[i].name );
133 printf( " Password = %s\n", Conf_Oper[i].pwd );
137 for( i = 0; i < Conf_Server_Count; i++ )
139 if( ! Conf_Server[i].name[0] ) continue;
141 /* Valid "Server" section */
143 printf( " Name = %s\n", Conf_Server[i].name );
144 printf( " Host = %s\n", Conf_Server[i].host );
145 printf( " Port = %d\n", Conf_Server[i].port );
146 printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
147 printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
148 printf( " Group = %d\n", Conf_Server[i].group );
152 for( i = 0; i < Conf_Channel_Count; i++ )
154 if( ! Conf_Channel[i].name[0] ) continue;
156 /* Valid "Channel" section */
158 printf( " Name = %s\n", Conf_Channel[i].name );
159 printf( " Modes = %s\n", Conf_Channel[i].modes );
160 printf( " Topic = %s\n", Conf_Channel[i].topic );
171 /* Initialize configuration variables with default values. */
173 strcpy( Conf_ServerName, "" );
174 sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
175 strcpy( Conf_ServerPwd, "" );
177 strcpy( Conf_ServerAdmin1, "" );
178 strcpy( Conf_ServerAdmin2, "" );
179 strcpy( Conf_ServerAdminMail, "" );
181 strcpy( Conf_MotdFile, SYSCONFDIR );
182 strcat( Conf_MotdFile, MOTD_FILE );
184 Conf_ListenPorts_Count = 0;
186 Conf_UID = Conf_GID = 0;
188 Conf_PingTimeout = 120;
189 Conf_PongTimeout = 20;
191 Conf_ConnectRetry = 60;
194 Conf_Server_Count = 0;
195 Conf_Channel_Count = 0;
197 Conf_OperCanMode = FALSE;
199 Conf_MaxConnections = -1;
207 /* Read configuration file. */
209 CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
213 fd = fopen( NGIRCd_ConfFile, "r" );
216 /* No configuration file found! */
217 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
218 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
222 Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
225 strcpy( section, "" );
228 if( ! fgets( str, LINE_LEN, fd )) break;
232 /* Skip comments and empty lines */
233 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
235 /* Is this the beginning of a new section? */
236 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
238 strcpy( section, str );
239 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
240 if( strcasecmp( section, "[OPERATOR]" ) == 0 )
242 if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
245 /* Initialize new operator structure */
246 strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
247 strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
252 if( strcasecmp( section, "[SERVER]" ) == 0 )
254 if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
257 /* Initialize new server structure */
258 strcpy( Conf_Server[Conf_Server_Count].host, "" );
259 strcpy( Conf_Server[Conf_Server_Count].ip, "" );
260 strcpy( Conf_Server[Conf_Server_Count].name, "" );
261 strcpy( Conf_Server[Conf_Server_Count].pwd_in, "" );
262 strcpy( Conf_Server[Conf_Server_Count].pwd_out, "" );
263 Conf_Server[Conf_Server_Count].port = 0;
264 Conf_Server[Conf_Server_Count].group = -1;
265 Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
266 Conf_Server[Conf_Server_Count].res_stat = NULL;
271 if( strcasecmp( section, "[CHANNEL]" ) == 0 )
273 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
276 /* Initialize new channel structure */
277 strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
278 strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
279 strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
280 Conf_Channel_Count++;
284 Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
287 if( section[0] == 0x1 ) continue;
289 /* Split line into variable name and parameters */
290 ptr = strchr( str, '=' );
293 Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
297 var = str; ngt_TrimStr( var );
298 arg = ptr + 1; ngt_TrimStr( arg );
300 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
301 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
302 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
303 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
304 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
309 /* If there are no ports configured use the default: 6667 */
310 if( Conf_ListenPorts_Count < 1 )
312 Conf_ListenPorts_Count = 1;
313 Conf_ListenPorts[0] = 6667;
319 Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
327 assert( Var != NULL );
328 assert( Arg != NULL );
330 if( strcasecmp( Var, "Name" ) == 0 )
333 if( strlcpy( Conf_ServerName, Arg, sizeof( Conf_ServerName )) >= sizeof( Conf_ServerName )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
336 if( strcasecmp( Var, "Info" ) == 0 )
338 /* Info text of server */
339 if( strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo )) >= sizeof( Conf_ServerInfo )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Info\" too long!", NGIRCd_ConfFile, Line );
342 if( strcasecmp( Var, "Password" ) == 0 )
344 /* Global server password */
345 if( strlcpy( Conf_ServerPwd, Arg, sizeof( Conf_ServerPwd )) >= sizeof( Conf_ServerPwd )) 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 if( strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 )) >= sizeof( Conf_ServerAdmin1 )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo1\" too long!", NGIRCd_ConfFile, Line );
354 if( strcasecmp( Var, "AdminInfo2" ) == 0 )
356 /* Administrative info #2 */
357 if( strlcpy( Conf_ServerAdmin2, Arg, sizeof( Conf_ServerAdmin2 )) >= sizeof( Conf_ServerAdmin2 )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminInfo2\" too long!", NGIRCd_ConfFile, Line );
360 if( strcasecmp( Var, "AdminEMail" ) == 0 )
362 /* Administrative email contact */
363 if( strlcpy( Conf_ServerAdminMail, Arg, sizeof( Conf_ServerAdminMail )) >= sizeof( Conf_ServerAdminMail )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"AdminEMail\" too long!", NGIRCd_ConfFile, Line );
366 if( strcasecmp( Var, "Ports" ) == 0 )
368 /* Ports on that the server should listen. More port numbers
369 * must be separated by "," */
370 ptr = strtok( Arg, "," );
375 if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
378 if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port;
379 else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
381 ptr = strtok( NULL, "," );
385 if( strcasecmp( Var, "MotdFile" ) == 0 )
387 /* "Message of the day" (MOTD) file */
388 if( strlcpy( Conf_MotdFile, Arg, sizeof( Conf_MotdFile )) >= sizeof( Conf_MotdFile )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MotdFile\" too long!", NGIRCd_ConfFile, Line );
391 if( strcasecmp( Var, "ServerUID" ) == 0 )
393 /* UID the daemon should switch to */
394 pwd = getpwnam( Arg );
395 if( pwd ) Conf_UID = pwd->pw_uid;
399 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerUID\" is not a number!", NGIRCd_ConfFile, Line );
402 Conf_UID = (UINT)atoi( Arg );
406 if( strcasecmp( Var, "ServerGID" ) == 0 )
408 /* GID the daemon should use */
409 grp = getgrnam( Arg );
410 if( grp ) Conf_GID = grp->gr_gid;
414 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"ServerGID\" is not a number!", NGIRCd_ConfFile, Line );
417 Conf_GID = (UINT)atoi( Arg );
421 if( strcasecmp( Var, "PingTimeout" ) == 0 )
424 Conf_PingTimeout = atoi( Arg );
425 if( Conf_PingTimeout < 5 )
427 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!", NGIRCd_ConfFile, Line );
428 Conf_PingTimeout = 5;
432 if( strcasecmp( Var, "PongTimeout" ) == 0 )
435 Conf_PongTimeout = atoi( Arg );
436 if( Conf_PongTimeout < 5 )
438 Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!", NGIRCd_ConfFile, Line );
439 Conf_PongTimeout = 5;
443 if( strcasecmp( Var, "ConnectRetry" ) == 0 )
445 /* Seconds between connection attempts to other servers */
446 Conf_ConnectRetry = atoi( Arg );
447 if( Conf_ConnectRetry < 5 )
449 Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!", NGIRCd_ConfFile, Line );
450 Conf_ConnectRetry = 5;
454 if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
456 /* Are IRC operators allowed to use MODE in channels they aren't Op in? */
457 if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
458 else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
459 else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
460 else Conf_OperCanMode = FALSE;
463 if( strcasecmp( Var, "MaxConnections" ) == 0 )
465 /* Maximum number of connections. Values <= 0 are equal to "no limit". */
467 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxConnections\" is not a number!", NGIRCd_ConfFile, Line );
470 Conf_MaxConnections = atol( Arg );
473 if( strcasecmp( Var, "MaxJoins" ) == 0 )
475 /* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */
477 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line );
480 Conf_MaxJoins = atoi( Arg );
484 Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
485 } /* Handle_GLOBAL */
489 Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
492 assert( Var != NULL );
493 assert( Arg != NULL );
494 assert( Conf_Oper_Count > 0 );
496 if( strcasecmp( Var, "Name" ) == 0 )
498 /* Name of IRC operator */
499 if( strlcpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, sizeof( Conf_Oper[Conf_Oper_Count - 1].name )) >= sizeof( Conf_Oper[Conf_Oper_Count - 1].name )) 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 if( strlcpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, sizeof( Conf_Oper[Conf_Oper_Count - 1].pwd )) >= sizeof( Conf_Oper[Conf_Oper_Count - 1].pwd )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Password\" too long!", NGIRCd_ConfFile, Line );
509 Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
510 } /* Handle_OPERATOR */
514 Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
519 assert( Var != NULL );
520 assert( Arg != NULL );
522 if( strcasecmp( Var, "Host" ) == 0 )
524 /* Hostname of the server */
525 if( strlcpy( Conf_Server[Conf_Server_Count - 1].host, Arg, sizeof( Conf_Server[Conf_Server_Count - 1].host )) >= sizeof( Conf_Server[Conf_Server_Count - 1].host )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Host\" too long!", NGIRCd_ConfFile, Line );
528 if( strcasecmp( Var, "Name" ) == 0 )
530 /* Name of the server ("Nick"/"ID") */
531 if( strlcpy( Conf_Server[Conf_Server_Count - 1].name, Arg, sizeof( Conf_Server[Conf_Server_Count - 1].name )) >= sizeof( Conf_Server[Conf_Server_Count - 1].name )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
534 if( strcasecmp( Var, "MyPassword" ) == 0 )
536 /* Password of this server which is sent to the peer */
537 if( strlcpy( Conf_Server[Conf_Server_Count - 1].pwd_in, Arg, sizeof( Conf_Server[Conf_Server_Count - 1].pwd_in )) >= sizeof( Conf_Server[Conf_Server_Count - 1].pwd_in )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MyPassword\" too long!", NGIRCd_ConfFile, Line );
540 if( strcasecmp( Var, "PeerPassword" ) == 0 )
542 /* Passwort of the peer which must be received */
543 if( strlcpy( Conf_Server[Conf_Server_Count - 1].pwd_out, Arg, sizeof( Conf_Server[Conf_Server_Count - 1].pwd_out )) >= sizeof( Conf_Server[Conf_Server_Count - 1].pwd_out )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"PeerPassword\" too long!", NGIRCd_ConfFile, Line );
546 if( strcasecmp( Var, "Port" ) == 0 )
548 /* Port to which this server should connect */
550 if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
551 else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
554 if( strcasecmp( Var, "Group" ) == 0 )
558 if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Group\" is not a number!", NGIRCd_ConfFile, Line );
561 Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
565 Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
566 } /* Handle_SERVER */
570 Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
573 assert( Var != NULL );
574 assert( Arg != NULL );
576 if( strcasecmp( Var, "Name" ) == 0 )
578 /* Name of the channel */
579 if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].name )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].name )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Name\" too long!", NGIRCd_ConfFile, Line );
582 if( strcasecmp( Var, "Modes" ) == 0 )
585 if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].modes )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].modes )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Modes\" too long!", NGIRCd_ConfFile, Line );
588 if( strcasecmp( Var, "Topic" ) == 0 )
591 if( strlcpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, sizeof( Conf_Channel[Conf_Channel_Count - 1].topic )) >= sizeof( Conf_Channel[Conf_Channel_Count - 1].topic )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"Topic\" too long!", NGIRCd_ConfFile, Line );
595 Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
596 } /* Handle_CHANNEL */
600 Validate_Config( BOOLEAN Configtest )
602 /* Validate configuration settings. */
604 if( ! Conf_ServerName[0] )
606 /* No server name configured! */
607 Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
610 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
616 if( ! Conf_ServerAdminMail[0] )
618 /* No administrative contact configured! */
619 Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
622 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
628 if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
630 /* No administrative information configured! */
631 Config_Error( LOG_WARNING, "No administrative information configured but required by RFC!" );
634 if(( Conf_MaxConnections > (LONG)FD_SETSIZE ) || ( Conf_MaxConnections < 1 ))
636 Conf_MaxConnections = (LONG)FD_SETSIZE;
637 Config_Error( LOG_ERR, "Setting MaxConnections to %ld, select() can't handle more file descriptors!", Conf_MaxConnections );
640 Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" );
642 } /* Validate_Config */
646 LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
648 LOCAL VOID Config_Error( Level, Format, va_alist )
654 /* Error! Write to console and/or logfile. */
656 CHAR msg[MAX_LOG_MSG_LEN];
659 assert( Format != NULL );
662 va_start( ap, Format );
666 vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
669 /* During "normal operations" the log functions of the daemon should
670 * be used, but during testing of the configuration file, all messages
671 * should go directly to the console: */
672 if( Use_Log ) Log( Level, "%s", msg );