From 3e7bcf5239f95c7b37b8994f00a8aae918aa8793 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 22 Mar 2012 16:50:12 +0100 Subject: LDAP services: Save lowercased protocol names in case-insensitive domains https://fedorahosted.org/sssd/ticket/1260 --- src/providers/ldap/sdap_async_services.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/providers/ldap/sdap_async_services.c b/src/providers/ldap/sdap_async_services.c index ae96d8882..c87d07c44 100644 --- a/src/providers/ldap/sdap_async_services.c +++ b/src/providers/ldap/sdap_async_services.c @@ -351,6 +351,8 @@ sdap_save_service(TALLOC_CTX *mem_ctx, const char *name = NULL; const char **aliases; const char **protocols; + const char **cased_protocols; + const char **store_protocols; char **missing; uint16_t port; uint64_t cache_timeout; @@ -412,6 +414,20 @@ sdap_save_service(TALLOC_CTX *mem_ctx, goto done; } + if (dom->case_sensitive == false) { + /* Don't perform the extra mallocs if not necessary */ + ret = sss_get_cased_name_list(tmp_ctx, protocols, + dom->case_sensitive, &cased_protocols); + if (ret != EOK) { + DEBUG(SSSDBG_MINOR_FAILURE, + ("Failed to get case_sensitive protocols names: [%s]\n", + strerror(ret))); + goto done; + } + } + + store_protocols = dom->case_sensitive ? protocols : cased_protocols; + /* Get the USN value, if available */ ret = sysdb_attrs_get_el(attrs, opts->service_map[SDAP_AT_SERVICE_USN].sys_name, &el); @@ -456,7 +472,7 @@ sdap_save_service(TALLOC_CTX *mem_ctx, cache_timeout = dom->service_timeout; - ret = sysdb_store_service(sysdb, name, port, aliases, protocols, + ret = sysdb_store_service(sysdb, name, port, aliases, store_protocols, svc_attrs, missing, cache_timeout, now); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, -- cgit