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