|
|
5cd47f |
From 106d93c6e03bfdf1bfc4f2691562b4855a1d4763 Mon Sep 17 00:00:00 2001
|
|
|
5cd47f |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
5cd47f |
Date: Mon, 20 May 2019 22:42:47 +0200
|
|
|
5cd47f |
Subject: [PATCH 49/64] BE/LDAP: Call be_refresh_ctx_init() in the provider
|
|
|
5cd47f |
libraries, not in back end
|
|
|
5cd47f |
|
|
|
5cd47f |
Since later patches will pass different parameters to
|
|
|
5cd47f |
be_refresh_ctx_init(), let's call the init function in the provider
|
|
|
5cd47f |
libraries not directly in the back end.
|
|
|
5cd47f |
|
|
|
5cd47f |
Related:
|
|
|
5cd47f |
https://pagure.io/SSSD/sssd/issue/4012
|
|
|
5cd47f |
|
|
|
5cd47f |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
5cd47f |
(cherry picked from commit 9d49c90ceb7388333c8682f4cbd6842ec236b9de)
|
|
|
5cd47f |
|
|
|
5cd47f |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
5cd47f |
---
|
|
|
5cd47f |
src/providers/ad/ad_init.c | 2 +-
|
|
|
5cd47f |
src/providers/data_provider_be.c | 8 --------
|
|
|
5cd47f |
src/providers/ipa/ipa_init.c | 2 +-
|
|
|
5cd47f |
src/providers/ldap/ldap_common.h | 2 +-
|
|
|
5cd47f |
src/providers/ldap/ldap_init.c | 2 +-
|
|
|
5cd47f |
src/providers/ldap/sdap_refresh.c | 17 +++++++++++++----
|
|
|
5cd47f |
6 files changed, 17 insertions(+), 16 deletions(-)
|
|
|
5cd47f |
|
|
|
5cd47f |
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
|
|
|
5cd47f |
index 302bcae7d..42c2f150a 100644
|
|
|
5cd47f |
--- a/src/providers/ad/ad_init.c
|
|
|
5cd47f |
+++ b/src/providers/ad/ad_init.c
|
|
|
5cd47f |
@@ -408,7 +408,7 @@ static errno_t ad_init_misc(struct be_ctx *be_ctx,
|
|
|
5cd47f |
return ret;
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
- ret = sdap_refresh_init(be_ctx->refresh_ctx, sdap_id_ctx);
|
|
|
5cd47f |
+ ret = sdap_refresh_init(be_ctx, sdap_id_ctx);
|
|
|
5cd47f |
if (ret != EOK && ret != EEXIST) {
|
|
|
5cd47f |
DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh "
|
|
|
5cd47f |
"will not work [%d]: %s\n", ret, sss_strerror(ret));
|
|
|
5cd47f |
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
|
|
|
5cd47f |
index 8dbddbb5f..d13654b8b 100644
|
|
|
5cd47f |
--- a/src/providers/data_provider_be.c
|
|
|
5cd47f |
+++ b/src/providers/data_provider_be.c
|
|
|
5cd47f |
@@ -522,14 +522,6 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx,
|
|
|
5cd47f |
goto done;
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
- /* Initialize be_refresh periodic task. */
|
|
|
5cd47f |
- be_ctx->refresh_ctx = be_refresh_ctx_init(be_ctx);
|
|
|
5cd47f |
- if (be_ctx->refresh_ctx == NULL) {
|
|
|
5cd47f |
- DEBUG(SSSDBG_FATAL_FAILURE, "Unable to initialize refresh_ctx\n");
|
|
|
5cd47f |
- ret = ENOMEM;
|
|
|
5cd47f |
- goto done;
|
|
|
5cd47f |
- }
|
|
|
5cd47f |
-
|
|
|
5cd47f |
ret = dp_init(be_ctx->ev, be_ctx, be_ctx->uid, be_ctx->gid);
|
|
|
5cd47f |
if (ret != EOK) {
|
|
|
5cd47f |
DEBUG(SSSDBG_FATAL_FAILURE, "Unable to setup data provider "
|
|
|
5cd47f |
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
|
|
|
5cd47f |
index 6818e2171..b3060e228 100644
|
|
|
5cd47f |
--- a/src/providers/ipa/ipa_init.c
|
|
|
5cd47f |
+++ b/src/providers/ipa/ipa_init.c
|
|
|
5cd47f |
@@ -594,7 +594,7 @@ static errno_t ipa_init_misc(struct be_ctx *be_ctx,
|
|
|
5cd47f |
}
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
- ret = sdap_refresh_init(be_ctx->refresh_ctx, sdap_id_ctx);
|
|
|
5cd47f |
+ ret = sdap_refresh_init(be_ctx, sdap_id_ctx);
|
|
|
5cd47f |
if (ret != EOK && ret != EEXIST) {
|
|
|
5cd47f |
DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh "
|
|
|
5cd47f |
"will not work [%d]: %s\n", ret, sss_strerror(ret));
|
|
|
5cd47f |
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
|
|
|
5cd47f |
index 04548a388..f30b67eb3 100644
|
|
|
5cd47f |
--- a/src/providers/ldap/ldap_common.h
|
|
|
5cd47f |
+++ b/src/providers/ldap/ldap_common.h
|
|
|
5cd47f |
@@ -362,7 +362,7 @@ struct sdap_id_ctx *
|
|
|
5cd47f |
sdap_id_ctx_new(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
|
|
|
5cd47f |
struct sdap_service *sdap_service);
|
|
|
5cd47f |
|
|
|
5cd47f |
-errno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
|
|
|
5cd47f |
+errno_t sdap_refresh_init(struct be_ctx *be_ctx,
|
|
|
5cd47f |
struct sdap_id_ctx *id_ctx);
|
|
|
5cd47f |
|
|
|
5cd47f |
errno_t sdap_init_certmap(TALLOC_CTX *mem_ctx, struct sdap_id_ctx *id_ctx);
|
|
|
5cd47f |
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
|
|
|
5cd47f |
index 352f0b656..489e1c225 100644
|
|
|
5cd47f |
--- a/src/providers/ldap/ldap_init.c
|
|
|
5cd47f |
+++ b/src/providers/ldap/ldap_init.c
|
|
|
5cd47f |
@@ -432,7 +432,7 @@ static errno_t ldap_init_misc(struct be_ctx *be_ctx,
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
/* Setup periodical refresh of expired records */
|
|
|
5cd47f |
- ret = sdap_refresh_init(be_ctx->refresh_ctx, id_ctx);
|
|
|
5cd47f |
+ ret = sdap_refresh_init(be_ctx, id_ctx);
|
|
|
5cd47f |
if (ret != EOK && ret != EEXIST) {
|
|
|
5cd47f |
DEBUG(SSSDBG_MINOR_FAILURE, "Periodical refresh will not work "
|
|
|
5cd47f |
"[%d]: %s\n", ret, sss_strerror(ret));
|
|
|
5cd47f |
diff --git a/src/providers/ldap/sdap_refresh.c b/src/providers/ldap/sdap_refresh.c
|
|
|
5cd47f |
index 6d6c43e20..457df8be2 100644
|
|
|
5cd47f |
--- a/src/providers/ldap/sdap_refresh.c
|
|
|
5cd47f |
+++ b/src/providers/ldap/sdap_refresh.c
|
|
|
5cd47f |
@@ -255,12 +255,19 @@ static errno_t sdap_refresh_netgroups_recv(struct tevent_req *req)
|
|
|
5cd47f |
return sdap_refresh_recv(req);
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
-errno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
|
|
|
5cd47f |
+errno_t sdap_refresh_init(struct be_ctx *be_ctx,
|
|
|
5cd47f |
struct sdap_id_ctx *id_ctx)
|
|
|
5cd47f |
{
|
|
|
5cd47f |
errno_t ret;
|
|
|
5cd47f |
|
|
|
5cd47f |
- ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_USERS,
|
|
|
5cd47f |
+ be_ctx->refresh_ctx = be_refresh_ctx_init(be_ctx);
|
|
|
5cd47f |
+ if (be_ctx->refresh_ctx == NULL) {
|
|
|
5cd47f |
+ DEBUG(SSSDBG_FATAL_FAILURE, "Unable to initialize refresh_ctx\n");
|
|
|
5cd47f |
+ return ENOMEM;
|
|
|
5cd47f |
+ }
|
|
|
5cd47f |
+
|
|
|
5cd47f |
+ ret = be_refresh_add_cb(be_ctx->refresh_ctx,
|
|
|
5cd47f |
+ BE_REFRESH_TYPE_USERS,
|
|
|
5cd47f |
sdap_refresh_users_send,
|
|
|
5cd47f |
sdap_refresh_users_recv,
|
|
|
5cd47f |
id_ctx);
|
|
|
5cd47f |
@@ -269,7 +276,8 @@ errno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
|
|
|
5cd47f |
"will not work [%d]: %s\n", ret, strerror(ret));
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
- ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_GROUPS,
|
|
|
5cd47f |
+ ret = be_refresh_add_cb(be_ctx->refresh_ctx,
|
|
|
5cd47f |
+ BE_REFRESH_TYPE_USERS,
|
|
|
5cd47f |
sdap_refresh_groups_send,
|
|
|
5cd47f |
sdap_refresh_groups_recv,
|
|
|
5cd47f |
id_ctx);
|
|
|
5cd47f |
@@ -278,7 +286,8 @@ errno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
|
|
|
5cd47f |
"will not work [%d]: %s\n", ret, strerror(ret));
|
|
|
5cd47f |
}
|
|
|
5cd47f |
|
|
|
5cd47f |
- ret = be_refresh_add_cb(refresh_ctx, BE_REFRESH_TYPE_NETGROUPS,
|
|
|
5cd47f |
+ ret = be_refresh_add_cb(be_ctx->refresh_ctx,
|
|
|
5cd47f |
+ BE_REFRESH_TYPE_USERS,
|
|
|
5cd47f |
sdap_refresh_netgroups_send,
|
|
|
5cd47f |
sdap_refresh_netgroups_recv,
|
|
|
5cd47f |
id_ctx);
|
|
|
5cd47f |
--
|
|
|
5cd47f |
2.20.1
|
|
|
5cd47f |
|