diff options
author | Michal Zidek <mzidek@redhat.com> | 2014-11-06 19:25:59 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-11-13 19:37:07 +0100 |
commit | 38429c99bf5af14c2d6bae6ddcf70974fdd103cc (patch) | |
tree | 72d3ac3d6e03591fbab676d8f67a9c7c02de1a14 | |
parent | 22e074249928605a1d5b926274ae2efb1596bc73 (diff) | |
download | sssd-38429c99bf5af14c2d6bae6ddcf70974fdd103cc.tar.gz sssd-38429c99bf5af14c2d6bae6ddcf70974fdd103cc.tar.xz sssd-38429c99bf5af14c2d6bae6ddcf70974fdd103cc.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>
-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), |