|
|
cdf651 |
From 54ea4576ba8cb8dfbefdd3ced29fc35f836afc61 Mon Sep 17 00:00:00 2001
|
|
|
cdf651 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
cdf651 |
Date: Fri, 8 Jun 2018 08:29:04 +0200
|
|
|
cdf651 |
Subject: [PATCH] krb5_common: add callback only once
|
|
|
cdf651 |
|
|
|
cdf651 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
cdf651 |
(cherry picked from commit 4759a482781bcecdb0ad1119e74dcefa1fe94337)
|
|
|
cdf651 |
---
|
|
|
cdf651 |
src/providers/krb5/krb5_common.c | 12 +++++++++++-
|
|
|
cdf651 |
src/providers/krb5/krb5_common.h | 2 ++
|
|
|
cdf651 |
2 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
cdf651 |
|
|
|
cdf651 |
diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c
|
|
|
cdf651 |
index c6896a6cd663da896075e72aa0a0602c198b45e8..d064a09ac3726c4185c2fa1eeac76ef6c261d33b 100644
|
|
|
cdf651 |
--- a/src/providers/krb5/krb5_common.c
|
|
|
cdf651 |
+++ b/src/providers/krb5/krb5_common.c
|
|
|
cdf651 |
@@ -399,6 +399,7 @@ static int remove_info_files_destructor(void *p)
|
|
|
cdf651 |
if (ret != EOK) {
|
|
|
cdf651 |
DEBUG(SSSDBG_CRIT_FAILURE, "remove_krb5_info_files failed.\n");
|
|
|
cdf651 |
}
|
|
|
cdf651 |
+ ctx->krb5_service->removal_callback_available = false;
|
|
|
cdf651 |
|
|
|
cdf651 |
return 0;
|
|
|
cdf651 |
}
|
|
|
cdf651 |
@@ -407,7 +408,7 @@ static errno_t
|
|
|
cdf651 |
krb5_add_krb5info_offline_callback(struct krb5_service *krb5_service)
|
|
|
cdf651 |
{
|
|
|
cdf651 |
int ret;
|
|
|
cdf651 |
- struct remove_info_files_ctx *ctx;
|
|
|
cdf651 |
+ struct remove_info_files_ctx *ctx = NULL;
|
|
|
cdf651 |
|
|
|
cdf651 |
if (krb5_service == NULL || krb5_service->name == NULL
|
|
|
cdf651 |
|| krb5_service->realm == NULL
|
|
|
cdf651 |
@@ -416,6 +417,13 @@ krb5_add_krb5info_offline_callback(struct krb5_service *krb5_service)
|
|
|
cdf651 |
return EINVAL;
|
|
|
cdf651 |
}
|
|
|
cdf651 |
|
|
|
cdf651 |
+ if (krb5_service->removal_callback_available) {
|
|
|
cdf651 |
+ DEBUG(SSSDBG_TRACE_ALL,
|
|
|
cdf651 |
+ "Removal callback already available for service [%s].\n",
|
|
|
cdf651 |
+ krb5_service->name);
|
|
|
cdf651 |
+ return EOK;
|
|
|
cdf651 |
+ }
|
|
|
cdf651 |
+
|
|
|
cdf651 |
ctx = talloc_zero(krb5_service->be_ctx, struct remove_info_files_ctx);
|
|
|
cdf651 |
if (ctx == NULL) {
|
|
|
cdf651 |
DEBUG(SSSDBG_CRIT_FAILURE, "talloc_zfree failed.\n");
|
|
|
cdf651 |
@@ -430,6 +438,7 @@ krb5_add_krb5info_offline_callback(struct krb5_service *krb5_service)
|
|
|
cdf651 |
}
|
|
|
cdf651 |
|
|
|
cdf651 |
ctx->be_ctx = krb5_service->be_ctx;
|
|
|
cdf651 |
+ ctx->krb5_service = krb5_service;
|
|
|
cdf651 |
ctx->kdc_service_name = talloc_strdup(ctx, krb5_service->name);
|
|
|
cdf651 |
if (ctx->kdc_service_name == NULL) {
|
|
|
cdf651 |
DEBUG(SSSDBG_CRIT_FAILURE, "talloc_strdup failed!\n");
|
|
|
cdf651 |
@@ -445,6 +454,7 @@ krb5_add_krb5info_offline_callback(struct krb5_service *krb5_service)
|
|
|
cdf651 |
}
|
|
|
cdf651 |
|
|
|
cdf651 |
talloc_set_destructor((TALLOC_CTX *) ctx, remove_info_files_destructor);
|
|
|
cdf651 |
+ krb5_service->removal_callback_available = true;
|
|
|
cdf651 |
|
|
|
cdf651 |
ret = EOK;
|
|
|
cdf651 |
|
|
|
cdf651 |
diff --git a/src/providers/krb5/krb5_common.h b/src/providers/krb5/krb5_common.h
|
|
|
cdf651 |
index a2e47b0605debdffa28305dab4f7674707f713ac..3529d740b89fee91281f936fdafd1bdb99e95bd7 100644
|
|
|
cdf651 |
--- a/src/providers/krb5/krb5_common.h
|
|
|
cdf651 |
+++ b/src/providers/krb5/krb5_common.h
|
|
|
cdf651 |
@@ -71,6 +71,7 @@ struct krb5_service {
|
|
|
cdf651 |
char *name;
|
|
|
cdf651 |
char *realm;
|
|
|
cdf651 |
bool write_kdcinfo;
|
|
|
cdf651 |
+ bool removal_callback_available;
|
|
|
cdf651 |
};
|
|
|
cdf651 |
|
|
|
cdf651 |
struct fo_service;
|
|
|
cdf651 |
@@ -146,6 +147,7 @@ struct remove_info_files_ctx {
|
|
|
cdf651 |
struct be_ctx *be_ctx;
|
|
|
cdf651 |
const char *kdc_service_name;
|
|
|
cdf651 |
const char *kpasswd_service_name;
|
|
|
cdf651 |
+ struct krb5_service *krb5_service;
|
|
|
cdf651 |
};
|
|
|
cdf651 |
|
|
|
cdf651 |
errno_t sss_krb5_check_options(struct dp_option *opts,
|
|
|
cdf651 |
--
|
|
|
cdf651 |
2.17.1
|
|
|
cdf651 |
|