Skip to content

Commit

Permalink
PROXY: Preserve service name in proxy provider
Browse files Browse the repository at this point in the history
Fixes:
https://fedorahosted.org/sssd/ticket/2461

Reviewed-by: Pavel Reichl <[email protected]>
Reviewed-by: Jakub Hrozek <[email protected]>
  • Loading branch information
mzidek-gh authored and jhrozek committed Nov 13, 2014
1 parent 22e0742 commit 38429c9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/providers/proxy/proxy_services.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 38429c9

Please sign in to comment.