summaryrefslogtreecommitdiff
path: root/src/responder/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder.h4
-rw-r--r--src/responder/common/responder_get_domains.c49
2 files changed, 53 insertions, 0 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index 68b4ebb2..5331d5b7 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -303,6 +303,10 @@ struct tevent_req *sss_dp_get_domains_send(TALLOC_CTX *mem_ctx,
errno_t sss_dp_get_domains_recv(struct tevent_req *req);
+errno_t schedule_get_domains_task(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct resp_ctx *rctx);
+
errno_t csv_string_to_uid_array(TALLOC_CTX *mem_ctx, const char *cvs_string,
bool allow_sss_loop,
size_t *_uid_count, uid_t **_uids);
diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c
index defa4a43..592cd8dc 100644
--- a/src/responder/common/responder_get_domains.c
+++ b/src/responder/common/responder_get_domains.c
@@ -369,3 +369,52 @@ static errno_t check_last_request(struct resp_ctx *rctx, const char *hint)
return EOK;
}
+
+static void get_domains_at_startup_done(struct tevent_req *req)
+{
+ int ret;
+
+ ret = sss_dp_get_domains_recv(req);
+ talloc_free(req);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, ("sss_dp_get_domains request failed.\n"));
+ }
+
+ return;
+}
+
+static void get_domains_at_startup(struct tevent_context *ev,
+ struct tevent_immediate *imm,
+ void *pvt)
+{
+ struct tevent_req *req;
+ struct resp_ctx *rctx;
+
+ rctx = talloc_get_type(pvt, struct resp_ctx);
+
+ req = sss_dp_get_domains_send(rctx, rctx, true, NULL);
+ if (req == NULL) {
+ DEBUG(SSSDBG_OP_FAILURE, ("sss_dp_get_domains_send failed.\n"));
+ return;
+ }
+
+ tevent_req_set_callback(req, get_domains_at_startup_done, NULL);
+ return;
+}
+
+errno_t schedule_get_domains_task(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct resp_ctx *rctx)
+{
+ struct tevent_immediate *imm;
+
+ imm = tevent_create_immediate(mem_ctx);
+ if (imm == NULL) {
+ DEBUG(SSSDBG_OP_FAILURE, ("tevent_create_immediate failed.\n"));
+ return ENOMEM;
+ }
+
+ tevent_schedule_immediate(imm, ev, get_domains_at_startup, rctx);
+
+ return EOK;
+}