diff -r f5caf41b4db6 -r 30d29ef5b79a src/server/daemon/config.c --- a/src/server/daemon/config.c Sun Sep 25 09:33:39 2022 +0200 +++ b/src/server/daemon/config.c Sun Sep 25 10:36:28 2022 +0200 @@ -131,7 +131,7 @@ return 0; } -ServerConfiguration* load_server_conf(char *file) { +ServerConfiguration* load_server_conf(CfgManager *mgr, char *file) { log_ereport(LOG_VERBOSE, "load_server_conf"); ServerConfig *serverconf = serverconfig_load(file); @@ -139,6 +139,7 @@ log_ereport(LOG_FAILURE, "Cannot load server.conf"); return NULL; } + mgr->serverconf = serverconf; pool_handle_t *pool = pool_create(); @@ -152,15 +153,10 @@ *serverconfig->a = allocator; serverconfig->listeners = NULL; - serverconfig->host_vs = ucx_map_new_a(&allocator, 16); - serverconfig->authdbs = ucx_map_new_a(&allocator, 16); - serverconfig->resources = ucx_map_new_a(&allocator, 16); - serverconfig->dav = ucx_map_new_a(&allocator, 16); - - - - // TODO: init serverconfig stuff - + serverconfig->host_vs = ucx_map_new_a(serverconfig->a, 16); + serverconfig->authdbs = ucx_map_new_a(serverconfig->a, 16); + serverconfig->resources = ucx_map_new_a(serverconfig->a, 16); + serverconfig->dav = ucx_map_new_a(serverconfig->a, 16); /* * convert ServerConfig to ServerConfiguration @@ -175,12 +171,29 @@ * VirtualServer (dependencies: Listener) */ - /* - * free stuff on error - */ + // load Runtime infos first, because we need that to change the uid + // and the server should do that as soon as possible + UcxList *list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("Runtime")); + UCX_FOREACH(elm, list) { + ConfigNode *runtimeobj = elm->data; + if(cfg_handle_runtime(serverconfig, runtimeobj)) { + // error + return NULL; + } + } + ucx_list_free(list); + + // we return here, to let the webserver use the runtime info to + // change the uid if needed + return serverconfig; +} + +ServerConfiguration* apply_server_conf(CfgManager *mgr) { + ServerConfig *serverconf = mgr->serverconf; + ServerConfiguration *serverconfig = mgr->cfg; // init logfile first - UcxList *list = NULL; + UcxList *list; list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("LogFile")); if(list) { @@ -201,15 +214,7 @@ } ucx_list_free(list); - list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("Runtime")); - UCX_FOREACH(elm, list) { - ConfigNode *runtimeobj = elm->data; - if(cfg_handle_runtime(serverconfig, runtimeobj)) { - // error - return NULL; - } - } - ucx_list_free(list); + list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("Threadpool")); UCX_FOREACH(elm, list) {