]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.c
Do not exit unconditionally if config file cannot be opened
[ngircd-alex.git] / src / ngircd / conf.c
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001,2002 Alexander Barton (alex@barton.de)
4  *
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.
10  *
11  * Configuration management (reading, parsing & validation)
12  */
13
14
15 #include "portab.h"
16
17 static char UNUSED id[] = "$Id: conf.c,v 1.105 2008/03/18 20:12:47 fw Exp $";
18
19 #include "imp.h"
20 #include <assert.h>
21 #include <errno.h>
22 #ifdef PROTOTYPES
23 #       include <stdarg.h>
24 #else
25 #       include <varargs.h>
26 #endif
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <strings.h>
31 #include <unistd.h>
32 #include <pwd.h>
33 #include <grp.h>
34 #include <sys/types.h>
35 #include <unistd.h>
36
37 #ifdef HAVE_CTYPE_H
38 # include <ctype.h>
39 #endif
40
41 #include "array.h"
42 #include "ngircd.h"
43 #include "conn.h"
44 #include "client.h"
45 #include "defines.h"
46 #include "log.h"
47 #include "resolve.h"
48 #include "tool.h"
49
50 #include "exp.h"
51 #include "conf.h"
52
53
54 static bool Use_Log = true;
55 static CONF_SERVER New_Server;
56 static int New_Server_Idx;
57
58
59 static void Set_Defaults PARAMS(( bool InitServers ));
60 static bool Read_Config PARAMS(( bool ngircd_starting ));
61 static void Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
62
63 static void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg ));
64 static void Handle_OPERATOR PARAMS(( int Line, char *Var, char *Arg ));
65 static void Handle_SERVER PARAMS(( int Line, char *Var, char *Arg ));
66 static void Handle_CHANNEL PARAMS(( int Line, char *Var, char *Arg ));
67
68 static void Config_Error PARAMS(( const int Level, const char *Format, ... ));
69
70 static void Config_Error_NaN PARAMS(( const int LINE, const char *Value ));
71 static void Config_Error_TooLong PARAMS(( const int LINE, const char *Value ));
72
73 static void Init_Server_Struct PARAMS(( CONF_SERVER *Server ));
74
75
76 static char *
77 strdup_warn(const char *str)
78 {
79         char *ptr = strdup(str);
80         if (!ptr)
81                 Config_Error(LOG_ERR, "Could not allocate mem for string: %s", str);
82         return ptr;
83 }
84
85
86 static void
87 ports_puts(array *a)
88 {
89         size_t len;
90         UINT16 *ports;
91         len = array_length(a, sizeof(UINT16));
92         if (len--) {
93                 ports = (UINT16*) array_start(a);
94                 printf("%u", (unsigned int) *ports);
95                 while (len--) {
96                         ports++;
97                         printf(", %u", (unsigned int) *ports);
98                 }
99         }
100         putc('\n', stdout);
101 }
102
103
104 static void
105 ports_parse(array *a, int Line, char *Arg)
106 {
107         char *ptr;
108         int port;
109         UINT16 port16;
110
111         array_trunc(a);
112
113         /* Ports on that the server should listen. More port numbers
114          * must be separated by "," */
115         ptr = strtok( Arg, "," );
116         while (ptr) {
117                 ngt_TrimStr( ptr );
118                 port = atol( ptr );
119                 if (port > 0 && port < 0xFFFF) {
120                         port16 = (UINT16) port;
121                         if (!array_catb(a, (char*)&port16, sizeof port16))
122                                 Config_Error(LOG_ERR, "%s, line %d Could not add port number %ld: %s",
123                                                         NGIRCd_ConfFile, Line, port, strerror(errno));
124                 } else {
125                         Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!",
126                                                                         NGIRCd_ConfFile, Line, port );
127                 }
128
129                 ptr = strtok( NULL, "," );
130         }
131 }
132
133
134 GLOBAL void
135 Conf_Init( void )
136 {
137         Read_Config( true );
138         Validate_Config(false, false);
139 } /* Config_Init */
140
141
142 GLOBAL bool
143 Conf_Rehash( void )
144 {
145         if (!Read_Config(false))
146                 return false;
147         Validate_Config(false, true);
148
149         /* Update CLIENT structure of local server */
150         Client_SetInfo(Client_ThisServer(), Conf_ServerInfo);
151         return true;
152 } /* Config_Rehash */
153
154
155 GLOBAL int
156 Conf_Test( void )
157 {
158         /* Read configuration, validate and output it. */
159
160         struct passwd *pwd;
161         struct group *grp;
162         unsigned int i;
163         char *topic;
164
165         Use_Log = false;
166
167         Read_Config( true );
168         Validate_Config(true, false);
169
170         /* If stdin and stdout ("you can read our nice message and we can
171          * read in your keypress") are valid tty's, wait for a key: */
172         if( isatty( fileno( stdin )) && isatty( fileno( stdout ))) {
173                 puts( "OK, press enter to see a dump of your service configuration ..." );
174                 getchar( );
175         } else {
176                 puts( "Ok, dump of your server configuration follows:\n" );
177         }
178
179         puts( "[GLOBAL]" );
180         printf( "  Name = %s\n", Conf_ServerName );
181         printf( "  Info = %s\n", Conf_ServerInfo );
182         printf( "  Password = %s\n", Conf_ServerPwd );
183         printf( "  AdminInfo1 = %s\n", Conf_ServerAdmin1 );
184         printf( "  AdminInfo2 = %s\n", Conf_ServerAdmin2 );
185         printf( "  AdminEMail = %s\n", Conf_ServerAdminMail );
186         printf( "  MotdFile = %s\n", Conf_MotdFile );
187         printf( "  MotdPhrase = %s\n", Conf_MotdPhrase );
188         printf( "  ChrootDir = %s\n", Conf_Chroot );
189         printf( "  PidFile = %s\n", Conf_PidFile);
190         fputs("  Ports = ", stdout);
191
192         ports_puts(&Conf_ListenPorts);
193
194         printf( "  Listen = %s\n", Conf_ListenAddress );
195         pwd = getpwuid( Conf_UID );
196         if( pwd ) printf( "  ServerUID = %s\n", pwd->pw_name );
197         else printf( "  ServerUID = %ld\n", (long)Conf_UID );
198         grp = getgrgid( Conf_GID );
199         if( grp ) printf( "  ServerGID = %s\n", grp->gr_name );
200         else printf( "  ServerGID = %ld\n", (long)Conf_GID );
201         printf( "  PingTimeout = %d\n", Conf_PingTimeout );
202         printf( "  PongTimeout = %d\n", Conf_PongTimeout );
203         printf( "  ConnectRetry = %d\n", Conf_ConnectRetry );
204         printf( "  OperCanUseMode = %s\n", Conf_OperCanMode == true ? "yes" : "no" );
205         printf( "  OperServerMode = %s\n", Conf_OperServerMode == true? "yes" : "no" );
206         printf( "  PredefChannelsOnly = %s\n", Conf_PredefChannelsOnly == true ? "yes" : "no" );
207         printf( "  NoDNS = %s\n", Conf_NoDNS ? "yes" : "no");
208         printf( "  MaxConnections = %ld\n", Conf_MaxConnections);
209         printf( "  MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
210         printf( "  MaxJoins = %d\n", Conf_MaxJoins>0 ? Conf_MaxJoins : -1);
211         printf( "  MaxNickLength = %u\n\n", Conf_MaxNickLength - 1);
212
213         for( i = 0; i < Conf_Oper_Count; i++ ) {
214                 if( ! Conf_Oper[i].name[0] ) continue;
215
216                 /* Valid "Operator" section */
217                 puts( "[OPERATOR]" );
218                 printf( "  Name = %s\n", Conf_Oper[i].name );
219                 printf( "  Password = %s\n", Conf_Oper[i].pwd );
220                 if ( Conf_Oper[i].mask ) printf( "  Mask = %s\n", Conf_Oper[i].mask );
221                 puts( "" );
222         }
223
224         for( i = 0; i < MAX_SERVERS; i++ ) {
225                 if( ! Conf_Server[i].name[0] ) continue;
226
227                 /* Valid "Server" section */
228                 puts( "[SERVER]" );
229                 printf( "  Name = %s\n", Conf_Server[i].name );
230                 printf( "  Host = %s\n", Conf_Server[i].host );
231                 printf( "  Port = %u\n", (unsigned int)Conf_Server[i].port );
232                 printf( "  MyPassword = %s\n", Conf_Server[i].pwd_in );
233                 printf( "  PeerPassword = %s\n", Conf_Server[i].pwd_out );
234                 printf( "  Group = %d\n", Conf_Server[i].group );
235                 printf( "  Passive = %s\n\n", Conf_Server[i].flags & CONF_SFLAG_DISABLED ? "yes" : "no");
236         }
237
238         for( i = 0; i < Conf_Channel_Count; i++ ) {
239                 if( ! Conf_Channel[i].name[0] ) continue;
240
241                 /* Valid "Channel" section */
242                 puts( "[CHANNEL]" );
243                 printf( "  Name = %s\n", Conf_Channel[i].name );
244                 printf( "  Modes = %s\n", Conf_Channel[i].modes );
245                 printf( "  Key = %s\n", Conf_Channel[i].key );
246                 printf( "  MaxUsers = %lu\n", Conf_Channel[i].maxusers );
247
248                 topic = (char*)array_start(&Conf_Channel[i].topic);
249                 printf( "  Topic = %s\n\n", topic ? topic : "");
250         }
251
252         return 0;
253 } /* Conf_Test */
254
255
256 GLOBAL void
257 Conf_UnsetServer( CONN_ID Idx )
258 {
259         /* Set next time for next connection attempt, if this is a server
260          * link that is (still) configured here. If the server is set as
261          * "once", delete it from our configuration.
262          * Non-Server-Connections will be silently ignored. */
263
264         int i;
265         time_t t;
266
267         /* Check all our configured servers */
268         for( i = 0; i < MAX_SERVERS; i++ ) {
269                 if( Conf_Server[i].conn_id != Idx ) continue;
270
271                 /* Gotcha! Mark server configuration as "unused": */
272                 Conf_Server[i].conn_id = NONE;
273
274                 if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) {
275                         /* Delete configuration here */
276                         Init_Server_Struct( &Conf_Server[i] );
277                 } else {
278                         /* Set time for next connect attempt */
279                         t = time(NULL);
280                         if (Conf_Server[i].lasttry < t - Conf_ConnectRetry) {
281                                 /* The connection has been "long", so we don't
282                                  * require the next attempt to be delayed. */
283                                 Conf_Server[i].lasttry =
284                                         t - Conf_ConnectRetry + RECONNECT_DELAY;
285                         } else
286                                 Conf_Server[i].lasttry = t;
287                 }
288         }
289 } /* Conf_UnsetServer */
290
291
292 GLOBAL void
293 Conf_SetServer( int ConfServer, CONN_ID Idx )
294 {
295         /* Set connection for specified configured server */
296
297         assert( ConfServer > NONE );
298         assert( Idx > NONE );
299
300         Conf_Server[ConfServer].conn_id = Idx;
301 } /* Conf_SetServer */
302
303
304 GLOBAL int
305 Conf_GetServer( CONN_ID Idx )
306 {
307         /* Get index of server in configuration structure */
308
309         int i = 0;
310
311         assert( Idx > NONE );
312
313         for( i = 0; i < MAX_SERVERS; i++ ) {
314                 if( Conf_Server[i].conn_id == Idx ) return i;
315         }
316         return NONE;
317 } /* Conf_GetServer */
318
319
320 GLOBAL bool
321 Conf_EnableServer( char *Name, UINT16 Port )
322 {
323         /* Enable specified server and adjust port */
324
325         int i;
326
327         assert( Name != NULL );
328
329         for( i = 0; i < MAX_SERVERS; i++ ) {
330                 if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
331                         /* Gotcha! Set port and enable server: */
332                         Conf_Server[i].port = Port;
333                         Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
334                         return true;
335                 }
336         }
337         return false;
338 } /* Conf_EnableServer */
339
340
341 GLOBAL bool
342 Conf_EnablePassiveServer(const char *Name)
343 {
344         /* Enable specified server */
345         int i;
346
347         assert( Name != NULL );
348         for (i = 0; i < MAX_SERVERS; i++) {
349                 if ((strcasecmp( Conf_Server[i].name, Name ) == 0) && (Conf_Server[i].port > 0)) {
350                         /* BINGO! Enable server */
351                         Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
352                         return true;
353                 }
354         }
355         return false;
356 } /* Conf_EnablePassiveServer */
357
358
359 GLOBAL bool
360 Conf_DisableServer( char *Name )
361 {
362         /* Enable specified server and adjust port */
363
364         int i;
365
366         assert( Name != NULL );
367
368         for( i = 0; i < MAX_SERVERS; i++ ) {
369                 if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
370                         /* Gotcha! Disable and disconnect server: */
371                         Conf_Server[i].flags |= CONF_SFLAG_DISABLED;
372                         if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", true);
373                         return true;
374                 }
375         }
376         return false;
377 } /* Conf_DisableServer */
378
379
380 GLOBAL bool
381 Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd )
382 {
383         /* Add new server to configuration */
384
385         int i;
386
387         assert( Name != NULL );
388         assert( Host != NULL );
389         assert( MyPwd != NULL );
390         assert( PeerPwd != NULL );
391
392         /* Search unused item in server configuration structure */
393         for( i = 0; i < MAX_SERVERS; i++ ) {
394                 /* Is this item used? */
395                 if( ! Conf_Server[i].name[0] ) break;
396         }
397         if( i >= MAX_SERVERS ) return false;
398
399         Init_Server_Struct( &Conf_Server[i] );
400         strlcpy( Conf_Server[i].name, Name, sizeof( Conf_Server[i].name ));
401         strlcpy( Conf_Server[i].host, Host, sizeof( Conf_Server[i].host ));
402         strlcpy( Conf_Server[i].pwd_out, MyPwd, sizeof( Conf_Server[i].pwd_out ));
403         strlcpy( Conf_Server[i].pwd_in, PeerPwd, sizeof( Conf_Server[i].pwd_in ));
404         Conf_Server[i].port = Port;
405         Conf_Server[i].flags = CONF_SFLAG_ONCE;
406
407         return true;
408 } /* Conf_AddServer */
409
410
411 static void
412 Set_Defaults( bool InitServers )
413 {
414         /* Initialize configuration variables with default values. */
415
416         int i;
417
418         strcpy( Conf_ServerName, "" );
419         snprintf( Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION );
420         strcpy( Conf_ServerPwd, "" );
421
422         strcpy( Conf_ServerAdmin1, "" );
423         strcpy( Conf_ServerAdmin2, "" );
424         strcpy( Conf_ServerAdminMail, "" );
425
426         strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile ));
427         strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile ));
428
429         strlcpy( Conf_MotdPhrase, MOTD_PHRASE, sizeof( Conf_MotdPhrase ));
430
431         strlcpy( Conf_Chroot, CHROOT_DIR, sizeof( Conf_Chroot ));
432
433         strlcpy( Conf_PidFile, PID_FILE, sizeof( Conf_PidFile ));
434
435         strcpy( Conf_ListenAddress, "" );
436
437         Conf_UID = Conf_GID = 0;
438
439         Conf_PingTimeout = 120;
440         Conf_PongTimeout = 20;
441
442         Conf_ConnectRetry = 60;
443
444         Conf_Oper_Count = 0;
445         Conf_Channel_Count = 0;
446
447         Conf_OperCanMode = false;
448         Conf_NoDNS = false;
449         Conf_PredefChannelsOnly = false;
450         Conf_OperServerMode = false;
451
452         Conf_MaxConnections = 0;
453         Conf_MaxConnectionsIP = 5;
454         Conf_MaxJoins = 10;
455         Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT;
456
457         /* Initialize server configuration structures */
458         if( InitServers ) for( i = 0; i < MAX_SERVERS; Init_Server_Struct( &Conf_Server[i++] ));
459 } /* Set_Defaults */
460
461
462 static bool
463 Read_Config( bool ngircd_starting )
464 {
465         /* Read configuration file. */
466
467         char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr;
468         const UINT16 defaultport = 6667;
469         int line, i, n;
470         FILE *fd;
471
472         /* Open configuration file */
473         fd = fopen( NGIRCd_ConfFile, "r" );
474         if( ! fd ) {
475                 /* No configuration file found! */
476                 Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s",
477                                         NGIRCd_ConfFile, strerror( errno ));
478                 if (!ngircd_starting)
479                         return false;
480                 Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
481                 exit( 1 );
482         }
483
484         Set_Defaults( ngircd_starting );
485
486         Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
487
488         /* Clean up server configuration structure: mark all already
489          * configured servers as "once" so that they are deleted
490          * after the next disconnect and delete all unused servers.
491          * And delete all servers which are "duplicates" of servers
492          * that are already marked as "once" (such servers have been
493          * created by the last rehash but are now useless). */
494         for( i = 0; i < MAX_SERVERS; i++ ) {
495                 if( Conf_Server[i].conn_id == NONE ) Init_Server_Struct( &Conf_Server[i] );
496                 else {
497                         /* This structure is in use ... */
498                         if( Conf_Server[i].flags & CONF_SFLAG_ONCE ) {
499                                 /* Check for duplicates */
500                                 for( n = 0; n < MAX_SERVERS; n++ ) {
501                                         if( n == i ) continue;
502
503                                         if( Conf_Server[i].conn_id == Conf_Server[n].conn_id ) {
504                                                 Init_Server_Struct( &Conf_Server[n] );
505 #ifdef DEBUG
506                                                 Log(LOG_DEBUG,"Deleted unused duplicate server %d (kept %d).",
507                                                                                                 n, i );
508 #endif
509                                         }
510                                 }
511                         } else {
512                                 /* Mark server as "once" */
513                                 Conf_Server[i].flags |= CONF_SFLAG_ONCE;
514                                 Log( LOG_DEBUG, "Marked server %d as \"once\"", i );
515                         }
516                 }
517         }
518
519         /* Initialize variables */
520         line = 0;
521         strcpy( section, "" );
522         Init_Server_Struct( &New_Server );
523         New_Server_Idx = NONE;
524
525         /* Read configuration file */
526         while( true ) {
527                 if( ! fgets( str, LINE_LEN, fd )) break;
528                 ngt_TrimStr( str );
529                 line++;
530
531                 /* Skip comments and empty lines */
532                 if( str[0] == ';' || str[0] == '#' || str[0] == '\0' ) continue;
533
534                 /* Is this the beginning of a new section? */
535                 if(( str[0] == '[' ) && ( str[strlen( str ) - 1] == ']' )) {
536                         strlcpy( section, str, sizeof( section ));
537                         if( strcasecmp( section, "[GLOBAL]" ) == 0 )
538                                 continue;
539
540                         if( strcasecmp( section, "[OPERATOR]" ) == 0 ) {
541                                 if( Conf_Oper_Count + 1 > MAX_OPERATORS )
542                                         Config_Error( LOG_ERR, "Too many operators configured.");
543                                 else {
544                                         /* Initialize new operator structure */
545                                         Conf_Oper[Conf_Oper_Count].name[0] = '\0';
546                                         Conf_Oper[Conf_Oper_Count].pwd[0] = '\0';
547                                         if (Conf_Oper[Conf_Oper_Count].mask) {
548                                                 free(Conf_Oper[Conf_Oper_Count].mask );
549                                                 Conf_Oper[Conf_Oper_Count].mask = NULL;
550                                         }
551                                         Conf_Oper_Count++;
552                                 }
553                                 continue;
554                         }
555                         if( strcasecmp( section, "[SERVER]" ) == 0 ) {
556                                 /* Check if there is already a server to add */
557                                 if( New_Server.name[0] ) {
558                                         /* Copy data to "real" server structure */
559                                         assert( New_Server_Idx > NONE );
560                                         Conf_Server[New_Server_Idx] = New_Server;
561                                 }
562
563                                 /* Re-init structure for new server */
564                                 Init_Server_Struct( &New_Server );
565
566                                 /* Search unused item in server configuration structure */
567                                 for( i = 0; i < MAX_SERVERS; i++ ) {
568                                         /* Is this item used? */
569                                         if( ! Conf_Server[i].name[0] ) break;
570                                 }
571                                 if( i >= MAX_SERVERS ) {
572                                         /* Oops, no free item found! */
573                                         Config_Error( LOG_ERR, "Too many servers configured." );
574                                         New_Server_Idx = NONE;
575                                 }
576                                 else New_Server_Idx = i;
577                                 continue;
578                         }
579                         if( strcasecmp( section, "[CHANNEL]" ) == 0 ) {
580                                 if( Conf_Channel_Count + 1 > MAX_DEFCHANNELS ) {
581                                         Config_Error( LOG_ERR, "Too many pre-defined channels configured." );
582                                 } else {
583                                         /* Initialize new channel structure */
584                                         strcpy( Conf_Channel[Conf_Channel_Count].name, "" );
585                                         strcpy( Conf_Channel[Conf_Channel_Count].modes, "" );
586                                         strcpy( Conf_Channel[Conf_Channel_Count].key, "" );
587                                         Conf_Channel[Conf_Channel_Count].maxusers = 0;
588                                         array_free(&Conf_Channel[Conf_Channel_Count].topic);
589                                         Conf_Channel_Count++;
590                                 }
591                                 continue;
592                         }
593                         Config_Error( LOG_ERR, "%s, line %d: Unknown section \"%s\"!", NGIRCd_ConfFile, line, section );
594                         section[0] = 0x1;
595                 }
596                 if( section[0] == 0x1 ) continue;
597
598                 /* Split line into variable name and parameters */
599                 ptr = strchr( str, '=' );
600                 if( ! ptr ) {
601                         Config_Error( LOG_ERR, "%s, line %d: Syntax error!", NGIRCd_ConfFile, line );
602                         continue;
603                 }
604                 *ptr = '\0';
605                 var = str; ngt_TrimStr( var );
606                 arg = ptr + 1; ngt_TrimStr( arg );
607
608                 if( strcasecmp( section, "[GLOBAL]" ) == 0 ) Handle_GLOBAL( line, var, arg );
609                 else if( strcasecmp( section, "[OPERATOR]" ) == 0 ) Handle_OPERATOR( line, var, arg );
610                 else if( strcasecmp( section, "[SERVER]" ) == 0 ) Handle_SERVER( line, var, arg );
611                 else if( strcasecmp( section, "[CHANNEL]" ) == 0 ) Handle_CHANNEL( line, var, arg );
612                 else Config_Error( LOG_ERR, "%s, line %d: Variable \"%s\" outside section!", NGIRCd_ConfFile, line, var );
613         }
614
615         /* Close configuration file */
616         fclose( fd );
617
618         /* Check if there is still a server to add */
619         if( New_Server.name[0] ) {
620                 /* Copy data to "real" server structure */
621                 assert( New_Server_Idx > NONE );
622                 Conf_Server[New_Server_Idx] = New_Server;
623         }
624
625         if (0 == array_length(&Conf_ListenPorts, sizeof(UINT16))) {
626                 if (!array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport)) {
627                         Config_Error( LOG_ALERT, "Could not add default listening Port %u: %s",
628                                                         (unsigned int) defaultport, strerror(errno));
629                         exit( 1 );
630                 }
631         }
632         return true;
633 } /* Read_Config */
634
635
636 static bool
637 Check_ArgIsTrue( const char *Arg )
638 {
639         if( strcasecmp( Arg, "yes" ) == 0 ) return true;
640         if( strcasecmp( Arg, "true" ) == 0 ) return true;
641         if( atoi( Arg ) != 0 ) return true;
642
643         return false;
644 } /* Check_ArgIsTrue */
645
646
647 static unsigned int Handle_MaxNickLength(int Line, const char *Arg)
648 {
649         unsigned new;
650
651         new = (unsigned) atoi(Arg) + 1;
652         if (new > CLIENT_NICK_LEN) {
653                 Config_Error(LOG_WARNING,
654                              "%s, line %d: Value of \"MaxNickLength\" exceeds %u!",
655                              NGIRCd_ConfFile, Line, CLIENT_NICK_LEN - 1);
656                 return CLIENT_NICK_LEN;
657         }
658         if (new < 2) {
659                 Config_Error(LOG_WARNING,
660                              "%s, line %d: Value of \"MaxNickLength\" must be at least 1!",
661                              NGIRCd_ConfFile, Line);
662                 return 2;
663         }
664         return new;
665 } /* Handle_MaxNickLength */
666
667
668 static void
669 Handle_GLOBAL( int Line, char *Var, char *Arg )
670 {
671         struct passwd *pwd;
672         struct group *grp;
673         size_t len;
674         
675         assert( Line > 0 );
676         assert( Var != NULL );
677         assert( Arg != NULL );
678         
679         if( strcasecmp( Var, "Name" ) == 0 ) {
680                 /* Server name */
681                 len = strlcpy( Conf_ServerName, Arg, sizeof( Conf_ServerName ));
682                 if (len >= sizeof( Conf_ServerName ))
683                         Config_Error_TooLong( Line, Var );
684                 return;
685         }
686         if( strcasecmp( Var, "Info" ) == 0 ) {
687                 /* Info text of server */
688                 len = strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo ));
689                 if (len >= sizeof( Conf_ServerInfo ))
690                         Config_Error_TooLong ( Line, Var );
691                 return;
692         }
693         if( strcasecmp( Var, "Password" ) == 0 ) {
694                 /* Global server password */
695                 len = strlcpy( Conf_ServerPwd, Arg, sizeof( Conf_ServerPwd ));
696                 if (len >= sizeof( Conf_ServerPwd ))
697                         Config_Error_TooLong( Line, Var );
698                 return;
699         }
700         if( strcasecmp( Var, "AdminInfo1" ) == 0 ) {
701                 /* Administrative info #1 */
702                 len = strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 ));
703                 if (len >= sizeof( Conf_ServerAdmin1 ))
704                         Config_Error_TooLong ( Line, Var );
705                 return;
706         }
707         if( strcasecmp( Var, "AdminInfo2" ) == 0 ) {
708                 /* Administrative info #2 */
709                 len = strlcpy( Conf_ServerAdmin2, Arg, sizeof( Conf_ServerAdmin2 ));
710                 if (len >= sizeof( Conf_ServerAdmin2 ))
711                         Config_Error_TooLong ( Line, Var );
712                 return;
713         }
714         if( strcasecmp( Var, "AdminEMail" ) == 0 ) {
715                 /* Administrative email contact */
716                 len = strlcpy( Conf_ServerAdminMail, Arg, sizeof( Conf_ServerAdminMail ));
717                 if (len >= sizeof( Conf_ServerAdminMail ))
718                         Config_Error_TooLong( Line, Var );
719                 return;
720         }
721
722         if( strcasecmp( Var, "Ports" ) == 0 ) {
723                 ports_parse(&Conf_ListenPorts, Line, Arg);
724                 return;
725         }
726         if( strcasecmp( Var, "MotdFile" ) == 0 ) {
727                 /* "Message of the day" (MOTD) file */
728                 len = strlcpy( Conf_MotdFile, Arg, sizeof( Conf_MotdFile ));
729                 if (len >= sizeof( Conf_MotdFile ))
730                         Config_Error_TooLong( Line, Var );
731                 return;
732         }
733         if( strcasecmp( Var, "MotdPhrase" ) == 0 ) {
734                 /* "Message of the day" phrase (instead of file) */
735                 len = strlcpy( Conf_MotdPhrase, Arg, sizeof( Conf_MotdPhrase ));
736                 if (len >= sizeof( Conf_MotdPhrase ))
737                         Config_Error_TooLong( Line, Var );
738                 return;
739         }
740         if( strcasecmp( Var, "ChrootDir" ) == 0 ) {
741                 /* directory for chroot() */
742                 len = strlcpy( Conf_Chroot, Arg, sizeof( Conf_Chroot ));
743                 if (len >= sizeof( Conf_Chroot ))
744                         Config_Error_TooLong( Line, Var );
745                 return;
746         }
747         if ( strcasecmp( Var, "PidFile" ) == 0 ) {
748                 /* name of pidfile */
749                 len = strlcpy( Conf_PidFile, Arg, sizeof( Conf_PidFile ));
750                 if (len >= sizeof( Conf_PidFile ))
751                         Config_Error_TooLong( Line, Var );
752                 return;
753         }
754         if( strcasecmp( Var, "ServerUID" ) == 0 ) {
755                 /* UID the daemon should switch to */
756                 pwd = getpwnam( Arg );
757                 if( pwd ) Conf_UID = pwd->pw_uid;
758                 else {
759 #ifdef HAVE_ISDIGIT
760                         if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
761                         else
762 #endif
763                         Conf_UID = (unsigned int)atoi( Arg );
764                 }
765                 return;
766         }
767         if( strcasecmp( Var, "ServerGID" ) == 0 ) {
768                 /* GID the daemon should use */
769                 grp = getgrnam( Arg );
770                 if( grp ) Conf_GID = grp->gr_gid;
771                 else {
772 #ifdef HAVE_ISDIGIT
773                         if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
774                         else
775 #endif
776                         Conf_GID = (unsigned int)atoi( Arg );
777                 }
778                 return;
779         }
780         if( strcasecmp( Var, "PingTimeout" ) == 0 ) {
781                 /* PING timeout */
782                 Conf_PingTimeout = atoi( Arg );
783                 if( Conf_PingTimeout < 5 ) {
784                         Config_Error( LOG_WARNING, "%s, line %d: Value of \"PingTimeout\" too low!",
785                                                                         NGIRCd_ConfFile, Line );
786                         Conf_PingTimeout = 5;
787                 }
788                 return;
789         }
790         if( strcasecmp( Var, "PongTimeout" ) == 0 ) {
791                 /* PONG timeout */
792                 Conf_PongTimeout = atoi( Arg );
793                 if( Conf_PongTimeout < 5 ) {
794                         Config_Error( LOG_WARNING, "%s, line %d: Value of \"PongTimeout\" too low!",
795                                                                         NGIRCd_ConfFile, Line );
796                         Conf_PongTimeout = 5;
797                 }
798                 return;
799         }
800         if( strcasecmp( Var, "ConnectRetry" ) == 0 ) {
801                 /* Seconds between connection attempts to other servers */
802                 Conf_ConnectRetry = atoi( Arg );
803                 if( Conf_ConnectRetry < 5 ) {
804                         Config_Error( LOG_WARNING, "%s, line %d: Value of \"ConnectRetry\" too low!",
805                                                                         NGIRCd_ConfFile, Line );
806                         Conf_ConnectRetry = 5;
807                 }
808                 return;
809         }
810         if( strcasecmp( Var, "PredefChannelsOnly" ) == 0 ) {
811                 /* Should we only allow pre-defined-channels? (i.e. users cannot create their own channels) */
812                 Conf_PredefChannelsOnly = Check_ArgIsTrue( Arg );
813                 return;
814         }
815         if( strcasecmp( Var, "NoDNS" ) == 0 ) {
816                 /* don't do reverse dns lookups when clients connect? */
817                 Conf_NoDNS = Check_ArgIsTrue( Arg );
818                 return;
819         }
820         if( strcasecmp( Var, "OperCanUseMode" ) == 0 ) {
821                 /* Are IRC operators allowed to use MODE in channels they aren't Op in? */
822                 Conf_OperCanMode = Check_ArgIsTrue( Arg );
823                 return;
824         }
825         if( strcasecmp( Var, "OperServerMode" ) == 0 ) {
826                 /* Mask IRC operator as if coming from the server? (ircd-irc2 compat hack) */
827                 Conf_OperServerMode = Check_ArgIsTrue( Arg );
828                 return;
829         }
830         if( strcasecmp( Var, "MaxConnections" ) == 0 ) {
831                 /* Maximum number of connections. 0 -> "no limit". */
832 #ifdef HAVE_ISDIGIT
833                 if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var);
834                 else
835 #endif
836                 Conf_MaxConnections = atol( Arg );
837                 return;
838         }
839         if( strcasecmp( Var, "MaxConnectionsIP" ) == 0 ) {
840                 /* Maximum number of simultaneous connections from one IP. 0 -> "no limit" */
841 #ifdef HAVE_ISDIGIT
842                 if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
843                 else
844 #endif
845                 Conf_MaxConnectionsIP = atoi( Arg );
846                 return;
847         }
848         if( strcasecmp( Var, "MaxJoins" ) == 0 ) {
849                 /* Maximum number of channels a user can join. 0 -> "no limit". */
850 #ifdef HAVE_ISDIGIT
851                 if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );
852                 else
853 #endif
854                 Conf_MaxJoins = atoi( Arg );
855                 return;
856         }
857         if( strcasecmp( Var, "MaxNickLength" ) == 0 ) {
858                 /* Maximum length of a nick name; must be same on all servers
859                  * within the IRC network! */
860                 Conf_MaxNickLength = Handle_MaxNickLength(Line, Arg);
861                 return;
862         }
863
864         if( strcasecmp( Var, "Listen" ) == 0 ) {
865                 /* IP-Address to bind sockets */
866                 len = strlcpy( Conf_ListenAddress, Arg, sizeof( Conf_ListenAddress ));
867                 if (len >= sizeof( Conf_ListenAddress ))
868                         Config_Error_TooLong( Line, Var );
869                 return;
870         }
871
872         Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!",
873                                                                 NGIRCd_ConfFile, Line, Var );
874 } /* Handle_GLOBAL */
875
876
877 static void
878 Handle_OPERATOR( int Line, char *Var, char *Arg )
879 {
880         unsigned int opercount;
881         size_t len;
882         assert( Line > 0 );
883         assert( Var != NULL );
884         assert( Arg != NULL );
885         assert( Conf_Oper_Count > 0 );
886
887         if ( Conf_Oper_Count == 0 )
888                 return;
889
890         opercount = Conf_Oper_Count - 1;
891
892         if( strcasecmp( Var, "Name" ) == 0 ) {
893                 /* Name of IRC operator */
894                 len = strlcpy( Conf_Oper[opercount].name, Arg, sizeof( Conf_Oper[opercount].name ));
895                 if (len >= sizeof( Conf_Oper[opercount].name ))
896                                 Config_Error_TooLong( Line, Var );
897                 return;
898         }
899         if( strcasecmp( Var, "Password" ) == 0 ) {
900                 /* Password of IRC operator */
901                 len = strlcpy( Conf_Oper[opercount].pwd, Arg, sizeof( Conf_Oper[opercount].pwd ));
902                 if (len >= sizeof( Conf_Oper[opercount].pwd ))
903                                 Config_Error_TooLong( Line, Var );
904                 return;
905         }
906         if( strcasecmp( Var, "Mask" ) == 0 ) {
907                 if (Conf_Oper[opercount].mask) return; /* Hostname already configured */
908
909                 Conf_Oper[opercount].mask = strdup_warn( Arg );
910                 return;
911         }
912         Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!",
913                                                                 NGIRCd_ConfFile, Line, Var );
914 } /* Handle_OPERATOR */
915
916
917 static void
918 Handle_SERVER( int Line, char *Var, char *Arg )
919 {
920         long port;
921         size_t len;
922         
923         assert( Line > 0 );
924         assert( Var != NULL );
925         assert( Arg != NULL );
926
927         /* Ignore server block if no space is left in server configuration structure */
928         if( New_Server_Idx <= NONE ) return;
929
930         if( strcasecmp( Var, "Host" ) == 0 ) {
931                 /* Hostname of the server */
932                 len = strlcpy( New_Server.host, Arg, sizeof( New_Server.host ));
933                 if (len >= sizeof( New_Server.host ))
934                         Config_Error_TooLong ( Line, Var );
935                 return;
936         }
937         if( strcasecmp( Var, "Name" ) == 0 ) {
938                 /* Name of the server ("Nick"/"ID") */
939                 len = strlcpy( New_Server.name, Arg, sizeof( New_Server.name ));
940                 if (len >= sizeof( New_Server.name ))
941                         Config_Error_TooLong( Line, Var );
942                 return;
943         }
944         if (strcasecmp(Var, "Bind") == 0) {
945                 if (ng_ipaddr_init(&New_Server.bind_addr, Arg, 0))
946                         return;
947
948                 Config_Error(LOG_ERR, "%s, line %d (section \"Server\"): Can't parse IP address \"%s\"",
949                                 NGIRCd_ConfFile, Line, Arg);
950                 return;
951         }
952         if( strcasecmp( Var, "MyPassword" ) == 0 ) {
953                 /* Password of this server which is sent to the peer */
954                 if (*Arg == ':') {
955                         Config_Error(LOG_ERR,
956                                 "%s, line %d (section \"Server\"): MyPassword must not start with ':'!",
957                                                                                 NGIRCd_ConfFile, Line);
958                 }
959                 len = strlcpy( New_Server.pwd_in, Arg, sizeof( New_Server.pwd_in ));
960                 if (len >= sizeof( New_Server.pwd_in ))
961                         Config_Error_TooLong( Line, Var );
962                 return;
963         }
964         if( strcasecmp( Var, "PeerPassword" ) == 0 ) {
965                 /* Passwort of the peer which must be received */
966                 len = strlcpy( New_Server.pwd_out, Arg, sizeof( New_Server.pwd_out ));
967                 if (len >= sizeof( New_Server.pwd_out ))
968                         Config_Error_TooLong( Line, Var );
969                 return;
970         }
971         if( strcasecmp( Var, "Port" ) == 0 ) {
972                 /* Port to which this server should connect */
973                 port = atol( Arg );
974                 if( port > 0 && port < 0xFFFF )
975                         New_Server.port = (UINT16)port;
976                 else
977                         Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!",
978                                                                                 NGIRCd_ConfFile, Line, port );
979                 return;
980         }
981         if( strcasecmp( Var, "Group" ) == 0 ) {
982                 /* Server group */
983 #ifdef HAVE_ISDIGIT
984                 if( ! isdigit( (int)*Arg ))
985                         Config_Error_NaN( Line, Var );
986                 else
987 #endif
988                 New_Server.group = atoi( Arg );
989                 return;
990         }
991         if( strcasecmp( Var, "Passive" ) == 0 ) {
992                 if (Check_ArgIsTrue(Arg))
993                         New_Server.flags |= CONF_SFLAG_DISABLED;
994                 return;
995         }
996         
997         Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Unknown variable \"%s\"!",
998                                                                 NGIRCd_ConfFile, Line, Var );
999 } /* Handle_SERVER */
1000
1001
1002 static bool
1003 Handle_Channelname(size_t chancount, const char *name)
1004 {
1005         size_t size = sizeof( Conf_Channel[chancount].name );
1006         char *dest = Conf_Channel[chancount].name;
1007
1008         if (*name && *name != '#') {
1009                 *dest = '#';
1010                 --size;
1011                 ++dest;
1012         }
1013         return size > strlcpy(dest, name, size);
1014 }
1015
1016
1017 static void
1018 Handle_CHANNEL( int Line, char *Var, char *Arg )
1019 {
1020         size_t len;
1021         size_t chancount = 0;
1022
1023         assert( Line > 0 );
1024         assert( Var != NULL );
1025         assert( Arg != NULL );
1026         if (Conf_Channel_Count > 0)
1027                 chancount = Conf_Channel_Count - 1;
1028
1029         if( strcasecmp( Var, "Name" ) == 0 ) {
1030                 if (!Handle_Channelname(chancount, Arg))
1031                         Config_Error_TooLong( Line, Var );
1032                 return;
1033         }
1034         if( strcasecmp( Var, "Modes" ) == 0 ) {
1035                 /* Initial modes */
1036                 len = strlcpy( Conf_Channel[chancount].modes, Arg, sizeof( Conf_Channel[chancount].modes ));
1037                 if (len >= sizeof( Conf_Channel[chancount].modes ))
1038                         Config_Error_TooLong( Line, Var );
1039                 return;
1040         }
1041         if( strcasecmp( Var, "Topic" ) == 0 ) {
1042                 /* Initial topic */
1043                 if (!array_copys( &Conf_Channel[chancount].topic, Arg))
1044                         Config_Error_TooLong( Line, Var );
1045                 return;
1046         }
1047
1048         if( strcasecmp( Var, "Key" ) == 0 ) {
1049                 /* Initial Channel Key (mode k) */
1050                 len = strlcpy(Conf_Channel[chancount].key, Arg, sizeof(Conf_Channel[chancount].key));
1051                 if (len >= sizeof( Conf_Channel[chancount].key ))
1052                         Config_Error_TooLong(Line, Var);
1053                 return;
1054         }
1055
1056         if( strcasecmp( Var, "MaxUsers" ) == 0 ) {
1057                 /* maximum user limit, mode l */
1058                 Conf_Channel[chancount].maxusers = (unsigned long) atol(Arg);
1059                 if (Conf_Channel[chancount].maxusers == 0)
1060                         Config_Error_NaN(Line, Var);
1061                 return;
1062         }
1063
1064         Config_Error( LOG_ERR, "%s, line %d (section \"Channel\"): Unknown variable \"%s\"!",
1065                                                                 NGIRCd_ConfFile, Line, Var );
1066 } /* Handle_CHANNEL */
1067
1068
1069 static void
1070 Validate_Config(bool Configtest, bool Rehash)
1071 {
1072         /* Validate configuration settings. */
1073
1074 #ifdef DEBUG
1075         int i, servers, servers_once;
1076 #endif
1077         char *ptr;
1078
1079         /* Validate configured server name, see RFC 2812 section 2.3.1 */
1080         ptr = Conf_ServerName;
1081         do {
1082                 if (*ptr >= 'a' && *ptr <= 'z') continue;
1083                 if (*ptr >= 'A' && *ptr <= 'Z') continue;
1084                 if (*ptr >= '0' && *ptr <= '9') continue;
1085                 if (ptr > Conf_ServerName) {
1086                         if (*ptr == '.' || *ptr == '-')
1087                                 continue;
1088                 }
1089                 Conf_ServerName[0] = '\0';
1090                 break;
1091         } while (*(++ptr));
1092
1093         if (!Conf_ServerName[0]) {
1094                 /* No server name configured! */
1095                 Config_Error(LOG_ALERT,
1096                              "No (valid) server name configured in \"%s\" (section 'Global': 'Name')!",
1097                              NGIRCd_ConfFile);
1098                 if (!Configtest && !Rehash) {
1099                         Config_Error(LOG_ALERT,
1100                                      "%s exiting due to fatal errors!",
1101                                      PACKAGE_NAME);
1102                         exit(1);
1103                 }
1104         }
1105
1106         if (Conf_ServerName[0] && !strchr(Conf_ServerName, '.')) {
1107                 /* No dot in server name! */
1108                 Config_Error(LOG_ALERT,
1109                              "Invalid server name configured in \"%s\" (section 'Global': 'Name'): Dot missing!",
1110                              NGIRCd_ConfFile);
1111                 if (!Configtest) {
1112                         Config_Error(LOG_ALERT,
1113                                      "%s exiting due to fatal errors!",
1114                                      PACKAGE_NAME);
1115                         exit(1);
1116                 }
1117         }
1118
1119 #ifdef STRICT_RFC
1120         if (!Conf_ServerAdminMail[0]) {
1121                 /* No administrative contact configured! */
1122                 Config_Error(LOG_ALERT,
1123                              "No administrator email address configured in \"%s\" ('AdminEMail')!",
1124                              NGIRCd_ConfFile);
1125                 if (!Configtest) {
1126                         Config_Error(LOG_ALERT,
1127                                      "%s exiting due to fatal errors!",
1128                                      PACKAGE_NAME);
1129                         exit(1);
1130                 }
1131         }
1132 #endif
1133
1134         if (!Conf_ServerAdmin1[0] && !Conf_ServerAdmin2[0]
1135             && !Conf_ServerAdminMail[0]) {
1136                 /* No administrative information configured! */
1137                 Config_Error(LOG_WARNING,
1138                              "No administrative information configured but required by RFC!");
1139         }
1140
1141 #ifdef DEBUG
1142         servers = servers_once = 0;
1143         for (i = 0; i < MAX_SERVERS; i++) {
1144                 if (Conf_Server[i].name[0]) {
1145                         servers++;
1146                         if (Conf_Server[i].flags & CONF_SFLAG_ONCE)
1147                                 servers_once++;
1148                 }
1149         }
1150         Log(LOG_DEBUG,
1151             "Configuration: Operators=%d, Servers=%d[%d], Channels=%d",
1152             Conf_Oper_Count, servers, servers_once, Conf_Channel_Count);
1153 #endif
1154 } /* Validate_Config */
1155
1156
1157 static void
1158 Config_Error_TooLong ( const int Line, const char *Item )
1159 {
1160         Config_Error( LOG_WARNING, "%s, line %d: Value of \"%s\" too long!", NGIRCd_ConfFile, Line, Item );
1161 }
1162
1163
1164 static void
1165 Config_Error_NaN( const int Line, const char *Item )
1166 {
1167         Config_Error( LOG_WARNING, "%s, line %d: Value of \"%s\" is not a number!",
1168                                                 NGIRCd_ConfFile, Line, Item );
1169 }
1170
1171
1172 #ifdef PROTOTYPES
1173 static void Config_Error( const int Level, const char *Format, ... )
1174 #else
1175 static void Config_Error( Level, Format, va_alist )
1176 const int Level;
1177 const char *Format;
1178 va_dcl
1179 #endif
1180 {
1181         /* Error! Write to console and/or logfile. */
1182
1183         char msg[MAX_LOG_MSG_LEN];
1184         va_list ap;
1185
1186         assert( Format != NULL );
1187
1188 #ifdef PROTOTYPES
1189         va_start( ap, Format );
1190 #else
1191         va_start( ap );
1192 #endif
1193         vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
1194         va_end( ap );
1195         
1196         /* During "normal operations" the log functions of the daemon should
1197          * be used, but during testing of the configuration file, all messages
1198          * should go directly to the console: */
1199         if (Use_Log) Log( Level, "%s", msg );
1200         else puts( msg );
1201 } /* Config_Error */
1202
1203
1204 static void
1205 Init_Server_Struct( CONF_SERVER *Server )
1206 {
1207         /* Initialize server configuration structur to default values */
1208
1209         assert( Server != NULL );
1210
1211         memset( Server, 0, sizeof (CONF_SERVER) );
1212
1213         Server->group = NONE;
1214         Server->lasttry = time( NULL ) - Conf_ConnectRetry + STARTUP_DELAY;
1215
1216         if( NGIRCd_Passive ) Server->flags = CONF_SFLAG_DISABLED;
1217
1218         Resolve_Init(&Server->res_stat);
1219         Server->conn_id = NONE;
1220         memset(&Server->bind_addr, 0, sizeof(&Server->bind_addr));
1221 } /* Init_Server_Struct */
1222
1223
1224 /* -eof- */