|
|
905b4d |
From 6505a4a36592efe94bfbdbfb07ca4d198a699a8b Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Michal Zidek <mzidek@redhat.com>
|
|
|
905b4d |
Date: Thu, 6 Nov 2014 19:25:59 +0100
|
|
|
905b4d |
Subject: [PATCH 82/82] PROXY: Preserve service name in proxy provider
|
|
|
905b4d |
|
|
|
905b4d |
Fixes:
|
|
|
905b4d |
https://fedorahosted.org/sssd/ticket/2461
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Pavel Reichl <preichl@redhat.com>
|
|
|
905b4d |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
---
|
|
|
905b4d |
src/providers/proxy/proxy_services.c | 22 +++++++++++++++++++++-
|
|
|
905b4d |
1 file changed, 21 insertions(+), 1 deletion(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/providers/proxy/proxy_services.c b/src/providers/proxy/proxy_services.c
|
|
|
905b4d |
index 16e90b009cba86ea17d8d29a4fbeb19efe6947fc..2aa44dbf7f061b99a551b199d0265393e5399a06 100644
|
|
|
905b4d |
--- a/src/providers/proxy/proxy_services.c
|
|
|
905b4d |
+++ b/src/providers/proxy/proxy_services.c
|
|
|
905b4d |
@@ -38,12 +38,14 @@ proxy_save_service(struct sss_domain_info *domain,
|
|
|
905b4d |
const char **protocols;
|
|
|
905b4d |
const char **cased_aliases;
|
|
|
905b4d |
TALLOC_CTX *tmp_ctx;
|
|
|
905b4d |
+ char *lc_alias = NULL;
|
|
|
905b4d |
time_t now = time(NULL);
|
|
|
905b4d |
|
|
|
905b4d |
tmp_ctx = talloc_new(NULL);
|
|
|
905b4d |
if (!tmp_ctx) return ENOMEM;
|
|
|
905b4d |
|
|
|
905b4d |
- cased_name = sss_get_cased_name(tmp_ctx, svc->s_name, !lowercase);
|
|
|
905b4d |
+ cased_name = sss_get_cased_name(tmp_ctx, svc->s_name,
|
|
|
905b4d |
+ domain->case_preserve);
|
|
|
905b4d |
if (!cased_name) {
|
|
|
905b4d |
ret = ENOMEM;
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
@@ -71,6 +73,24 @@ proxy_save_service(struct sss_domain_info *domain,
|
|
|
905b4d |
goto done;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
+ if (domain->case_preserve) {
|
|
|
905b4d |
+ /* Add lowercased alias to allow case-insensitive lookup */
|
|
|
905b4d |
+ lc_alias = sss_tc_utf8_str_tolower(tmp_ctx, svc->s_name);
|
|
|
905b4d |
+ if (lc_alias == NULL) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_OP_FAILURE, "Cannot convert name to lowercase.\n");
|
|
|
905b4d |
+ ret = ENOMEM;
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
+ ret = add_string_to_list(tmp_ctx, lc_alias,
|
|
|
905b4d |
+ discard_const_p(char **, &cased_aliases));
|
|
|
905b4d |
+ if (ret != EOK) {
|
|
|
905b4d |
+ DEBUG(SSSDBG_OP_FAILURE,
|
|
|
905b4d |
+ "Failed to add lowercased name alias.\n");
|
|
|
905b4d |
+ goto done;
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+ }
|
|
|
905b4d |
+
|
|
|
905b4d |
ret = sysdb_store_service(domain,
|
|
|
905b4d |
cased_name,
|
|
|
905b4d |
ntohs(svc->s_port),
|
|
|
905b4d |
--
|
|
|
905b4d |
1.9.3
|
|
|
905b4d |
|