aboutsummaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorulim <a.sporto+bee@gmail.com>2007-12-04 02:08:43 +0100
committerulim <a.sporto+bee@gmail.com>2007-12-04 02:08:43 +0100
commit08135dff0e668622fc858d2ad8a7d0bdbdb8cb24 (patch)
treed46ae0a920d1db0a9f710cb916657ae549db31cb /conf.c
parentfa30fa598d2e77c998f9156d0f31ccf99b0c781f (diff)
parentaaf92a9eb64327892e39fdbd7113d797d1d68cec (diff)
Merged in current devel
Wilmer van der Gaast 2007-12-02 Imported setuid() patch from Simo Leone <simo@archlinux...> with some Wilmer van der Gaast 2007-12-02 Forgot to return something in jabber_chat_join_failed(). Wilmer van der Gaast 2007-12-02 Merging a change I should've pulled before committing three other changes. Wilmer van der Gaast 2007-12-02 Added charset checks on incoming msgs (from the IRC side) to prevent possible Wilmer van der Gaast 2007-12-02 Handling of presence-error packets (only useful for groupchats now), moved Wilmer van der Gaast 2007-12-02 Defining DEBUG via CFLAGS so that it'll always be there, even when a file Wilmer van der Gaast 2007-12-02 Removed retarded printf() (ARGH) and moved the event handling handling of Wilmer van der Gaast 2007-11-29 printf() in daemons considered harmful. Wilmer van der Gaast 2007-11-28 Fixed the epoll+ForkDaemon combination. The libevent event handling
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index 1768866b..e1a44710 100644
--- a/conf.c
+++ b/conf.c
@@ -62,6 +62,7 @@ conf_t *conf_load( int argc, char *argv[] )
conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
conf->ping_interval = 180;
conf->ping_timeout = 300;
+ conf->user = NULL;
conf->max_filetransfer_size = G_MAXUINT;
proxytype = 0;
@@ -76,7 +77,7 @@ conf_t *conf_load( int argc, char *argv[] )
fprintf( stderr, "Warning: Unable to read configuration file `%s'.\n", CONF_FILE );
}
- while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:" ) ) >= 0 )
+ while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 )
/* ^^^^ Just to make sure we skip this step from the REHASH handler. */
{
if( opt == 'i' )
@@ -132,6 +133,7 @@ conf_t *conf_load( int argc, char *argv[] )
" -I Classic/InetD mode. (Default)\n"
" -D Daemon mode. (Still EXPERIMENTAL!)\n"
" -F Forking daemon. (one process per client)\n"
+ " -u Run daemon as specified user.\n"
" -P Specify PID-file (not for inetd mode)\n"
" -i Specify the interface (by IP address) to listen on.\n"
" (Default: 0.0.0.0 (any interface))\n"
@@ -151,6 +153,11 @@ conf_t *conf_load( int argc, char *argv[] )
mode anyway!) */
ipc_master_set_statefile( optarg );
}
+ else if( opt == 'u' )
+ {
+ g_free( conf->user );
+ conf->user = g_strdup( optarg );
+ }
}
if( conf->configdir[strlen(conf->configdir)-1] != '/' )
@@ -192,10 +199,12 @@ static int conf_loadini( conf_t *conf, char *file )
}
else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
{
+ g_free( conf->iface );
conf->iface = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "daemonport" ) == 0 )
{
+ g_free( conf->port );
conf->port = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "authmode" ) == 0 )
@@ -209,14 +218,17 @@ static int conf_loadini( conf_t *conf, char *file )
}
else if( g_strcasecmp( ini->key, "authpassword" ) == 0 )
{
+ g_free( conf->auth_pass );
conf->auth_pass = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "operpassword" ) == 0 )
{
+ g_free( conf->oper_pass );
conf->oper_pass = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "hostname" ) == 0 )
{
+ g_free( conf->hostname );
conf->hostname = g_strdup( ini->value );
}
else if( g_strcasecmp( ini->key, "configdir" ) == 0 )
@@ -281,6 +293,11 @@ static int conf_loadini( conf_t *conf, char *file )
g_free( url );
}
+ else if( g_strcasecmp( ini->key, "user" ) == 0 )
+ {
+ g_free( conf->user );
+ conf->user = g_strdup( ini->value );
+ }
else
{
fprintf( stderr, "Error: Unknown setting `%s` in configuration file.\n", ini->key );