diff options
author | ulim <a.sporto+bee@gmail.com> | 2007-12-05 02:30:50 +0100 |
---|---|---|
committer | ulim <a.sporto+bee@gmail.com> | 2007-12-05 02:30:50 +0100 |
commit | 8076ec04b1b5699f8266fa0e2e17456974ced554 (patch) | |
tree | c53680ef30c2368e99f396e5e147b9c08437e46e /conf.c | |
parent | dce390357114e30a424106c99e49cef1e682e1af (diff) | |
parent | 793cc254ad2479d95d00266d6cb7ab2bcd158834 (diff) |
merges from upstream/release
ulim 2007-12-04 Follow rename of jabber_chat_by_jid from upstrem
ulim 2007-12-04 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
ulim 2007-12-04 Jabber file transfer now also with sending! You can't use a proxy yet when
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.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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 ); |