Changeset aaf92a9
- Timestamp:
- 2007-12-02T23:18:25Z (17 years ago)
- Branches:
- master
- Children:
- 08135df, de03374
- Parents:
- 80e9db9
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.conf
r80e9db9 raaf92a9 19 19 ## 20 20 # RunMode = Inetd 21 22 ## User: 23 ## 24 ## If BitlBee is started by root as a daemon, it can drop root privileges, 25 ## and change to the specified user. 26 ## 27 # User = bitlbee 21 28 22 29 ## DaemonPort/DaemonInterface: -
conf.c
r80e9db9 raaf92a9 63 63 conf->ping_interval = 180; 64 64 conf->ping_timeout = 300; 65 conf->user = NULL; 65 66 proxytype = 0; 66 67 … … 76 77 } 77 78 78 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR: " ) ) >= 0 )79 while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:u:" ) ) >= 0 ) 79 80 /* ^^^^ Just to make sure we skip this step from the REHASH handler. */ 80 81 { … … 132 133 " -D Daemon mode. (Still EXPERIMENTAL!)\n" 133 134 " -F Forking daemon. (one process per client)\n" 135 " -u Run daemon as specified user.\n" 134 136 " -P Specify PID-file (not for inetd mode)\n" 135 137 " -i Specify the interface (by IP address) to listen on.\n" … … 151 153 ipc_master_set_statefile( optarg ); 152 154 } 155 else if( opt == 'u' ) 156 { 157 g_free( conf->user ); 158 conf->user = g_strdup( optarg ); 159 } 153 160 } 154 161 … … 192 199 else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 ) 193 200 { 201 g_free( conf->iface ); 194 202 conf->iface = g_strdup( ini->value ); 195 203 } 196 204 else if( g_strcasecmp( ini->key, "daemonport" ) == 0 ) 197 205 { 206 g_free( conf->port ); 198 207 conf->port = g_strdup( ini->value ); 199 208 } … … 209 218 else if( g_strcasecmp( ini->key, "authpassword" ) == 0 ) 210 219 { 220 g_free( conf->auth_pass ); 211 221 conf->auth_pass = g_strdup( ini->value ); 212 222 } 213 223 else if( g_strcasecmp( ini->key, "operpassword" ) == 0 ) 214 224 { 225 g_free( conf->oper_pass ); 215 226 conf->oper_pass = g_strdup( ini->value ); 216 227 } 217 228 else if( g_strcasecmp( ini->key, "hostname" ) == 0 ) 218 229 { 230 g_free( conf->hostname ); 219 231 conf->hostname = g_strdup( ini->value ); 220 232 } … … 281 293 g_free( url ); 282 294 } 295 else if( g_strcasecmp( ini->key, "user" ) == 0 ) 296 { 297 g_free( conf->user ); 298 conf->user = g_strdup( ini->value ); 299 } 283 300 else 284 301 { -
conf.h
r80e9db9 raaf92a9 49 49 int ping_interval; 50 50 int ping_timeout; 51 char *user; 51 52 } conf_t; 52 53 -
unix.c
r80e9db9 raaf92a9 34 34 #include <sys/time.h> 35 35 #include <sys/wait.h> 36 #include <pwd.h> 36 37 37 38 global_t global; /* Against global namespace pollution */ … … 45 46 struct sigaction sig, old; 46 47 47 memset( &global, 0, sizeof( global_t ) );48 49 48 log_init(); 50 49 CONF_FILE = g_strdup( CONF_FILE_DEF ); … … 87 86 return( i ); 88 87 88 if( ( global.conf->user && *global.conf->user ) && 89 ( global.conf->runmode == RUNMODE_DAEMON || 90 global.conf->runmode == RUNMODE_FORKDAEMON ) && 91 ( !getuid() || !geteuid() ) ) 92 { 93 struct passwd *pw = NULL; 94 pw = getpwnam( global.conf->user ); 95 if( pw ) 96 { 97 setgid( pw->pw_gid ); 98 setuid( pw->pw_uid ); 99 } 100 } 101 89 102 global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage ); 90 if ( global.storage == NULL) { 103 if( global.storage == NULL ) 104 { 91 105 log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage ); 92 106 return( 1 ); 93 107 } 94 95 108 96 109 /* Catch some signals to tell the user what's happening before quitting */
Note: See TracChangeset
for help on using the changeset viewer.