X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconf.c;h=96822f7121a885164ea1a45a6ff9b00b836f6bb7;hb=7a2b49a6293a82cf118abd6dc12ed34300480547;hp=4a4fe216c6e365128b91335b4871fd5f4a4089fd;hpb=c2f60abe55b5a8d320a27df0ce41790fa1141081;p=ngircd-alex.git diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 4a4fe216..96822f71 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -9,7 +9,7 @@ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS. * - * $Id: conf.c,v 1.26 2002/05/27 13:09:26 alex Exp $ + * $Id: conf.c,v 1.30 2002/09/19 10:19:12 alex Exp $ * * conf.h: Konfiguration des ngircd */ @@ -87,6 +87,9 @@ Conf_Test( VOID ) printf( " ServerName = %s\n", Conf_ServerName ); printf( " ServerInfo = %s\n", Conf_ServerInfo ); printf( " ServerPwd = %s\n", Conf_ServerPwd ); + printf( " AdminInfo1 = %s\n", Conf_ServerAdmin1 ); + printf( " AdminInfo2 = %s\n", Conf_ServerAdmin2 ); + printf( " AdminEMail = %s\n", Conf_ServerAdminMail ); printf( " MotdFile = %s\n", Conf_MotdFile ); printf( " ListenPorts = " ); for( i = 0; i < Conf_ListenPorts_Count; i++ ) @@ -100,6 +103,7 @@ Conf_Test( VOID ) printf( " PingTimeout = %d\n", Conf_PingTimeout ); printf( " PongTimeout = %d\n", Conf_PongTimeout ); printf( " ConnectRetry = %d\n", Conf_ConnectRetry ); + printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" ); puts( "" ); for( i = 0; i < Conf_Oper_Count; i++ ) @@ -150,9 +154,13 @@ Set_Defaults( VOID ) /* Konfigurationsvariablen initialisieren, d.h. auf Default-Werte setzen. */ strcpy( Conf_ServerName, "" ); - strcpy( Conf_ServerInfo, PACKAGE" "VERSION ); + sprintf( Conf_ServerInfo, "%s %s", PACKAGE, VERSION ); strcpy( Conf_ServerPwd, "" ); + strcpy( Conf_ServerAdmin1, "" ); + strcpy( Conf_ServerAdmin2, "" ); + strcpy( Conf_ServerAdminMail, "" ); + strcpy( Conf_MotdFile, MOTD_FILE ); Conf_ListenPorts_Count = 0; @@ -167,6 +175,8 @@ Set_Defaults( VOID ) Conf_Oper_Count = 0; Conf_Server_Count = 0; Conf_Channel_Count = 0; + + Conf_OperCanMode = FALSE; } /* Set_Defaults */ @@ -184,7 +194,7 @@ Read_Config( VOID ) { /* Keine Konfigurationsdatei gefunden */ Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s", NGIRCd_ConfFile, strerror( errno )); - Config_Error( LOG_ALERT, PACKAGE" exiting due to fatal errors!" ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); exit( 1 ); } @@ -312,6 +322,27 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0'; return; } + if( strcasecmp( Var, "AdminInfo1" ) == 0 ) + { + /* Server-Info-Text */ + strncpy( Conf_ServerAdmin1, Arg, CLIENT_INFO_LEN - 1 ); + Conf_ServerAdmin1[CLIENT_INFO_LEN - 1] = '\0'; + return; + } + if( strcasecmp( Var, "AdminInfo2" ) == 0 ) + { + /* Server-Info-Text */ + strncpy( Conf_ServerAdmin2, Arg, CLIENT_INFO_LEN - 1 ); + Conf_ServerAdmin2[CLIENT_INFO_LEN - 1] = '\0'; + return; + } + if( strcasecmp( Var, "AdminEMail" ) == 0 ) + { + /* Server-Info-Text */ + strncpy( Conf_ServerAdminMail, Arg, CLIENT_INFO_LEN - 1 ); + Conf_ServerAdminMail[CLIENT_INFO_LEN - 1] = '\0'; + return; + } if( strcasecmp( Var, "Ports" ) == 0 ) { /* Ports, durch "," getrennt, auf denen der Server @@ -371,6 +402,15 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) if(( Conf_ConnectRetry ) < 5 ) Conf_ConnectRetry = 5; return; } + if( strcasecmp( Var, "OperCanUseMode" ) == 0 ) + { + /* Koennen IRC-Operatoren immer MODE benutzen? */ + if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE; + else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE; + else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE; + else Conf_OperCanMode = FALSE; + return; + } Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var ); } /* Handle_GLOBAL */ @@ -387,8 +427,8 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg ) if( strcasecmp( Var, "Name" ) == 0 ) { /* Name des IRC Operator */ - strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_ID_LEN - 1 ); - Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_ID_LEN - 1] = '\0'; + strncpy( Conf_Oper[Conf_Oper_Count - 1].name, Arg, CLIENT_PASS_LEN - 1 ); + Conf_Oper[Conf_Oper_Count - 1].name[CLIENT_PASS_LEN - 1] = '\0'; return; } if( strcasecmp( Var, "Password" ) == 0 ) @@ -493,15 +533,37 @@ Validate_Config( VOID ) if( ! Conf_ServerName[0] ) { /* Kein Servername konfiguriert */ - Config_Error( LOG_ALERT, "No server name configured in \"%s\"!", NGIRCd_ConfFile ); - Config_Error( LOG_ALERT, PACKAGE" exiting due to fatal errors!" ); + Config_Error( LOG_ALERT, "No server name configured in \"%s\" ('ServerName')!", NGIRCd_ConfFile ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); + exit( 1 ); + } + +#ifdef STRICT_RFC + if( ! ConfAdminMail[0] ) + { + /* Keine Server-Information konfiguriert */ + Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile ); + Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE ); exit( 1 ); } +#endif + + if( ! Conf_ServerAdmin1[0] && ! Conf_ServerAdmin2[0] && ! Conf_ServerAdminMail[0] ) + { + /* Keine Server-Information konfiguriert */ + Log( LOG_WARNING, "No server information configured but required by RFC!" ); + } } /* Validate_Config */ -LOCAL VOID -Config_Error( CONST INT Level, CONST CHAR *Format, ... ) +#ifdef PROTOTYPES +LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... ) +#else +LOCAL VOID Config_Error( Level, Format, va_alist ) +CONST INT Level; +CONST CHAR *Format; +va_dcl +#endif { /* Fehler! Auf Console und/oder ins Log schreiben */ @@ -511,7 +573,11 @@ Config_Error( CONST INT Level, CONST CHAR *Format, ... ) assert( Format != NULL ); /* String mit variablen Argumenten zusammenbauen ... */ +#ifdef PROTOTYPES va_start( ap, Format ); +#else + va_start( ap ); +#endif vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap ); va_end( ap );