summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-05-31 10:52:05 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-04 17:24:13 +0200
commit909a86af4eb99f5d311d7136cab78dca535ae304 (patch)
treeecf8477033ec37ab8de6b415fc06eac1c6fb1240
parent06dad7ed041e90b106475e06d4eb542548d560ed (diff)
downloadsssd-909a86af4eb99f5d311d7136cab78dca535ae304.tar.gz
sssd-909a86af4eb99f5d311d7136cab78dca535ae304.tar.xz
sssd-909a86af4eb99f5d311d7136cab78dca535ae304.zip
Lookup domains at startup
To make sure that e.g. the short/NetBIOS domain name is available this patch make sure that the responders send a get_domains request to their backends at startup the collect the domain information or read it from the cache if the backend is offline. For completeness I added this to all responders even if they do not need the information at the moment. Fixes https://fedorahosted.org/sssd/ticket/1951
-rw-r--r--src/responder/autofs/autofssrv.c6
-rw-r--r--src/responder/common/responder.h4
-rw-r--r--src/responder/common/responder_get_domains.c49
-rw-r--r--src/responder/nss/nsssrv.c6
-rw-r--r--src/responder/pac/pacsrv.c6
-rw-r--r--src/responder/pam/pamsrv.c6
-rw-r--r--src/responder/ssh/sshsrv.c6
-rw-r--r--src/responder/sudo/sudosrv.c6
8 files changed, 89 insertions, 0 deletions
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c
index ea4c04946..edd6f4202 100644
--- a/src/responder/autofs/autofssrv.c
+++ b/src/responder/autofs/autofssrv.c
@@ -194,6 +194,12 @@ autofs_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, ("autofs Initialization complete\n"));
return EOK;
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index 68b4ebb23..5331d5b75 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 defa4a430..592cd8dcd 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;
+}
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index ee8fecb01..ebad15015 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -532,6 +532,12 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
}
responder_set_fd_limit(fd_limit);
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, ("NSS Initialization complete\n"));
return EOK;
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index 9bc276631..22f87cb75 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -207,6 +207,12 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
}
responder_set_fd_limit(fd_limit);
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, ("PAC Initialization complete\n"));
return EOK;
diff --git a/src/responder/pam/pamsrv.c b/src/responder/pam/pamsrv.c
index c71ef07ca..fad564a04 100644
--- a/src/responder/pam/pamsrv.c
+++ b/src/responder/pam/pamsrv.c
@@ -203,6 +203,12 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
}
responder_set_fd_limit(fd_limit);
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto done;
+ }
+
ret = EOK;
done:
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index 410e631af..a1d1f6c5e 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -166,6 +166,12 @@ int ssh_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, ("SSH Initialization complete\n"));
return EOK;
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index a6344a99a..e6bd997ec 100644
--- a/src/responder/sudo/sudosrv.c
+++ b/src/responder/sudo/sudosrv.c
@@ -148,6 +148,12 @@ int sudo_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
+ ret = schedule_get_domains_task(rctx, rctx->ev, rctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE, ("schedule_get_domains_tasks failed.\n"));
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, ("SUDO Initialization complete\n"));
return EOK;