diff options
-rw-r--r-- | server/infopipe/infopipe.c | 4 | ||||
-rw-r--r-- | server/monitor/monitor.c | 7 | ||||
-rw-r--r-- | server/polkit/sssd_polkit.c | 4 | ||||
-rw-r--r-- | server/providers/data_provider.c | 6 | ||||
-rw-r--r-- | server/providers/data_provider_be.c | 8 | ||||
-rw-r--r-- | server/responder/nss/nsssrv.c | 2 | ||||
-rw-r--r-- | server/responder/nss/nsssrv.h | 2 | ||||
-rw-r--r-- | server/responder/pam/pamsrv.c | 2 | ||||
-rw-r--r-- | server/util/server.c | 10 | ||||
-rw-r--r-- | server/util/util.h | 1 |
10 files changed, 36 insertions, 10 deletions
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c index 8d4bfeef..535d41e3 100644 --- a/server/infopipe/infopipe.c +++ b/server/infopipe/infopipe.c @@ -34,6 +34,8 @@ #include "infopipe/infopipe.h" #include "infopipe/infopipe_private.h" +#define INFP_CONF_ENTRY "config/services/info" + struct infp_ctx; static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn) @@ -737,7 +739,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd[infp]", 0, &main_ctx); + ret = server_setup("sssd[info]", 0, INFP_CONF_ENTRY, &main_ctx); if (ret != EOK) return 2; ret = infp_process_init(main_ctx, diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 4a6abdc9..0ee344cb 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -37,6 +37,7 @@ /* ping time cannot be less then once every few seconds or the * monitor will get crazy hammering children with messages */ #define MONITOR_DEF_PING_TIME 10 +#define MONITOR_CONF_ENTRY "config/services/monitor" struct mt_conn { struct sbus_conn_ctx *conn_ctx; @@ -136,7 +137,7 @@ static int monitor_dbus_init(struct mt_ctx *ctx) } ret = confdb_get_string(ctx->cdb, ctx, - "config/services/monitor", "sbusAddress", + MONITOR_CONF_ENTRY, "sbusAddress", default_monitor_address, &sbus_address); if (ret != EOK) { talloc_free(default_monitor_address); @@ -346,7 +347,7 @@ int get_monitor_config(struct mt_ctx *ctx) int ret; ret = confdb_get_int(ctx->cdb, ctx, - "config/services/monitor", "sbusTimeout", + MONITOR_CONF_ENTRY, "sbusTimeout", -1, &ctx->service_id_timeout); if (ret != EOK) { return ret; @@ -1121,7 +1122,7 @@ int main(int argc, const char *argv[]) flags |= FLAGS_PID_FILE; /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd", flags, &main_ctx); + ret = server_setup("sssd", flags, MONITOR_CONF_ENTRY, &main_ctx); if (ret != EOK) return 2; ret = monitor_process_init(main_ctx, diff --git a/server/polkit/sssd_polkit.c b/server/polkit/sssd_polkit.c index 511a293c..a7a3d89d 100644 --- a/server/polkit/sssd_polkit.c +++ b/server/polkit/sssd_polkit.c @@ -28,6 +28,8 @@ #include "monitor/monitor_sbus.h" #include "monitor/monitor_interfaces.h" +#define SPK_CONF_ENTRY "config/services/pk" + struct spk_ctx { struct tevent_context *ev; struct confdb_ctx *cdb; @@ -189,7 +191,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd[infp]", 0, &main_ctx); + ret = server_setup("sssd[pk]", 0, SPK_CONF_ENTRY, &main_ctx); if (ret != EOK) return 2; ret = spk_process_init(main_ctx, diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index cc437c9a..183fdc4e 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -43,6 +43,8 @@ #include "monitor/monitor_interfaces.h" #include "responder/pam/pamsrv.h" +#define DP_CONF_ENTRY "config/services/dp" + struct dp_backend; struct dp_frontend; @@ -1004,7 +1006,7 @@ static int dp_srv_init(struct dp_ctx *dpctx) } ret = confdb_get_string(dpctx->cdb, tmp_ctx, - "config/services/dataprovider", "dpbusAddress", + DP_CONF_ENTRY, "dpbusAddress", default_dp_address, &dpbus_address); if (ret != EOK) goto done; @@ -1100,7 +1102,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd[dp]", 0, &main_ctx); + ret = server_setup("sssd[dp]", 0, DP_CONF_ENTRY, &main_ctx); if (ret != EOK) return 2; ret = dp_process_init(main_ctx, diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 8796ec14..675fb634 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -47,6 +47,8 @@ #include "monitor/monitor_interfaces.h" #include "../sss_client/sss_cli.h" +#define BE_CONF_ENTRY "config/domains/%s" + typedef int (*be_init_fn_t)(TALLOC_CTX *, struct be_mod_ops **, void **); static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn); @@ -881,6 +883,7 @@ int main(int argc, const char *argv[]) char *be_name; char *be_domain; char *srv_name; + char *conf_entry; struct main_context *main_ctx; int ret; @@ -911,7 +914,10 @@ int main(int argc, const char *argv[]) srv_name = talloc_asprintf(NULL, "sssd[be[%s]]", be_name); if (!srv_name) return 2; - ret = server_setup(srv_name, 0, &main_ctx); + conf_entry = talloc_asprintf(NULL, BE_CONF_ENTRY, be_domain); + if (!conf_entry) return 2; + + ret = server_setup(srv_name, 0, conf_entry, &main_ctx); if (ret != EOK) { DEBUG(0, ("Could not set up mainloop [%d]\n", ret)); return 2; diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index f12fb6c5..c1bfb969 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -519,7 +519,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd[nss]", 0, &main_ctx); + ret = server_setup("sssd[nss]", 0, NSS_CONF_ENTRY, &main_ctx); if (ret != EOK) return 2; ret = nss_process_init(main_ctx, diff --git a/server/responder/nss/nsssrv.h b/server/responder/nss/nsssrv.h index 4f5750de..954ae8f2 100644 --- a/server/responder/nss/nsssrv.h +++ b/server/responder/nss/nsssrv.h @@ -47,6 +47,8 @@ #define NSS_ENUM_GROUPS 0x02 #define NSS_ENUM_ALL 0x03 +#define NSS_SRV_CONFIG "config/services/nss" + struct sysdb_ctx; struct getpwent_ctx; struct getgrent_ctx; diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c index de62e035..99522898 100644 --- a/server/responder/pam/pamsrv.c +++ b/server/responder/pam/pamsrv.c @@ -148,7 +148,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); /* set up things like debug , signals, daemonization, etc... */ - ret = server_setup("sssd[pam]", 0, &main_ctx); + ret = server_setup("sssd[pam]", 0, CONFDB_SOCKET_PATH, &main_ctx); if (ret != EOK) return 2; pam_dp_methods = register_pam_dp_methods(); diff --git a/server/util/server.c b/server/util/server.c index ecd4d9bc..b2d6a3ce 100644 --- a/server/util/server.c +++ b/server/util/server.c @@ -225,6 +225,7 @@ static void server_stdin_handler(struct tevent_context *event_ctx, main server helpers. */ int server_setup(const char *name, int flags, + const char *conf_entry, struct main_context **main_ctx) { struct tevent_context *event_ctx; @@ -289,6 +290,15 @@ int server_setup(const char *name, int flags, return ret; } + /* set debug level if any in conf_entry */ + ret = confdb_get_int(ctx->confdb_ctx, ctx, conf_entry, + "debug-level", debug_level, &debug_level); + if (ret != EOK) { + DEBUG(0, ("Error reading from confdb (%d) [%s]\n", + ret, strerror(ret))); + return ret; + } + if (flags & FLAGS_INTERACTIVE) { /* terminate when stdin goes away */ stdin_event_flags = TEVENT_FD_READ; diff --git a/server/util/util.h b/server/util/util.h index c784bf58..b3a7c727 100644 --- a/server/util/util.h +++ b/server/util/util.h @@ -56,6 +56,7 @@ struct main_context { /* from server.c */ int server_setup(const char *name, int flags, + const char *conf_entry, struct main_context **main_ctx); void server_loop(struct main_context *main_ctx); |