]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.c
21ba90f891a815e36d1c6550f7b6d8c0ae072409
[ngircd-alex.git] / src / ngircd / conf.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
4  *
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.
11  *
12  * $Id: conf.c,v 1.31 2002/10/03 21:49:59 alex Exp $
13  *
14  * conf.h: Konfiguration des ngircd
15  */
16
17
18 #include "portab.h"
19
20 #include "imp.h"
21 #include <assert.h>
22 #include <errno.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <unistd.h>
28
29 #include "ngircd.h"
30 #include "conn.h"
31 #include "client.h"
32 #include "defines.h"
33 #include "log.h"
34 #include "resolve.h"
35 #include "tool.h"
36
37 #include "exp.h"
38 #include "conf.h"
39
40
41 LOCAL BOOLEAN Use_Log = TRUE;
42
43
44 LOCAL VOID Set_Defaults PARAMS(( VOID ));
45 LOCAL VOID Read_Config PARAMS(( VOID ));
46 LOCAL VOID Validate_Config PARAMS(( VOID ));
47
48 LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
49 LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
50 LOCAL VOID Handle_SERVER PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
51 LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg ));
52
53 LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... ));
54
55
56 GLOBAL VOID
57 Conf_Init( VOID )
58 {
59         Set_Defaults( );
60         Read_Config( );
61         Validate_Config( );
62 } /* Config_Init */
63
64
65 GLOBAL INT
66 Conf_Test( VOID )
67 {
68         /* Konfiguration einlesen, ueberpruefen und ausgeben. */
69
70         INT i;
71
72         Use_Log = FALSE;
73         Set_Defaults( );
74
75         printf( "Using \"%s\" as configuration file ...\n", NGIRCd_ConfFile );
76         Read_Config( );
77
78         /* Wenn stdin ein ein TTY ist: auf Taste warten */
79         if( isatty( fileno( stdout )))
80         {
81                 puts( "OK, press enter to see a dump of your service configuration ..." );
82                 getchar( );
83         }
84         else puts( "Ok, dump of your server configuration follows:\n" );
85
86         puts( "[GLOBAL]" );
87         printf( "  ServerName = %s\n", Conf_ServerName );
88         printf( "  ServerInfo = %s\n", Conf_ServerInfo );
89         printf( "  ServerPwd = %s\n", Conf_ServerPwd );
90         printf( "  AdminInfo1 = %s\n", Conf_ServerAdmin1 );
91         printf( "  AdminInfo2 = %s\n", Conf_ServerAdmin2 );
92         printf( "  AdminEMail = %s\n", Conf_ServerAdminMail );
93         printf( "  MotdFile = %s\n", Conf_MotdFile );
94         printf( "  ListenPorts = " );
95         for( i = 0; i < Conf_ListenPorts_Count; i++ )
96         {
97                 if( i != 0 ) printf( ", " );
98                 printf( "%u", Conf_ListenPorts[i] );
99         }
100         puts( "" );
101         printf( "  ServerUID = %ld\n", (INT32)Conf_UID );
102         printf( "  ServerGID = %ld\n", (INT32)Conf_GID );
103         printf( "  PingTimeout = %d\n", Conf_PingTimeout );
104         printf( "  PongTimeout = %d\n", Conf_PongTimeout );
105         printf( "  ConnectRetry = %d\n", Conf_ConnectRetry );
106         printf( "  OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
107         puts( "" );
108
109         for( i = 0; i < Conf_Oper_Count; i++ )
110         {
111                 if( ! Conf_Oper[i].name[0] ) continue;
112                 
113                 /* gueltiger Operator-Block: ausgeben */
114                 puts( "[OPERATOR]" );
115                 printf( "  Name = %s\n", Conf_Oper[i].name );
116                 printf( "  Password = %s\n", Conf_Oper[i].pwd );
117                 puts( "" );
118         }
119
120         for( i = 0; i < Conf_Server_Count; i++ )
121         {
122                 if( ! Conf_Server[i].name[0] ) continue;
123                 if( ! Conf_Server[i].host[0] ) continue;
124                 
125                 /* gueltiger Server-Block: ausgeben */
126                 puts( "[SERVER]" );
127                 printf( "  Name = %s\n", Conf_Server[i].name );
128                 printf( "  Host = %s\n", Conf_Server[i].host );
129                 printf( "  Port = %d\n", Conf_Server[i].port );
130                 printf( "  Password = %s\n", Conf_Server[i].pwd );
131                 printf( "  Group = %d\n", Conf_Server[i].group );
132                 puts( "" );
133         }
134
135         for( i = 0; i < Conf_Channel_Count; i++ )
136         {
137                 if( ! Conf_Channel[i].name[0] ) continue;
138                 
139                 /* gueltiger Channel-Block: ausgeben */
140                 puts( "[CHANNEL]" );
141                 printf( "  Name = %s\n", Conf_Channel[i].name );
142                 printf( "  Modes = %s\n", Conf_Channel[i].modes );
143                 printf( "  Topic = %s\n", Conf_Channel[i].topic );
144                 puts( "" );
145         }
146         
147         return 0;
148 } /* Conf_Test */
149
150
151 LOCAL VOID
152 Set_Defaults( VOID )
153 {
154         /* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */
155
156         strcpy( Conf_ServerName, "" );
157         sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION );
158         strcpy( Conf_ServerPwd, "" );
159
160         strcpy( Conf_ServerAdmin1, "" );
161         strcpy( Conf_ServerAdmin2, "" );
162         strcpy( Conf_ServerAdminMail, "" );
163
164         strcpy( Conf_MotdFile, MOTD_FILE );
165
166         Conf_ListenPorts_Count = 0;
167
168         Conf_UID = Conf_GID = 0;
169         
170         Conf_PingTimeout = 120;
171         Conf_PongTimeout = 20;
172
173         Conf_ConnectRetry = 60;
174
175         Conf_Oper_Count = 0;
176         Conf_Server_Count = 0;
177         Conf_Channel_Count = 0;
178
179         Conf_OperCanMode = FALSE;
180 } /* Set_Defaults */
181
182
183 LOCAL VOID
184 Read_Config( VOID )
185 {
186         /* Konfigurationsdatei einlesen. */
187
188         CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
189         INT line;
190         FILE *fd;
191
192         fd = fopen( NGIRCd_ConfFile, "r" );
193         if( ! fd )
194         {
195                 /* Keine Konfigurationsdatei gefunden */
196                 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno ));
197                 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
198                 exit( 1 );
199         }
200
201         line = 0;
202         strcpy( section, "" );
203         while( TRUE )
204         {
205                 if( ! fgets( str, LINE_LEN, fd )) break;
206                 ngt_TrimStr( str );
207                 line++;
208
209                 /* Kommentarzeilen und leere Zeilen ueberspringen */
210                 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
211
212                 /* Anfang eines Abschnittes? */
213                 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' ))
214                 {
215                         strcpy( section, str );
216                         if( strcasecmp( section, "[GLOBAL]" ) == 0 ) continue;
217                         if( strcasecmp( section, "[OPERATOR]" ) == 0 )
218                         {
219                                 if( Conf_Oper_Count + 1 > MAX_OPERATORS ) Config_Error( LOG_ERR, "Too many operators configured." );
220                                 else
221                                 {
222                                         /* neuen Operator initialisieren */
223                                         strcpy( Conf_Oper[Conf_Oper_Count].name, "" );
224                                         strcpy( Conf_Oper[Conf_Oper_Count].pwd, "" );
225                                         Conf_Oper_Count++;
226                                 }
227                                 continue;
228                         }
229                         if( strcasecmp( section, "[SERVER]" ) == 0 )
230                         {
231                                 if( Conf_Server_Count + 1 > MAX_SERVERS ) Config_Error( LOG_ERR, "Too many servers configured." );
232                                 else
233                                 {
234                                         /* neuen Server ("Peer") initialisieren */
235                                         strcpy( Conf_Server[Conf_Server_Count].host, "" );
236                                         strcpy( Conf_Server[Conf_Server_Count].ip, "" );
237                                         strcpy( Conf_Server[Conf_Server_Count].name, "" );
238                                         strcpy( Conf_Server[Conf_Server_Count].pwd, "" );
239                                         Conf_Server[Conf_Server_Count].port = 0;
240                                         Conf_Server[Conf_Server_Count].group = -1;
241                                         Conf_Server[Conf_Server_Count].lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
242                                         Conf_Server[Conf_Server_Count].res_stat = NULL;
243                                         Conf_Server_Count++;
244                                 }
245                                 continue;
246                         }
247                         if( strcasecmp( section, "[CHANNEL]" ) == 0 )
248                         {
249                                 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
250                                 else
251                                 {
252                                         /* neuen vordefinierten Channel initialisieren */
253                                         strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
254                                         strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
255                                         strcpy( Conf_Channel[Conf_Channel_Count].topic, "" );
256                                         Conf_Channel_Count++;
257                                 }
258                                 continue;
259                         }
260                         Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
261                         section[0] = 0x1;
262                 }
263                 if( section[0] == 0x1 ) continue;
264
265                 /* In Variable und Argument zerlegen */
266                 ptr = strchr( str, '=' );
267                 if( ! ptr )
268                 {
269                         Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
270                         continue;
271                 }
272                 *ptr = '\0';
273                 var = str; ngt_TrimStr( var );
274                 arg = ptr + 1; ngt_TrimStr( arg );
275
276                 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
277                 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
278                 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
279                 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
280                 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
281         }
282         
283         fclose( fd );
284         
285         /* Wenn kein Port definiert wurde, Port 6667 als Default benutzen */
286         if( Conf_ListenPorts_Count < 1 )
287         {
288                 Conf_ListenPorts_Count = 1;
289                 Conf_ListenPorts[0] = 6667;
290         }
291 } /* Read_Config */
292
293
294 LOCAL VOID
295 Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
296 {
297         CHAR *ptr;
298         INT32 port;
299         
300         assert( Line > 0 );
301         assert( Var != NULL );
302         assert( Arg != NULL );
303         
304         if( strcasecmp( Var, "Name" ) == 0 )
305         {
306                 /* Der Server-Name */
307                 strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
308                 Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
309                 return;
310         }
311         if( strcasecmp( Var, "Info" ) == 0 )
312         {
313                 /* Server-Info-Text */
314                 strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
315                 Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
316                 return;
317         }
318         if( strcasecmp( Var, "Password" ) == 0 )
319         {
320                 /* Server-Passwort */
321                 strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
322                 Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
323                 return;
324         }
325         if( strcasecmp( Var, "AdminInfo1" ) == 0 )
326         {
327                 /* Server-Info-Text */
328                 strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 );
329                 Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0';
330                 return;
331         }
332         if( strcasecmp( Var, "AdminInfo2" ) == 0 )
333         {
334                 /* Server-Info-Text */
335                 strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 );
336                 Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0';
337                 return;
338         }
339         if( strcasecmp( Var, "AdminEMail" ) == 0 )
340         {
341                 /* Server-Info-Text */
342                 strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 );
343                 Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0';
344                 return;
345         }
346         if( strcasecmp( Var, "Ports" ) == 0 )
347         {
348                 /* Ports, durch "," getrennt, auf denen der Server
349                 * Verbindungen annehmen soll */
350                 ptr = strtok( Arg, "," );
351                 while( ptr )
352                 {
353                         ngt_TrimStr( ptr );
354                         port = atol( ptr );
355                         if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
356                         else
357                         {
358                                 if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port;
359                                 else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
360                         }
361                         ptr = strtok( NULL, "," );
362                 }
363                 return;
364         }
365         if( strcasecmp( Var, "MotdFile" ) == 0 )
366         {
367                 /* Datei mit der "message of the day" (MOTD) */
368                 strncpy( Conf_MotdFile, Arg, FNAME_LEN - 1 );
369                 Conf_MotdFile[FNAME_LEN - 1] = '\0';
370                 return;
371         }
372         if( strcasecmp( Var, "ServerUID" ) == 0 )
373         {
374                 /* UID, mit der der Daemon laufen soll */
375                 Conf_UID = (UINT)atoi( Arg );
376                 return;
377         }
378         if( strcasecmp( Var, "ServerGID" ) == 0 )
379         {
380                 /* GID, mit der der Daemon laufen soll */
381                 Conf_GID = (UINT)atoi( Arg );
382                 return;
383         }
384         if( strcasecmp( Var, "PingTimeout" ) == 0 )
385         {
386                 /* PING-Timeout */
387                 Conf_PingTimeout = atoi( Arg );
388                 if(( Conf_PingTimeout ) < 5 ) Conf_PingTimeout = 5;
389                 return;
390         }
391         if( strcasecmp( Var, "PongTimeout" ) == 0 )
392         {
393                 /* PONG-Timeout */
394                 Conf_PongTimeout = atoi( Arg );
395                 if(( Conf_PongTimeout ) < 5 ) Conf_PongTimeout = 5;
396                 return;
397         }
398         if( strcasecmp( Var, "ConnectRetry" ) == 0 )
399         {
400                 /* Sekunden zwischen Verbindungsversuchen zu anderen Servern */
401                 Conf_ConnectRetry = atoi( Arg );
402                 if(( Conf_ConnectRetry ) < 5 ) Conf_ConnectRetry = 5;
403                 return;
404         }
405         if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
406         {
407                 /* Koennen IRC-Operatoren immer MODE benutzen? */
408                 if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
409                 else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
410                 else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
411                 else Conf_OperCanMode = FALSE;
412                 return;
413         }
414                 
415         Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
416 } /* Handle_GLOBAL */
417
418
419 LOCAL VOID
420 Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg )
421 {
422         assert( Line > 0 );
423         assert( Var != NULL );
424         assert( Arg != NULL );
425         assert( Conf_Oper_Count > 0 );
426
427         if( strcasecmp( Var, "Name" ) == 0 )
428         {
429                 /* Name des IRC Operator */
430                 strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 );
431                 Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0';
432                 return;
433         }
434         if( strcasecmp( Var, "Password" ) == 0 )
435         {
436                 /* Passwort des IRC Operator */
437                 strncpy( Conf_Oper[Conf_Oper_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
438                 Conf_Oper[Conf_Oper_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
439                 return;
440         }
441         
442         Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
443 } /* Handle_OPERATOR */
444
445
446 LOCAL VOID
447 Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
448 {
449         INT32 port;
450         
451         assert( Line > 0 );
452         assert( Var != NULL );
453         assert( Arg != NULL );
454
455         if( strcasecmp( Var, "Host" ) == 0 )
456         {
457                 /* Hostname des Servers */
458                 strncpy( Conf_Server[Conf_Server_Count - 1].host, Arg, HOST_LEN - 1 );
459                 Conf_Server[Conf_Server_Count - 1].host[HOST_LEN - 1] = '\0';
460                 return;
461         }
462         if( strcasecmp( Var, "Name" ) == 0 )
463         {
464                 /* Name des Servers ("Nick") */
465                 strncpy( Conf_Server[Conf_Server_Count - 1].name, Arg, CLIENT_ID_LEN - 1 );
466                 Conf_Server[Conf_Server_Count - 1].name[CLIENT_ID_LEN - 1] = '\0';
467                 return;
468         }
469         if( strcasecmp( Var, "Password" ) == 0 )
470         {
471                 /* Passwort des Servers */
472                 strncpy( Conf_Server[Conf_Server_Count - 1].pwd, Arg, CLIENT_PASS_LEN - 1 );
473                 Conf_Server[Conf_Server_Count - 1].pwd[CLIENT_PASS_LEN - 1] = '\0';
474                 return;
475         }
476         if( strcasecmp( Var, "Port" ) == 0 )
477         {
478                 /* Port, zu dem Verbunden werden soll */
479                 port = atol( Arg );
480                 if( port > 0 && port < 0xFFFF ) Conf_Server[Conf_Server_Count - 1].port = (INT)port;
481                 else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port );
482                 return;
483         }
484         if( strcasecmp( Var, "Group" ) == 0 )
485         {
486                 /* Server-Gruppe */
487                 Conf_Server[Conf_Server_Count - 1].group = atoi( Arg );
488                 return;
489         }
490         
491         Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
492 } /* Handle_SERVER */
493
494
495 LOCAL VOID
496 Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg )
497 {
498         assert( Line > 0 );
499         assert( Var != NULL );
500         assert( Arg != NULL );
501
502         if( strcasecmp( Var, "Name" ) == 0 )
503         {
504                 /* Hostname des Servers */
505                 strncpy( Conf_Channel[Conf_Channel_Count - 1].name, Arg, CHANNEL_NAME_LEN - 1 );
506                 Conf_Channel[Conf_Channel_Count - 1].name[CHANNEL_NAME_LEN - 1] = '\0';
507                 return;
508         }
509         if( strcasecmp( Var, "Modes" ) == 0 )
510         {
511                 /* Name des Servers ("Nick") */
512                 strncpy( Conf_Channel[Conf_Channel_Count - 1].modes, Arg, CHANNEL_MODE_LEN - 1 );
513                 Conf_Channel[Conf_Channel_Count - 1].modes[CHANNEL_MODE_LEN - 1] = '\0';
514                 return;
515         }
516         if( strcasecmp( Var, "Topic" ) == 0 )
517         {
518                 /* Passwort des Servers */
519                 strncpy( Conf_Channel[Conf_Channel_Count - 1].topic, Arg, CHANNEL_TOPIC_LEN - 1 );
520                 Conf_Channel[Conf_Channel_Count - 1].topic[CHANNEL_TOPIC_LEN - 1] = '\0';
521                 return;
522         }
523
524         Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
525 } /* Handle_CHANNEL */
526
527
528 LOCAL VOID
529 Validate_Config( VOID )
530 {
531         /* Konfiguration ueberpruefen */
532         
533         if( ! Conf_ServerName[0] )
534         {
535                 /* Kein Servername konfiguriert */
536                 Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile );
537                 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
538                 exit( 1 );
539         }
540
541 #ifdef STRICT_RFC
542         if( ! ConfAdminMail[0] )
543         {
544                 /* Keine Server-Information konfiguriert */
545                 Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );
546                 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE );
547                 exit( 1 );
548         }
549 #endif
550
551         if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] )
552         {
553                 /* Keine Server-Information konfiguriert */
554                 Log( LOG_WARNING, "No server information configured but required by RFC!" );
555         }
556 } /* Validate_Config */
557
558
559 #ifdef PROTOTYPES
560 LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... )
561 #else
562 LOCAL VOID Config_Error( Level, Format, va_alist )
563 CONST INT Level;
564 CONST CHAR *Format;
565 va_dcl
566 #endif
567 {
568         /* Fehler! Auf Console und/oder ins Log schreiben */
569
570         CHAR msg[MAX_LOG_MSG_LEN];
571         va_list ap;
572
573         assert( Format != NULL );
574
575         /* String mit variablen Argumenten zusammenbauen ... */
576 #ifdef PROTOTYPES
577         va_start( ap, Format );
578 #else
579         va_start( ap );
580 #endif
581         vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
582         va_end( ap );
583
584         /* Im "normalen Betrieb" soll der Log-Mechanismus des ngIRCd verwendet
585          * werden, beim Testen der Konfiguration jedoch nicht, hier sollen alle
586          * Meldungen direkt auf die Konsole ausgegeben werden: */
587         if( Use_Log ) Log( Level, msg );
588         else puts( msg );
589 } /* Config_Error */
590
591
592 /* -eof- */