|
From: <mla...@us...> - 2006-11-21 16:32:37
|
Revision: 191
http://svn.sourceforge.net/g15daemon/?rev=191&view=rev
Author: mlampard
Date: 2006-11-21 08:32:31 -0800 (Tue, 21 Nov 2006)
Log Message:
-----------
add configitem for cycle key. cmdline will still override if used
Modified Paths:
--------------
trunk/g15daemon-wip/g15daemon/main.c
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2006-11-21 16:31:03 UTC (rev 190)
+++ trunk/g15daemon-wip/g15daemon/main.c 2006-11-21 16:32:31 UTC (rev 191)
@@ -246,6 +246,7 @@
pid_t daemonpid;
int retval;
int i;
+ int cycle_cmdline_override=0;
struct sigaction new_action;
cycle_key = G15_KEY_MR;
unsigned char user[256];
@@ -281,6 +282,7 @@
if (!strncmp(daemonargs, "-s",2) || !strncmp(daemonargs, "--switch",8)) {
cycle_key = G15_KEY_L1;
+ cycle_cmdline_override=1;
}
if (!strncmp(daemonargs, "-d",2) || !strncmp(daemonargs, "--debug",7)) {
@@ -312,6 +314,7 @@
if(uf_create_pidfile() == 0) {
g15daemon_t *lcdlist;
+ config_section_t *global_cfg=NULL;
pthread_attr_t attr;
struct passwd *nobody;
unsigned char location[1024];
@@ -336,7 +339,11 @@
lcdlist->nobody = nobody;
uf_conf_open(lcdlist, "/etc/g15daemon.conf");
- /* all other processes/threads should be seteuid nobody */
+ global_cfg=g15daemon_cfg_load_section(lcdlist,"Global");
+ if(!cycle_cmdline_override){
+ cycle_key = 1==g15daemon_cfg_read_bool(global_cfg,"Use MR as Cycle Key",0)?G15_KEY_MR:G15_KEY_L1;
+ }
+ /* all other processes/threads should be seteuid nobody */
if(nobody!=NULL) {
seteuid(nobody->pw_uid);
setegid(nobody->pw_gid);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|