diff options
author | Michal Zidek <mzidek@redhat.com> | 2014-11-06 19:25:59 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-11-19 11:02:03 +0100 |
commit | 6505a4a36592efe94bfbdbfb07ca4d198a699a8b (patch) | |
tree | fa66dffdf27a49cca4bbd8fb254a870c38b1f92c /src | |
parent | aeb6e3d066122621e1ec043f0c7848363539ca5f (diff) | |
download | sssd-6505a4a36592efe94bfbdbfb07ca4d198a699a8b.tar.gz sssd-6505a4a36592efe94bfbdbfb07ca4d198a699a8b.tar.xz sssd-6505a4a36592efe94bfbdbfb07ca4d198a699a8b.zip |
PROXY: Preserve service name in proxy provider
Fixes:
https://fedorahosted.org/sssd/ticket/2461
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/providers/proxy/proxy_services.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/providers/proxy/proxy_services.c b/src/providers/proxy/proxy_services.c index 16e90b009..2aa44dbf7 100644 --- a/src/providers/proxy/proxy_services.c +++ b/src/providers/proxy/proxy_services.c @@ -38,12 +38,14 @@ proxy_save_service(struct sss_domain_info *domain, const char **protocols; const char **cased_aliases; TALLOC_CTX *tmp_ctx; + char *lc_alias = NULL; time_t now = time(NULL); tmp_ctx = talloc_new(NULL); if (!tmp_ctx) return ENOMEM; - cased_name = sss_get_cased_name(tmp_ctx, svc->s_name, !lowercase); + cased_name = sss_get_cased_name(tmp_ctx, svc->s_name, + domain->case_preserve); if (!cased_name) { ret = ENOMEM; goto done; @@ -71,6 +73,24 @@ proxy_save_service(struct sss_domain_info *domain, goto done; } + if (domain->case_preserve) { + /* Add lowercased alias to allow case-insensitive lookup */ + lc_alias = sss_tc_utf8_str_tolower(tmp_ctx, svc->s_name); + if (lc_alias == NULL) { + DEBUG(SSSDBG_OP_FAILURE, "Cannot convert name to lowercase.\n"); + ret = ENOMEM; + goto done; + } + + ret = add_string_to_list(tmp_ctx, lc_alias, + discard_const_p(char **, &cased_aliases)); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, + "Failed to add lowercased name alias.\n"); + goto done; + } + } + ret = sysdb_store_service(domain, cased_name, ntohs(svc->s_port), |