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