dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From e6c49e90d752fdbdf5d12ac18ccb9f297baaa8f1 Mon Sep 17 00:00:00 2001
From: Michal Zidek <mzidek@redhat.com>
Date: Thu, 23 Oct 2014 20:27:57 +0200
Subject: [PATCH 48/48] nss: preserve service name in getsrv call

About case_sensitive=preserving and services.

The name of the service can be preserved in
result of 'getent service'. However we
should still lowercase the protocol and
service aliases because they serve as keys
in some queries to sysdb. The lowercasing is done
by the provider already. If we did not do that,
we would lose case insesnsitivity.

With this patch the responder preserves the
case of service name and protocol, to match
the case that is stored in the sysdb (however
the protocol is already lowercased by provider,
so it was done only for consistent use of the
case_sensitive=preserve option in the responders
and only the case of name is the same as in
ldap).

Fixes:
https://fedorahosted.org/sssd/ticket/2460

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit c4e278c2637547640d28bda007c9c38a17956fcc)
---
 src/responder/nss/nsssrv_services.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index 7741768021cc4a669bd3eda286cd1f25876a55f6..f6abc445c82d268dafb4d1e1fa7336ad01912f9e 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -642,7 +642,7 @@ fill_service(struct sss_packet *packet,
 
         /* Get the service name */
         orig_name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL);
-        tmpstr = sss_get_cased_name(tmp_ctx, orig_name, dom->case_sensitive);
+        tmpstr = sss_get_cased_name(tmp_ctx, orig_name, dom->case_preserve);
         if (tmpstr == NULL) {
             DEBUG(SSSDBG_CRIT_FAILURE,
                   "Could not identify service name, skipping\n");
@@ -677,7 +677,7 @@ fill_service(struct sss_packet *packet,
             orig_proto = (const char *)el->values[0].data;
         }
 
-        tmpstr = sss_get_cased_name(tmp_ctx, orig_proto, dom->case_sensitive);
+        tmpstr = sss_get_cased_name(tmp_ctx, orig_proto, dom->case_preserve);
         if (tmpstr == NULL) {
             DEBUG(SSSDBG_CRIT_FAILURE,
                   "sss_get_cased_name failed, skipping\n");
-- 
1.9.3