* 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.27 2002/05/30 16:52:21 alex Exp $
+ * $Id: conf.c,v 1.34 2002/10/21 13:45:07 alex Exp $
*
* conf.h: Konfiguration des ngircd
*/
{
/* Konfiguration einlesen, ueberpruefen und ausgeben. */
- UINT i;
+ INT i;
Use_Log = FALSE;
Set_Defaults( );
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++ )
printf( "%u", Conf_ListenPorts[i] );
}
puts( "" );
- printf( " ServerUID = %ld\n", (INT32)Conf_UID );
- printf( " ServerGID = %ld\n", (INT32)Conf_GID );
+ printf( " ServerUID = %ld\n", (LONG)Conf_UID );
+ printf( " ServerGID = %ld\n", (LONG)Conf_GID );
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++ )
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;
Conf_Oper_Count = 0;
Conf_Server_Count = 0;
Conf_Channel_Count = 0;
+
+ Conf_OperCanMode = FALSE;
} /* Set_Defaults */
Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
CHAR *ptr;
- INT32 port;
+ LONG port;
assert( Line > 0 );
assert( Var != NULL );
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
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 */
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 )
LOCAL VOID
Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg )
{
- INT32 port;
+ LONG port;
assert( Line > 0 );
assert( Var != NULL );
if( ! Conf_ServerName[0] )
{
/* Kein Servername konfiguriert */
- Config_Error( LOG_ALERT, "No server name configured in \"%s\"!", NGIRCd_ConfFile );
+ 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( ! Conf_ServerAdminMail[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 */
/* Im "normalen Betrieb" soll der Log-Mechanismus des ngIRCd verwendet
* werden, beim Testen der Konfiguration jedoch nicht, hier sollen alle
* Meldungen direkt auf die Konsole ausgegeben werden: */
- if( Use_Log ) Log( Level, msg );
+ if( Use_Log ) Log( Level, "%s", msg );
else puts( msg );
} /* Config_Error */