From 005f2b1f503475315b166bc63fcd0aeb5ebc2ab1 Mon Sep 17 00:00:00 2001 From: Dusan Uradnik Date: Fri, 8 Apr 2022 19:03:02 +0200 Subject: [PATCH] sbus: centralize communication to a single dbus server Now there is only one dbus server in the monitor process instead of having a server in each running process. This will simplify the communication and allow us to use signals effectively. --- src/monitor/monitor.c | 2 +- src/providers/backend.h | 2 +- src/providers/data_provider/dp.c | 29 ++-- src/providers/data_provider/dp.h | 3 +- src/providers/data_provider_be.c | 11 +- src/providers/proxy/proxy_child.c | 21 +-- src/responder/autofs/autofssrv.c | 4 +- .../plugins/cache_req_autofs_entry_by_name.c | 13 +- .../plugins/cache_req_autofs_map_by_name.c | 13 +- .../plugins/cache_req_autofs_map_entries.c | 13 +- .../plugins/cache_req_ssh_host_id_by_name.c | 13 +- src/responder/common/responder.h | 21 +-- src/responder/common/responder_common.c | 158 ------------------ src/responder/common/responder_dp.c | 22 +-- src/responder/common/responder_get_domains.c | 25 ++- src/responder/common/responder_iface.c | 2 +- src/responder/ifp/ifp_domains.c | 65 ++++--- src/responder/ifp/ifpsrv.c | 9 +- src/responder/nss/nsssrv.c | 22 +-- src/responder/pac/pacsrv.c | 7 +- src/responder/pam/pamsrv.c | 7 +- src/responder/pam/pamsrv_dp.c | 15 +- src/responder/ssh/sshsrv.c | 7 +- src/responder/sudo/sudosrv.c | 7 +- src/responder/sudo/sudosrv_dp.c | 11 +- src/sss_iface/sss_iface.c | 35 ++-- src/sss_iface/sss_iface.h | 10 +- src/sss_iface/sss_iface_async.h | 11 ++ src/tools/sssctl/sssctl_logs.c | 2 +- 29 files changed, 184 insertions(+), 376 deletions(-) diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 2eebddce62d..b80f2983a8b 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -1645,7 +1645,7 @@ static int monitor_process_init(struct mt_ctx *ctx, talloc_zfree(tmp_ctx); req = sbus_server_create_and_connect_send(ctx, ctx->ev, SSS_BUS_MONITOR, - NULL, SSS_MONITOR_ADDRESS, + NULL, SSS_BUS_ADDRESS, false, 100, ctx->uid, ctx->gid, NULL, NULL); if (req == NULL) { diff --git a/src/providers/backend.h b/src/providers/backend.h index abf0e916482..487b81602e0 100644 --- a/src/providers/backend.h +++ b/src/providers/backend.h @@ -105,7 +105,7 @@ struct be_ctx { /* Periodically check if we can go online. */ struct be_ptask *check_if_online_ptask; - struct sbus_connection *mon_conn; + struct sbus_connection *sbus_conn; struct be_refresh_ctx *refresh_ctx; diff --git a/src/providers/data_provider/dp.c b/src/providers/data_provider/dp.c index 99f27fc586b..3fcfe7f7a92 100644 --- a/src/providers/data_provider/dp.c +++ b/src/providers/data_provider/dp.c @@ -24,6 +24,7 @@ #include "providers/data_provider/dp.h" #include "providers/data_provider/dp_private.h" #include "providers/data_provider/dp_iface.h" +#include "sbus/sbus.h" #include "sss_iface/sss_iface_async.h" #include "providers/backend.h" #include "util/util.h" @@ -149,7 +150,6 @@ dp_init_send(TALLOC_CTX *mem_ctx, struct dp_init_state *state; struct tevent_req *subreq; struct tevent_req *req; - char *sbus_address; errno_t ret; req = tevent_req_create(mem_ctx, &state, struct dp_init_state); @@ -158,13 +158,6 @@ dp_init_send(TALLOC_CTX *mem_ctx, return NULL; } - sbus_address = sss_iface_domain_address(state, be_ctx->domain); - if (sbus_address == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, "Could not get sbus backend address.\n"); - ret = ENOMEM; - goto done; - } - state->provider = talloc_zero(be_ctx, struct data_provider); if (state->provider == NULL) { ret = ENOMEM; @@ -184,10 +177,9 @@ dp_init_send(TALLOC_CTX *mem_ctx, */ talloc_set_destructor(state->provider, dp_destructor); - subreq = sbus_server_create_and_connect_send(state->provider, ev, - sbus_name, NULL, sbus_address, true, 1000, uid, gid, - (sbus_server_on_connection_cb)dp_client_init, - (sbus_server_on_connection_data)state->provider); + subreq = sbus_connect_private_send(state->provider, ev, + SSS_BUS_ADDRESS, + sbus_name, NULL); if (subreq == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; @@ -216,9 +208,8 @@ static void dp_init_done(struct tevent_req *subreq) req = tevent_req_callback_data(subreq, struct tevent_req); state = tevent_req_data(req, struct dp_init_state); - ret = sbus_server_create_and_connect_recv(state->provider, subreq, - &state->provider->sbus_server, - &state->provider->sbus_conn); + ret = sbus_connect_private_recv(state->provider, subreq, + &state->provider->sbus_conn); talloc_zfree(subreq); if (ret != EOK) { tevent_req_error(req, ret); @@ -260,10 +251,16 @@ static void dp_init_done(struct tevent_req *subreq) } errno_t dp_init_recv(TALLOC_CTX *mem_ctx, - struct tevent_req *req) + struct tevent_req *req, + struct sbus_connection **_conn) { + struct dp_init_state *state; + state = tevent_req_data(req, struct dp_init_state); + TEVENT_REQ_RETURN_ON_ERROR(req); + *_conn = talloc_steal(mem_ctx, state->provider->sbus_conn); + return EOK; } diff --git a/src/providers/data_provider/dp.h b/src/providers/data_provider/dp.h index ba4595fd5d2..fd1e66a93aa 100644 --- a/src/providers/data_provider/dp.h +++ b/src/providers/data_provider/dp.h @@ -126,7 +126,8 @@ dp_init_send(TALLOC_CTX *mem_ctx, const char *sbus_name); errno_t dp_init_recv(TALLOC_CTX *mem_ctx, - struct tevent_req *req); + struct tevent_req *req, + struct sbus_connection **_conn); void dp_client_cancel_timeout(struct sbus_connection *conn); diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index aea0587cbf3..be2bae97d03 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -494,7 +494,7 @@ be_register_monitor_iface(struct sbus_connection *conn, struct be_ctx *be_ctx) {NULL, NULL} }; - return sbus_connection_add_path_map(be_ctx->mon_conn, paths); + return sbus_connection_add_path_map(be_ctx->sbus_conn, paths); } static void dp_initialized(struct tevent_req *req); @@ -695,21 +695,20 @@ static void dp_initialized(struct tevent_req *req) be_ctx = tevent_req_callback_data(req, struct be_ctx); - ret = dp_init_recv(be_ctx, req); + ret = dp_init_recv(be_ctx, req, &be_ctx->sbus_conn); talloc_zfree(req); if (ret != EOK) { goto done; } - ret = sss_monitor_service_init(be_ctx, be_ctx->ev, be_ctx->sbus_name, - be_ctx->identity, DATA_PROVIDER_VERSION, - MT_SVC_PROVIDER, NULL, &be_ctx->mon_conn); + ret = sss_monitor_provider_init(be_ctx->sbus_conn, be_ctx->identity, + DATA_PROVIDER_VERSION, MT_SVC_PROVIDER); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to initialize monitor connection\n"); goto done; } - ret = be_register_monitor_iface(be_ctx->mon_conn, be_ctx); + ret = be_register_monitor_iface(be_ctx->sbus_conn, be_ctx); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register monitor interface " "[%d]: %s\n", ret, sss_strerror(ret)); diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c index 39ddba267e7..303617fb074 100644 --- a/src/providers/proxy/proxy_child.c +++ b/src/providers/proxy/proxy_child.c @@ -24,6 +24,7 @@ */ #include +#include #include #include #include @@ -53,8 +54,7 @@ struct pc_ctx { struct sss_domain_info *domain; const char *identity; const char *conf_path; - struct sbus_connection *mon_conn; - struct sbus_connection *conn; + struct sbus_connection *sbus_conn; const char *pam_target; uint32_t id; }; @@ -338,7 +338,6 @@ proxy_cli_init(struct pc_ctx *ctx) { TALLOC_CTX *tmp_ctx; struct tevent_req *subreq; - char *sbus_address; char *sbus_busname; char *sbus_cliname; errno_t ret; @@ -363,12 +362,6 @@ proxy_cli_init(struct pc_ctx *ctx) {NULL, NULL} }; - sbus_address = sss_iface_domain_address(tmp_ctx, ctx->domain); - if (sbus_address == NULL) { - ret = ENOMEM; - goto done; - } - sbus_busname = confdb_get_domain_bus(tmp_ctx, ctx->domain); if (sbus_busname == NULL) { ret = ENOMEM; @@ -381,14 +374,14 @@ proxy_cli_init(struct pc_ctx *ctx) goto done; } - ret = sss_iface_connect_address(ctx, ctx->ev, sbus_cliname, sbus_address, - NULL, &ctx->conn); + ret = sss_iface_connect_address(ctx, ctx->ev, sbus_cliname, SSS_BUS_ADDRESS, + NULL, &ctx->sbus_conn); if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, "Unable to connect to %s\n", sbus_address); + DEBUG(SSSDBG_FATAL_FAILURE, "Unable to connect to %s\n", SSS_BUS_ADDRESS); goto done; } - ret = sbus_connection_add_path_map(ctx->conn, paths); + ret = sbus_connection_add_path_map(ctx->sbus_conn, paths); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to add paths [%d]: %s\n", ret, sss_strerror(ret)); @@ -398,7 +391,7 @@ proxy_cli_init(struct pc_ctx *ctx) DEBUG(SSSDBG_TRACE_FUNC, "Sending ID to Proxy Backend: (%"PRIu32")\n", ctx->id); - subreq = sbus_call_proxy_client_Register_send(ctx, ctx->conn, sbus_busname, + subreq = sbus_call_proxy_client_Register_send(ctx, ctx->sbus_conn, sbus_busname, SSS_BUS_PATH, ctx->id); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c index 1dbbe9fecb2..8a5a129f0e3 100644 --- a/src/responder/autofs/autofssrv.c +++ b/src/responder/autofs/autofssrv.c @@ -85,7 +85,7 @@ autofs_register_service_iface(struct autofs_ctx *autofs_ctx, ) ); - ret = sbus_connection_add_path(rctx->mon_conn, SSS_BUS_PATH, &iface_svc); + ret = sbus_connection_add_path(rctx->sbus_conn, SSS_BUS_PATH, &iface_svc); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register service interface" "[%d]: %s\n", ret, sss_strerror(ret)); @@ -155,7 +155,7 @@ autofs_process_init(TALLOC_CTX *mem_ctx, SSS_AUTOFS_SBUS_SERVICE_NAME, SSS_AUTOFS_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; diff --git a/src/responder/common/cache_req/plugins/cache_req_autofs_entry_by_name.c b/src/responder/common/cache_req/plugins/cache_req_autofs_entry_by_name.c index b2b0a06eb7e..66b33d8b152 100644 --- a/src/responder/common/cache_req/plugins/cache_req_autofs_entry_by_name.c +++ b/src/responder/common/cache_req/plugins/cache_req_autofs_entry_by_name.c @@ -72,19 +72,14 @@ cache_req_autofs_entry_by_name_dp_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, struct ldb_result *result) { - struct be_conn *be_conn; - errno_t ret; - - ret = sss_dp_get_domain_conn(cr->rctx, domain->conn_name, &be_conn); - if (ret != EOK) { + if (cr->rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - domain->name); + "BUG: The D-Bus connection is not available!\n"); return NULL; } - return sbus_call_dp_autofs_GetEntry_send(mem_ctx, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, + return sbus_call_dp_autofs_GetEntry_send(mem_ctx, cr->rctx->sbus_conn, + domain->conn_name, SSS_BUS_PATH, 0, data->name.name, data->autofs_entry_name, sss_chain_id_get()); diff --git a/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c b/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c index 23b11b1cdcd..9bfd822db55 100644 --- a/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c +++ b/src/responder/common/cache_req/plugins/cache_req_autofs_map_by_name.c @@ -69,19 +69,14 @@ cache_req_autofs_map_by_name_dp_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, struct ldb_result *result) { - struct be_conn *be_conn; - errno_t ret; - - ret = sss_dp_get_domain_conn(cr->rctx, domain->conn_name, &be_conn); - if (ret != EOK) { + if (cr->rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - domain->name); + "BUG: The D-Bus connection is not available!\n"); return NULL; } - return sbus_call_dp_autofs_GetMap_send(mem_ctx, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, + return sbus_call_dp_autofs_GetMap_send(mem_ctx, cr->rctx->sbus_conn, + domain->conn_name, SSS_BUS_PATH, 0, data->name.name, sss_chain_id_get()); } diff --git a/src/responder/common/cache_req/plugins/cache_req_autofs_map_entries.c b/src/responder/common/cache_req/plugins/cache_req_autofs_map_entries.c index 18c08ca3989..ab65e331a57 100644 --- a/src/responder/common/cache_req/plugins/cache_req_autofs_map_entries.c +++ b/src/responder/common/cache_req/plugins/cache_req_autofs_map_entries.c @@ -101,19 +101,14 @@ cache_req_autofs_map_entries_dp_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, struct ldb_result *result) { - struct be_conn *be_conn; - errno_t ret; - - ret = sss_dp_get_domain_conn(cr->rctx, domain->conn_name, &be_conn); - if (ret != EOK) { + if (cr->rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - domain->name); + "BUG: The D-Bus connection is not available!\n"); return NULL; } - return sbus_call_dp_autofs_Enumerate_send(mem_ctx, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, + return sbus_call_dp_autofs_Enumerate_send(mem_ctx, cr->rctx->sbus_conn, + domain->conn_name, SSS_BUS_PATH, 0, data->name.name, sss_chain_id_get()); } diff --git a/src/responder/common/cache_req/plugins/cache_req_ssh_host_id_by_name.c b/src/responder/common/cache_req/plugins/cache_req_ssh_host_id_by_name.c index 29f52f10d2c..d5d39de98d1 100644 --- a/src/responder/common/cache_req/plugins/cache_req_ssh_host_id_by_name.c +++ b/src/responder/common/cache_req/plugins/cache_req_ssh_host_id_by_name.c @@ -73,19 +73,14 @@ cache_req_host_by_name_dp_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, struct ldb_result *result) { - struct be_conn *be_conn; - errno_t ret; - - ret = sss_dp_get_domain_conn(cr->rctx, domain->conn_name, &be_conn); - if (ret != EOK) { + if (cr->rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - domain->name); + "BUG: The D-Bus connection is not available!\n"); return NULL; } - return sbus_call_dp_dp_hostHandler_send(mem_ctx, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, + return sbus_call_dp_dp_hostHandler_send(mem_ctx, cr->rctx->sbus_conn, + domain->conn_name, SSS_BUS_PATH, 0, data->name.name, data->alias, sss_chain_id_get()); } diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 90078dda782..de3197c26bf 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -70,22 +70,6 @@ struct cli_protocol { struct cli_protocol_version *cli_protocol_version; }; -struct resp_ctx; - -struct be_conn { - struct be_conn *next; - struct be_conn *prev; - - struct resp_ctx *rctx; - - const char *cli_name; - struct sss_domain_info *domain; - - char *bus_name; - char *sbus_address; - struct sbus_connection *conn; -}; - struct resp_ctx { struct tevent_context *ev; struct tevent_fd *lfde; @@ -99,8 +83,7 @@ struct resp_ctx { struct sss_nc_ctx *ncache; struct sss_names_ctx *global_names; - struct sbus_connection *mon_conn; - struct be_conn *be_conns; + struct sbus_connection *sbus_conn; struct sss_domain_info *domains; int domains_timeout; @@ -203,8 +186,6 @@ int sss_process_init(TALLOC_CTX *mem_ctx, connection_setup_t conn_setup, struct resp_ctx **responder_ctx); -int sss_dp_get_domain_conn(struct resp_ctx *rctx, const char *domain, - struct be_conn **_conn); struct sss_domain_info * responder_get_domain(struct resp_ctx *rctx, const char *domain); diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c index 1f1eb5b80b7..be1fddaedd3 100644 --- a/src/responder/common/responder_common.c +++ b/src/responder/common/responder_common.c @@ -714,139 +714,6 @@ static errno_t setup_client_idle_timer(struct cli_ctx *cctx) return EOK; } -static void -sss_dp_on_reconnect(struct sbus_connection *conn, - enum sbus_reconnect_status status, - struct be_conn *be_conn); - -static void -sss_dp_init_done(struct tevent_req *req); - -static errno_t -sss_dp_init(struct resp_ctx *rctx, - const char *conn_name, - const char *cli_name, - struct sss_domain_info *domain) -{ - struct tevent_req *req; - struct be_conn *be_conn; - int max_retries; - errno_t ret; - - ret = confdb_get_int(rctx->cdb, rctx->confdb_service_path, - CONFDB_SERVICE_RECON_RETRIES, 3, &max_retries); - if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, "Unable to read confdb [%d]: %s\n", - ret, sss_strerror(ret)); - return ret; - } - - be_conn = talloc_zero(rctx, struct be_conn); - if (!be_conn) return ENOMEM; - - be_conn->cli_name = cli_name; - be_conn->domain = domain; - be_conn->rctx = rctx; - - be_conn->sbus_address = sss_iface_domain_address(be_conn, domain); - if (be_conn->sbus_address == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, "Could not locate DP address.\n"); - ret = ENOMEM; - goto done; - } - - be_conn->bus_name = confdb_get_domain_bus(be_conn, domain); - if (be_conn->bus_name == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, "Could not locate DP address.\n"); - ret = ENOMEM; - goto done; - } - - ret = sss_iface_connect_address(be_conn, rctx->ev, conn_name, - be_conn->sbus_address, NULL, - &be_conn->conn); - if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, "Failed to connect to backend server.\n"); - goto done; - } - - ret = sss_resp_register_sbus_iface(be_conn->conn, rctx); - if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, "Cannot register generic responder " - "interface [%d]: %s\n", ret, sss_strerror(ret)); - goto done; - } - - sbus_reconnect_enable(be_conn->conn, max_retries, sss_dp_on_reconnect, - be_conn); - - DLIST_ADD_END(rctx->be_conns, be_conn, struct be_conn *); - - /* Identify ourselves to the DP */ - req = sbus_call_dp_client_Register_send(be_conn, be_conn->conn, - be_conn->bus_name, - SSS_BUS_PATH, cli_name); - if (req == NULL) { - ret = ENOMEM; - goto done; - } - - tevent_req_set_callback(req, sss_dp_init_done, be_conn); - - ret = EOK; - -done: - if (ret != EOK) { - talloc_free(be_conn); - } - - return ret; -} - -static void -sss_dp_on_reconnect(struct sbus_connection *conn, - enum sbus_reconnect_status status, - struct be_conn *be_conn) -{ - struct tevent_req *req; - - if (status != SBUS_RECONNECT_SUCCESS) { - DEBUG(SSSDBG_FATAL_FAILURE, "Could not reconnect to %s provider.\n", - be_conn->domain->name); - return; - } - - DEBUG(SSSDBG_TRACE_FUNC, "Reconnected to the Data Provider.\n"); - - /* Identify ourselves to the DP */ - req = sbus_call_dp_client_Register_send(be_conn, be_conn->conn, - be_conn->bus_name, - SSS_BUS_PATH, - be_conn->cli_name); - if (req == NULL) { - DEBUG(SSSDBG_CRIT_FAILURE, "sbus_call_dp_client_Register_send() failed\n"); - return; - } - - tevent_req_set_callback(req, sss_dp_init_done, be_conn); -} - -static void -sss_dp_init_done(struct tevent_req *req) -{ - errno_t ret; - - ret = sbus_call_dp_client_Register_recv(req); - talloc_zfree(req); - - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "Unable to register client with DP\n"); - return; - } - - DEBUG(SSSDBG_TRACE_FUNC, "Client is registered with DP\n"); -} - int create_pipe_fd(const char *sock_name, int *_fd, mode_t umaskval) { struct sockaddr_un addr; @@ -1470,13 +1337,6 @@ int sss_process_init(TALLOC_CTX *mem_ctx, dom->name); goto fail; } - - ret = sss_dp_init(rctx, conn_name, svc_name, dom); - if (ret != EOK) { - DEBUG(SSSDBG_FATAL_FAILURE, - "fatal error setting up backend connector\n"); - goto fail; - } } ret = sysdb_init(rctx, rctx->domains); @@ -1517,24 +1377,6 @@ int sss_process_init(TALLOC_CTX *mem_ctx, return ret; } -int sss_dp_get_domain_conn(struct resp_ctx *rctx, const char *domain, - struct be_conn **_conn) -{ - struct be_conn *iter; - - if (!rctx->be_conns) return ENOENT; - - for (iter = rctx->be_conns; iter; iter = iter->next) { - if (strcasecmp(domain, iter->domain->conn_name) == 0) break; - } - - if (!iter) return ENOENT; - - *_conn = iter; - - return EOK; -} - struct sss_domain_info * responder_get_domain(struct resp_ctx *rctx, const char *name) { diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c index 227a2294113..f553c02ed3b 100644 --- a/src/responder/common/responder_dp.c +++ b/src/responder/common/responder_dp.c @@ -193,7 +193,6 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx, struct sss_dp_get_account_state *state; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; uint32_t entry_type; uint32_t dp_flags; char *filter; @@ -243,11 +242,9 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx, } #endif - ret = sss_dp_get_domain_conn(rctx, dom->conn_name, &be_conn); - if (ret != EOK) { + if (rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - dom->name); + "BUG: The D-Bus connection is not available!\n"); ret = EIO; goto done; } @@ -264,8 +261,8 @@ sss_dp_get_account_send(TALLOC_CTX *mem_ctx, dom->name, entry_type, be_req2str(entry_type), filter, extra == NULL ? "-" : extra); - subreq = sbus_call_dp_dp_getAccountInfo_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, dp_flags, + subreq = sbus_call_dp_dp_getAccountInfo_send(state, rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, dp_flags, entry_type, filter, dom->name, extra, sss_chain_id_get()); if (subreq == NULL) { @@ -351,7 +348,6 @@ sss_dp_resolver_get_send(TALLOC_CTX *mem_ctx, struct sss_dp_resolver_get_state *state; struct tevent_req *req; struct tevent_req *subreq; - struct be_conn *be_conn; uint32_t dp_flags; errno_t ret; @@ -377,11 +373,9 @@ sss_dp_resolver_get_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(rctx, dom->conn_name, &be_conn); - if (ret != EOK) { + if (rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - dom->name); + "BUG: The D-Bus connection is not available!\n"); ret = EIO; goto done; } @@ -392,8 +386,8 @@ sss_dp_resolver_get_send(TALLOC_CTX *mem_ctx, filter_type, filter_value ? filter_value : "-"); dp_flags = fast_reply ? DP_FAST_REPLY : 0; - subreq = sbus_call_dp_dp_resolverHandler_send(state, be_conn->conn, - be_conn->bus_name, + subreq = sbus_call_dp_dp_resolverHandler_send(state, rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, dp_flags, entry_type, filter_type, filter_value, diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c index 1a388e79ace..5f80d8fe0fa 100644 --- a/src/responder/common/responder_get_domains.c +++ b/src/responder/common/responder_get_domains.c @@ -43,7 +43,6 @@ get_subdomains_send(TALLOC_CTX *mem_ctx, struct get_subdomains_state *state; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, struct get_subdomains_state); @@ -66,19 +65,18 @@ get_subdomains_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(rctx, dom->conn_name, &be_conn); - if (ret != EOK) { + if (rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - dom->name); + "BUG: The D-Bus connection is not available!\n"); ret = EIO; goto done; } - subreq = sbus_call_dp_dp_getDomains_send(state, be_conn->conn, - be_conn->bus_name, + subreq = sbus_call_dp_dp_getDomains_send(state, rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, hint); - if (subreq == NULL) { + + if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; goto done; @@ -706,7 +704,6 @@ sss_dp_get_account_domain_send(TALLOC_CTX *mem_ctx, struct sss_dp_get_account_domain_state *state; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; uint32_t entry_type; char *filter; uint32_t dp_flags; @@ -718,11 +715,9 @@ sss_dp_get_account_domain_send(TALLOC_CTX *mem_ctx, return NULL; } - ret = sss_dp_get_domain_conn(rctx, dom->conn_name, &be_conn); - if (ret != EOK) { + if (rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - dom->name); + "BUG: The D-Bus connection is not available!\n"); ret = EIO; goto done; } @@ -765,8 +760,8 @@ sss_dp_get_account_domain_send(TALLOC_CTX *mem_ctx, dp_flags = fast_reply ? DP_FAST_REPLY : 0; - subreq = sbus_call_dp_dp_getAccountDomain_send(state, be_conn->conn, - be_conn->bus_name, + subreq = sbus_call_dp_dp_getAccountDomain_send(state, rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, dp_flags, entry_type, filter, sss_chain_id_get()); diff --git a/src/responder/common/responder_iface.c b/src/responder/common/responder_iface.c index cf32fe05685..5ef579769da 100644 --- a/src/responder/common/responder_iface.c +++ b/src/responder/common/responder_iface.c @@ -151,7 +151,7 @@ sss_resp_register_service_iface(struct resp_ctx *rctx) ) ); - ret = sbus_connection_add_path(rctx->mon_conn, SSS_BUS_PATH, &iface_svc); + ret = sbus_connection_add_path(rctx->sbus_conn, SSS_BUS_PATH, &iface_svc); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register service interface" "[%d]: %s\n", ret, sss_strerror(ret)); diff --git a/src/responder/ifp/ifp_domains.c b/src/responder/ifp/ifp_domains.c index 16d80e6ca74..bbe2ae420af 100644 --- a/src/responder/ifp/ifp_domains.c +++ b/src/responder/ifp/ifp_domains.c @@ -568,7 +568,6 @@ ifp_domains_domain_is_online_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -584,15 +583,15 @@ ifp_domains_domain_is_online_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(ifp_ctx->rctx, dom->conn_name, &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "BUG: The Data Provider connection for " - "%s is not available!\n", dom->name); + if (ifp_ctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); + ret = ENOENT; goto done; } - subreq = sbus_call_dp_backend_IsOnline_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, dom->name); + subreq = sbus_call_dp_backend_IsOnline_send(state, ifp_ctx->rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, dom->name); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; @@ -663,7 +662,6 @@ ifp_domains_domain_list_services_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -679,15 +677,15 @@ ifp_domains_domain_list_services_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(ifp_ctx->rctx, dom->conn_name, &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "BUG: The Data Provider connection for " - "%s is not available!\n", dom->name); + if (ifp_ctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); + ret = ENOENT; goto done; } - subreq = sbus_call_dp_failover_ListServices_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, dom->name); + subreq = sbus_call_dp_failover_ListServices_send(state, ifp_ctx->rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, dom->name); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; @@ -759,7 +757,6 @@ ifp_domains_domain_active_server_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -775,15 +772,15 @@ ifp_domains_domain_active_server_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(ifp_ctx->rctx, dom->conn_name, &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "BUG: The Data Provider connection for " - "%s is not available!\n", dom->name); + if (ifp_ctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); + ret = ENOENT; goto done; } - subreq = sbus_call_dp_failover_ActiveServer_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, service); + subreq = sbus_call_dp_failover_ActiveServer_send(state, ifp_ctx->rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, service); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; @@ -855,7 +852,6 @@ ifp_domains_domain_list_servers_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -871,15 +867,15 @@ ifp_domains_domain_list_servers_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(ifp_ctx->rctx, dom->conn_name, &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "BUG: The Data Provider connection for " - "%s is not available!\n", dom->name); + if (ifp_ctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); + ret = ENOENT; goto done; } - subreq = sbus_call_dp_failover_ListServers_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, service); + subreq = sbus_call_dp_failover_ListServers_send(state, ifp_ctx->rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH, service); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; @@ -950,7 +946,6 @@ ifp_domains_domain_refresh_access_rules_send(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; errno_t ret; req = tevent_req_create(mem_ctx, &state, @@ -966,15 +961,15 @@ ifp_domains_domain_refresh_access_rules_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(ifp_ctx->rctx, dom->conn_name, &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "BUG: The Data Provider connection for " - "%s is not available!\n", dom->name); + if (ifp_ctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); + ret = ENOENT; goto done; } - subreq = sbus_call_dp_access_RefreshRules_send(state, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH); + subreq = sbus_call_dp_access_RefreshRules_send(state, ifp_ctx->rctx->sbus_conn, + dom->conn_name, SSS_BUS_PATH); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c index c147cbca10a..4edfdc3c90b 100644 --- a/src/responder/ifp/ifpsrv.c +++ b/src/responder/ifp/ifpsrv.c @@ -148,7 +148,7 @@ ifp_register_service_iface(struct ifp_ctx *ifp_ctx, ) ); - ret = sbus_connection_add_path(rctx->mon_conn, SSS_BUS_PATH, &iface_svc); + ret = sbus_connection_add_path(rctx->sbus_conn, SSS_BUS_PATH, &iface_svc); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register service interface" "[%d]: %s\n", ret, sss_strerror(ret)); @@ -281,12 +281,17 @@ int ifp_process_init(TALLOC_CTX *mem_ctx, SSS_IFP_SBUS_SERVICE_NAME, SSS_IFP_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto fail; + } + ret = ifp_register_service_iface(ifp_ctx, rctx); if (ret != EOK) { goto fail; diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 4673a64ca47..99d4061d510 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -432,7 +432,7 @@ sss_nss_register_service_iface(struct sss_nss_ctx *nss_ctx, ) ); - ret = sbus_connection_add_path(rctx->mon_conn, SSS_BUS_PATH, &iface_svc); + ret = sbus_connection_add_path(rctx->sbus_conn, SSS_BUS_PATH, &iface_svc); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "Unable to register service interface" "[%d]: %s\n", ret, sss_strerror(ret)); @@ -520,7 +520,6 @@ int sss_nss_process_init(TALLOC_CTX *mem_ctx, { struct resp_ctx *rctx; struct sss_cmd_table *nss_cmds; - struct be_conn *iter; struct sss_nss_ctx *nctx; int ret; enum idmap_error_code err; @@ -556,13 +555,6 @@ int sss_nss_process_init(TALLOC_CTX *mem_ctx, goto fail; } - for (iter = nctx->rctx->be_conns; iter; iter = iter->next) { - ret = sss_nss_register_backend_iface(iter->conn, nctx); - if (ret != EOK) { - goto fail; - } - } - err = sss_idmap_init(sss_idmap_talloc, nctx, sss_idmap_talloc_free, &nctx->idmap_ctx); if (err != IDMAP_SUCCESS) { @@ -655,12 +647,22 @@ int sss_nss_process_init(TALLOC_CTX *mem_ctx, ret = sss_monitor_service_init(rctx, rctx->ev, SSS_BUS_NSS, NSS_SBUS_SERVICE_NAME, NSS_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto fail; + } + + ret = sss_nss_register_backend_iface(nctx->rctx->sbus_conn, nctx); + if (ret != EOK) { + goto fail; + } + ret = sss_nss_register_service_iface(nctx, rctx); if (ret != EOK) { goto fail; diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c index 8d3db9d2658..b09c1c543b5 100644 --- a/src/responder/pac/pacsrv.c +++ b/src/responder/pac/pacsrv.c @@ -147,12 +147,17 @@ int pac_process_init(TALLOC_CTX *mem_ctx, PAC_SBUS_SERVICE_NAME, PAC_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto fail; + } + ret = sss_resp_register_service_iface(rctx); if (ret != EOK) { goto fail; diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c index 73ebb0a9cd2..6de1ee5524a 100644 --- a/src/responder/pam/pamsrv.c +++ b/src/responder/pam/pamsrv.c @@ -411,12 +411,17 @@ static int pam_process_init(TALLOC_CTX *mem_ctx, SSS_PAM_SBUS_SERVICE_NAME, SSS_PAM_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto done; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto done; + } + ret = sss_resp_register_service_iface(rctx); if (ret != EOK) { goto done; diff --git a/src/responder/pam/pamsrv_dp.c b/src/responder/pam/pamsrv_dp.c index 881352e54c4..bf1af0ae403 100644 --- a/src/responder/pam/pamsrv_dp.c +++ b/src/responder/pam/pamsrv_dp.c @@ -35,23 +35,18 @@ errno_t pam_dp_send_req(struct pam_auth_req *preq) { struct tevent_req *subreq; - struct be_conn *be_conn; - errno_t ret; - ret = sss_dp_get_domain_conn(preq->cctx->rctx, preq->domain->conn_name, - &be_conn); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "The Data Provider connection for %s is not " - "available! This maybe a bug, it shouldn't happen!\n", - preq->domain->conn_name); + if (preq->cctx->rctx->sbus_conn == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, + "BUG: The D-Bus connection is not available!\n"); return EIO; } DEBUG(SSSDBG_CONF_SETTINGS, "Sending request with the following data:\n"); DEBUG_PAM_DATA(SSSDBG_CONF_SETTINGS, preq->pd); - subreq = sbus_call_dp_dp_pamHandler_send(preq, be_conn->conn, - be_conn->bus_name, SSS_BUS_PATH, preq->pd); + subreq = sbus_call_dp_dp_pamHandler_send(preq, preq->cctx->rctx->sbus_conn, + preq->domain->conn_name, SSS_BUS_PATH, preq->pd); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); return ENOMEM; diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c index 91fb77b24b7..fba4f8dda0d 100644 --- a/src/responder/ssh/sshsrv.c +++ b/src/responder/ssh/sshsrv.c @@ -137,12 +137,17 @@ int ssh_process_init(TALLOC_CTX *mem_ctx, SSS_SSH_SBUS_SERVICE_NAME, SSS_SSH_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto fail; + } + ret = sss_resp_register_service_iface(rctx); if (ret != EOK) { goto fail; diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index 8568e6e9593..f074cc79a42 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -113,12 +113,17 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, SSS_SUDO_SBUS_SERVICE_NAME, SSS_SUDO_SBUS_SERVICE_VERSION, MT_SVC_SERVICE, - &rctx->last_request_time, &rctx->mon_conn); + &rctx->last_request_time, &rctx->sbus_conn); if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, "fatal error setting up message bus\n"); goto fail; } + ret = sss_resp_register_sbus_iface(rctx->sbus_conn, rctx); + if (ret != EOK) { + goto fail; + } + ret = sss_resp_register_service_iface(rctx); if (ret != EOK) { goto fail; diff --git a/src/responder/sudo/sudosrv_dp.c b/src/responder/sudo/sudosrv_dp.c index 465c0f24f50..ec285c834cd 100644 --- a/src/responder/sudo/sudosrv_dp.c +++ b/src/responder/sudo/sudosrv_dp.c @@ -157,7 +157,6 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx, struct sss_dp_get_sudoers_state *state; struct tevent_req *subreq; struct tevent_req *req; - struct be_conn *be_conn; DBusMessage *msg; errno_t ret; @@ -181,23 +180,21 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx, goto done; } - ret = sss_dp_get_domain_conn(rctx, dom->conn_name, &be_conn); - if (ret != EOK) { + if (rctx->sbus_conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, - "BUG: The Data Provider connection for %s is not available!\n", - dom->name); + "BUG: The D-Bus connection is not available!\n"); ret = EIO; goto done; } - msg = sss_dp_get_sudoers_msg(state, be_conn->bus_name, dom, fast_reply, + msg = sss_dp_get_sudoers_msg(state, dom->conn_name, dom, fast_reply, type, name, num_rules, rules); if (msg == NULL) { ret = ENOMEM; goto done; } - subreq = sbus_call_dp_dp_sudoHandler_send(state, be_conn->conn, msg); + subreq = sbus_call_dp_dp_sudoHandler_send(state, rctx->sbus_conn, msg); if (subreq == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create subrequest!\n"); ret = ENOMEM; diff --git a/src/sss_iface/sss_iface.c b/src/sss_iface/sss_iface.c index 0a1be06b810..0b6db956fdb 100644 --- a/src/sss_iface/sss_iface.c +++ b/src/sss_iface/sss_iface.c @@ -26,18 +26,6 @@ #include "sbus/sbus_opath.h" #include "sss_iface/sss_iface_async.h" -char * -sss_iface_domain_address(TALLOC_CTX *mem_ctx, - struct sss_domain_info *domain) -{ - struct sss_domain_info *head; - - /* There is only one bus that belongs to the top level domain. */ - head = get_domains_head(domain); - - return talloc_asprintf(mem_ctx, SSS_BACKEND_ADDRESS, head->name); -} - char * sss_iface_proxy_bus(TALLOC_CTX *mem_ctx, uint32_t id) @@ -117,7 +105,7 @@ sss_monitor_service_init(TALLOC_CTX *mem_ctx, errno_t ret; ret = sss_iface_connect_address(mem_ctx, ev, conn_name, - SSS_MONITOR_ADDRESS, + SSS_BUS_ADDRESS, last_request_time, &conn); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to connect to monitor sbus server " @@ -148,6 +136,27 @@ sss_monitor_service_init(TALLOC_CTX *mem_ctx, return ret; } +errno_t +sss_monitor_provider_init(struct sbus_connection *conn, + const char *svc_name, + uint16_t svc_version, + uint16_t svc_type) +{ + struct tevent_req *req; + + req = sbus_call_monitor_RegisterService_send(conn, conn, SSS_BUS_MONITOR, + SSS_BUS_PATH, svc_name, + svc_version, svc_type); + if (req == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, "Unable to create tevent request!\n"); + return ENOMEM; + } + + tevent_req_set_callback(req, sss_monitor_service_init_done, conn); + + return EOK; +} + static void sss_monitor_service_init_done(struct tevent_req *req) { diff --git a/src/sss_iface/sss_iface.h b/src/sss_iface/sss_iface.h index f11fe2fac8d..b2a2f50c569 100644 --- a/src/sss_iface/sss_iface.h +++ b/src/sss_iface/sss_iface.h @@ -30,8 +30,7 @@ #include "providers/data_provider_req.h" #include "providers/data_provider/dp_flags.h" -#define SSS_MONITOR_ADDRESS "unix:path=" PIPE_PATH "/private/sbus-monitor" -#define SSS_BACKEND_ADDRESS "unix:path=" PIPE_PATH "/private/sbus-dp_%s" +#define SSS_BUS_ADDRESS "unix:path=" PIPE_PATH "/private/sbus-master" #define SSS_BUS_MONITOR "sssd.monitor" #define SSS_BUS_AUTOFS "sssd.autofs" @@ -59,13 +58,6 @@ #define PAC_SBUS_SERVICE_NAME "pac" #define PAC_SBUS_SERVICE_VERSION 0x0001 -/** - * Return domain address. - */ -char * -sss_iface_domain_address(TALLOC_CTX *mem_ctx, - struct sss_domain_info *domain); - /** * Return proxy child bus name. */ diff --git a/src/sss_iface/sss_iface_async.h b/src/sss_iface/sss_iface_async.h index 68433566af4..d3ef9733865 100644 --- a/src/sss_iface/sss_iface_async.h +++ b/src/sss_iface/sss_iface_async.h @@ -58,4 +58,15 @@ sss_monitor_service_init(TALLOC_CTX *mem_ctx, time_t *last_request_time, struct sbus_connection **_conn); +errno_t +sss_monitor_provider_init(struct sbus_connection *conn, + const char *svc_name, + uint16_t svc_version, + uint16_t svc_type); + +errno_t +monitor_common_res_init(TALLOC_CTX *mem_ctx, + struct sbus_request *sbus_req, + void *no_data); + #endif /* _SSS_IFACE_ASYNC_H_ */ diff --git a/src/tools/sssctl/sssctl_logs.c b/src/tools/sssctl/sssctl_logs.c index 9aa8df544f3..9ce47cea9d2 100644 --- a/src/tools/sssctl/sssctl_logs.c +++ b/src/tools/sssctl/sssctl_logs.c @@ -110,7 +110,7 @@ static struct sbus_sync_connection *connect_to_sbus(TALLOC_CTX *mem_ctx) { struct sbus_sync_connection *conn; - conn = sbus_sync_connect_private(mem_ctx, SSS_MONITOR_ADDRESS, NULL); + conn = sbus_sync_connect_private(mem_ctx, SSS_BUS_ADDRESS, NULL); if (conn == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Failed to connect to the sbus monitor\n"); }