* 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.33 2002/10/09 16:53:02 alex Exp $
+ * $Id: conf.c,v 1.36 2002/11/08 23:09:26 alex Exp $
*
* conf.h: Konfiguration des ngircd
*/
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
+#include <sys/types.h>
#include "ngircd.h"
#include "conn.h"
{
/* Konfiguration einlesen, ueberpruefen und ausgeben. */
+ struct passwd *pwd;
+ struct group *grp;
INT i;
Use_Log = FALSE;
printf( "%u", Conf_ListenPorts[i] );
}
puts( "" );
- printf( " ServerUID = %ld\n", (LONG)Conf_UID );
- printf( " ServerGID = %ld\n", (LONG)Conf_GID );
+ pwd = getpwuid( Conf_UID );
+ if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name );
+ else printf( " ServerUID = %ld\n", (LONG)Conf_UID );
+ grp = getgrgid( Conf_GID );
+ if( grp ) printf( " ServerGID = %s\n", grp->gr_name );
+ else 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" );
+ if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
+ else printf( " MaxConnections = -1\n" );
puts( "" );
for( i = 0; i < Conf_Oper_Count; i++ )
Conf_Channel_Count = 0;
Conf_OperCanMode = FALSE;
+
+ Conf_MaxConnections = 0;
} /* Set_Defaults */
LOCAL VOID
Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
+ struct passwd *pwd;
+ struct group *grp;
CHAR *ptr;
LONG port;
if( strcasecmp( Var, "ServerUID" ) == 0 )
{
/* UID, mit der der Daemon laufen soll */
- Conf_UID = (UINT)atoi( Arg );
+ pwd = getpwnam( Arg );
+ if( pwd ) Conf_UID = pwd->pw_uid;
+ else Conf_UID = (UINT)atoi( Arg );
return;
}
if( strcasecmp( Var, "ServerGID" ) == 0 )
{
/* GID, mit der der Daemon laufen soll */
- Conf_GID = (UINT)atoi( Arg );
+ grp = getgrnam( Arg );
+ if( grp ) Conf_GID = grp->gr_gid;
+ else Conf_GID = (UINT)atoi( Arg );
return;
}
if( strcasecmp( Var, "PingTimeout" ) == 0 )
else Conf_OperCanMode = FALSE;
return;
}
+ if( strcasecmp( Var, "MaxConnections" ) == 0 )
+ {
+ /* Maximale Anzahl von Verbindungen. Werte <= 0 stehen
+ * fuer "kein Limit". */
+ Conf_MaxConnections = atol( Arg );
+ return;
+ }
Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
} /* Handle_GLOBAL */
}
#ifdef STRICT_RFC
- if( ! ConfAdminMail[0] )
+ if( ! Conf_ServerAdminMail[0] )
{
/* Keine Server-Information konfiguriert */
Config_Error( LOG_ALERT, "No administrator email address configured in \"%s\" ('AdminEMail')!", NGIRCd_ConfFile );