|
|
5fca41 |
From 5605fa5f8adf79fa60286f5427aa2f989e663de0 Mon Sep 17 00:00:00 2001
|
|
|
5fca41 |
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
|
5fca41 |
Date: Tue, 11 Jun 2019 12:18:34 +0200
|
|
|
5fca41 |
Subject: [PATCH 43/44] ad: remove all subdomains if only master domain is
|
|
|
5fca41 |
enabled
|
|
|
5fca41 |
|
|
|
5fca41 |
Resolves:
|
|
|
5fca41 |
https://pagure.io/SSSD/sssd/issue/4009
|
|
|
5fca41 |
|
|
|
5fca41 |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
5fca41 |
(cherry picked from commit d0bdaabbc95bc9ee3253e1376d849e6a8bd6c6f0)
|
|
|
5fca41 |
---
|
|
|
5fca41 |
src/providers/ad/ad_subdomains.c | 23 +++++++++++++++++++++++
|
|
|
5fca41 |
1 file changed, 23 insertions(+)
|
|
|
5fca41 |
|
|
|
5fca41 |
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
|
|
|
5fca41 |
index 57438fdd5..0f6d781ae 100644
|
|
|
5fca41 |
--- a/src/providers/ad/ad_subdomains.c
|
|
|
5fca41 |
+++ b/src/providers/ad/ad_subdomains.c
|
|
|
5fca41 |
@@ -1804,9 +1804,11 @@ static void ad_subdomains_refresh_gc_check_done(struct tevent_req *subreq)
|
|
|
5fca41 |
{
|
|
|
5fca41 |
struct ad_subdomains_refresh_state *state;
|
|
|
5fca41 |
struct tevent_req *req;
|
|
|
5fca41 |
+ const char **subdoms;
|
|
|
5fca41 |
const char *ad_domain;
|
|
|
5fca41 |
bool is_gc_usable;
|
|
|
5fca41 |
errno_t ret;
|
|
|
5fca41 |
+ int i;
|
|
|
5fca41 |
|
|
|
5fca41 |
req = tevent_req_callback_data(subreq, struct tevent_req);
|
|
|
5fca41 |
state = tevent_req_data(req, struct ad_subdomains_refresh_state);
|
|
|
5fca41 |
@@ -1832,6 +1834,27 @@ static void ad_subdomains_refresh_gc_check_done(struct tevent_req *subreq)
|
|
|
5fca41 |
state->be_ctx->domain->name) == 0) {
|
|
|
5fca41 |
DEBUG(SSSDBG_TRACE_FUNC,
|
|
|
5fca41 |
"No other enabled domain than master.\n");
|
|
|
5fca41 |
+
|
|
|
5fca41 |
+ ret = sysdb_list_subdomains(state, state->be_ctx->domain->sysdb,
|
|
|
5fca41 |
+ &subdoms);
|
|
|
5fca41 |
+ if (ret != EOK) {
|
|
|
5fca41 |
+ DEBUG(SSSDBG_OP_FAILURE, "Unable to list subdomains "
|
|
|
5fca41 |
+ "[%d]: %s\n", ret, sss_strerror(ret));
|
|
|
5fca41 |
+ tevent_req_error(req, ret);
|
|
|
5fca41 |
+ return;
|
|
|
5fca41 |
+ }
|
|
|
5fca41 |
+
|
|
|
5fca41 |
+ for (i = 0; subdoms[i] != NULL; i++) {
|
|
|
5fca41 |
+ ret = sysdb_subdomain_delete(state->be_ctx->domain->sysdb,
|
|
|
5fca41 |
+ subdoms[i]);
|
|
|
5fca41 |
+ if (ret != EOK) {
|
|
|
5fca41 |
+ DEBUG(SSSDBG_OP_FAILURE, "Unable to remove subdomain "
|
|
|
5fca41 |
+ "[%d]: %s\n", ret, sss_strerror(ret));
|
|
|
5fca41 |
+ tevent_req_error(req, ret);
|
|
|
5fca41 |
+ return;
|
|
|
5fca41 |
+ }
|
|
|
5fca41 |
+ }
|
|
|
5fca41 |
+
|
|
|
5fca41 |
tevent_req_done(req);
|
|
|
5fca41 |
return;
|
|
|
5fca41 |
}
|
|
|
5fca41 |
--
|
|
|
5fca41 |
2.20.1
|
|
|
5fca41 |
|