* 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.35 2002/11/02 22:59:01 alex Exp $
+ * $Id: conf.c,v 1.37 2002/11/18 18:47:42 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( " AdminInfo2 = %s\n", Conf_ServerAdmin2 );
printf( " AdminEMail = %s\n", Conf_ServerAdminMail );
printf( " MotdFile = %s\n", Conf_MotdFile );
- printf( " ListenPorts = " );
+ printf( " Ports = " );
for( i = 0; i < Conf_ListenPorts_Count; i++ )
{
if( i != 0 ) printf( ", " );
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 );
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 )