diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 7ce67ff5931..68d36b91c2c 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2226,7 +2226,7 @@ int main(int argc, const char *argv[]) ret = close(STDIN_FILENO); if (ret != EOK) return 6; - ret = server_setup(SSSD_MONITOR_NAME, false, flags, 0, 0, + ret = server_setup(SSSD_MONITOR_NAME, false, flags, 0, 0, CONFDB_FILE, monitor->conf_path, &main_ctx, false); if (ret != EOK) return 2; diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 9e961fa3f80..91795fdc06b 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -830,7 +830,8 @@ int main(int argc, const char *argv[]) confdb_path = talloc_asprintf(NULL, CONFDB_DOMAIN_PATH_TMPL, be_domain); if (!confdb_path) return 2; - ret = server_setup(srv_name, false, 0, 0, 0, confdb_path, &main_ctx, false); + ret = server_setup(srv_name, false, 0, 0, 0, CONFDB_FILE, + confdb_path, &main_ctx, false); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Could not set up mainloop [%d]\n", ret); return 2; diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c index fada1e6861d..3975db9655a 100644 --- a/src/providers/proxy/proxy_child.c +++ b/src/providers/proxy/proxy_child.c @@ -562,7 +562,8 @@ int main(int argc, const char *argv[]) conf_entry = talloc_asprintf(NULL, CONFDB_DOMAIN_PATH_TMPL, domain); if (!conf_entry) return 2; - ret = server_setup(srv_name, false, 0, 0, 0, conf_entry, &main_ctx, true); + ret = server_setup(srv_name, false, 0, 0, 0, CONFDB_FILE, conf_entry, + &main_ctx, true); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Could not set up mainloop [%d]\n", ret); return 2; diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c index 1dbbe9fecb2..8af772b94cb 100644 --- a/src/responder/autofs/autofssrv.c +++ b/src/responder/autofs/autofssrv.c @@ -215,7 +215,7 @@ int main(int argc, const char *argv[]) debug_log_file = "sssd_autofs"; DEBUG_INIT(debug_level, opt_logger); - ret = server_setup("autofs", true, 0, uid, gid, + ret = server_setup("autofs", true, 0, uid, gid, CONFDB_FILE, CONFDB_AUTOFS_CONF_ENTRY, &main_ctx, true); if (ret != EOK) { return 2; diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c index c147cbca10a..2965f48767b 100644 --- a/src/responder/ifp/ifpsrv.c +++ b/src/responder/ifp/ifpsrv.c @@ -341,7 +341,7 @@ int main(int argc, const char *argv[]) debug_log_file = "sssd_ifp"; DEBUG_INIT(debug_level, opt_logger); - ret = server_setup("ifp", true, 0, uid, gid, + ret = server_setup("ifp", true, 0, uid, gid, CONFDB_FILE, CONFDB_IFP_CONF_ENTRY, &main_ctx, true); if (ret != EOK) return 2; diff --git a/src/responder/kcm/kcm.c b/src/responder/kcm/kcm.c index f61d47841fc..12ab5ce3e56 100644 --- a/src/responder/kcm/kcm.c +++ b/src/responder/kcm/kcm.c @@ -351,8 +351,8 @@ int main(int argc, const char *argv[]) debug_log_file = "sssd_kcm"; DEBUG_INIT(debug_level, opt_logger); - ret = server_setup("kcm", true, 0, uid, gid, CONFDB_KCM_CONF_ENTRY, - &main_ctx, true); + ret = server_setup("kcm", true, 0, uid, gid, CONFDB_FILE, + CONFDB_KCM_CONF_ENTRY, &main_ctx, true); if (ret != EOK) return 2; ret = die_if_parent_died(); diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 4673a64ca47..14c34b4a84a 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -716,8 +716,8 @@ int main(int argc, const char *argv[]) debug_log_file = "sssd_nss"; DEBUG_INIT(debug_level, opt_logger); - ret = server_setup("nss", true, 0, uid, gid, CONFDB_NSS_CONF_ENTRY, - &main_ctx, false); + ret = server_setup("nss", true, 0, uid, gid, CONFDB_FILE, + CONFDB_NSS_CONF_ENTRY, &main_ctx, false); if (ret != EOK) return 2; ret = die_if_parent_died(); diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c index 8d3db9d2658..615b75a6f48 100644 --- a/src/responder/pac/pacsrv.c +++ b/src/responder/pac/pacsrv.c @@ -208,7 +208,7 @@ int main(int argc, const char *argv[]) debug_log_file = "sssd_pac"; DEBUG_INIT(debug_level, opt_logger); - ret = server_setup("pac", true, 0, uid, gid, + ret = server_setup("pac", true, 0, uid, gid, CONFDB_FILE, CONFDB_PAC_CONF_ENTRY, &main_ctx, true); if (ret != EOK) return 2; diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c index 73ebb0a9cd2..b47c4eedde4 100644 --- a/src/responder/pam/pamsrv.c +++ b/src/responder/pam/pamsrv.c @@ -504,8 +504,8 @@ int main(int argc, const char *argv[]) "debugging might not work!\n"); } - ret = server_setup("pam", true, 0, uid, gid, CONFDB_PAM_CONF_ENTRY, - &main_ctx, false); + ret = server_setup("pam", true, 0, uid, gid, CONFDB_FILE, + CONFDB_PAM_CONF_ENTRY, &main_ctx, false); if (ret != EOK) return 2; ret = die_if_parent_died(); diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c index 91fb77b24b7..798b107bcdd 100644 --- a/src/responder/ssh/sshsrv.c +++ b/src/responder/ssh/sshsrv.c @@ -208,7 +208,7 @@ int main(int argc, const char *argv[]) "debugging might not work!\n"); } - ret = server_setup("ssh", true, 0, uid, gid, + ret = server_setup("ssh", true, 0, uid, gid, CONFDB_FILE, CONFDB_SSH_CONF_ENTRY, &main_ctx, true); if (ret != EOK) { return 2; diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index 8568e6e9593..8b6cf9f05f9 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -196,8 +196,8 @@ int main(int argc, const char *argv[]) } } - ret = server_setup("sudo", true, 0, uid, gid, CONFDB_SUDO_CONF_ENTRY, - &main_ctx, true); + ret = server_setup("sudo", true, 0, uid, gid, CONFDB_FILE, + CONFDB_SUDO_CONF_ENTRY, &main_ctx, true); if (ret != EOK) { return 2; } diff --git a/src/tests/cwrap/test_server.c b/src/tests/cwrap/test_server.c index 9cabf5905fc..4b6a4bad0f3 100644 --- a/src/tests/cwrap/test_server.c +++ b/src/tests/cwrap/test_server.c @@ -101,7 +101,7 @@ void test_run_as_root_fg(void **state) pid = fork(); if (pid == 0) { - ret = server_setup(__FUNCTION__, false, 0, 0, 0, + ret = server_setup(__FUNCTION__, false, 0, 0, 0, CONFDB_FILE, __FUNCTION__, &main_ctx, true); assert_int_equal(ret, 0); exit(0); @@ -125,7 +125,7 @@ void test_run_as_sssd_fg(void **state) pid = fork(); if (pid == 0) { ret = server_setup(__FUNCTION__, false, 0, sssd->pw_uid, sssd->pw_gid, - __FUNCTION__, &main_ctx, true); + CONFDB_FILE, __FUNCTION__, &main_ctx, true); assert_int_equal(ret, 0); exit(0); } @@ -149,8 +149,8 @@ void test_run_as_root_daemon(void **state) pid = fork(); if (pid == 0) { - ret = server_setup(__FUNCTION__, false, FLAGS_PID_FILE, - 0, 0, __FUNCTION__, &main_ctx, true); + ret = server_setup(__FUNCTION__, false, FLAGS_PID_FILE, 0, 0, + CONFDB_FILE, __FUNCTION__, &main_ctx, true); assert_int_equal(ret, 0); server_loop(main_ctx); diff --git a/src/util/server.c b/src/util/server.c index 76a558fb512..62a8c086e3e 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -475,6 +475,7 @@ static const char *get_pid_path(void) int server_setup(const char *name, bool is_responder, int flags, uid_t uid, gid_t gid, + const char *db_file, const char *conf_entry, struct main_context **main_ctx, bool allow_sss_loop) @@ -622,8 +623,7 @@ int server_setup(const char *name, bool is_responder, return EIO; } - conf_db = talloc_asprintf(ctx, "%s/%s", - get_db_path(), CONFDB_FILE); + conf_db = talloc_asprintf(ctx, "%s/%s", get_db_path(), db_file); if (conf_db == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "Out of memory, aborting!\n"); return ENOMEM; diff --git a/src/util/util.h b/src/util/util.h index 72c55b49384..cfd55f05da9 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -216,6 +216,7 @@ int pidfile(const char *file); int server_setup(const char *name, bool is_responder, int flags, uid_t uid, gid_t gid, + const char *db_file, const char *conf_entry, struct main_context **main_ctx, bool allow_sss_loop);