89 if(load_init_conf("config/init.conf")) { |
89 if(load_init_conf("config/init.conf")) { |
90 return -1; |
90 return -1; |
91 } |
91 } |
92 |
92 |
93 // load server.conf |
93 // load server.conf |
|
94 // Only the runtime infos are stored in the ServerConfiguration at |
|
95 // this stage. The remaining configuration is loaded after the uid |
|
96 // is changed (if needed). |
94 init_configuration_manager(); |
97 init_configuration_manager(); |
95 ServerConfiguration *cfg; |
98 CfgManager mgr; |
96 if(cfgmgr_load_config(&cfg) != 0) { |
99 if(cfgmgr_load_config(&mgr) != 0) { |
97 return -1; |
100 return -1; |
98 } |
101 } |
|
102 ServerConfiguration *cfg = mgr.cfg; |
99 |
103 |
100 // init caches |
104 // init caches |
101 auth_cache_init(); |
105 auth_cache_init(); |
102 |
106 |
103 // init SAFs |
107 // init SAFs |
160 } else if(vars->Vuserpw) { |
164 } else if(vars->Vuserpw) { |
161 log_ereport( |
165 log_ereport( |
162 LOG_WARN, |
166 LOG_WARN, |
163 "server must be started as root to change uid"); |
167 "server must be started as root to change uid"); |
164 } |
168 } |
|
169 |
|
170 |
|
171 // now that the process is running as the correct user, we can load |
|
172 // the remaining config |
|
173 if(cfgmgr_apply_config(&mgr)) { |
|
174 return -1; |
|
175 } |
|
176 |
165 |
177 |
166 // create tmp dir and pid file |
178 // create tmp dir and pid file |
167 char *mkdir_cmd = NULL; |
179 char *mkdir_cmd = NULL; |
168 asprintf(&mkdir_cmd, "mkdir -p %s", cfg->tmp.ptr); |
180 asprintf(&mkdir_cmd, "mkdir -p %s", cfg->tmp.ptr); |
169 system(mkdir_cmd); |
181 system(mkdir_cmd); |