dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0050-NSS-Use-plain-user-name-when-expanding-homedir.patch

2fc102
From 90e871a816440af34f095d3b1003476a0978a348 Mon Sep 17 00:00:00 2001
2fc102
From: Jakub Hrozek <jhrozek@redhat.com>
2fc102
Date: Tue, 14 Jan 2014 11:10:25 +0100
2fc102
Subject: [PATCH 50/53] NSS: Use plain user name when expanding homedir
2fc102
2fc102
---
2fc102
 src/responder/nss/nsssrv_cmd.c | 13 ++++++++++++-
2fc102
 1 file changed, 12 insertions(+), 1 deletion(-)
2fc102
2fc102
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
2fc102
index 550017c0e4385a7147ed5ef83da2c37cb97c8092..c59078b545842561a7e5f62e9a99da6057b23660 100644
2fc102
--- a/src/responder/nss/nsssrv_cmd.c
2fc102
+++ b/src/responder/nss/nsssrv_cmd.c
2fc102
@@ -172,13 +172,24 @@ static const char *get_homedir_override(TALLOC_CTX *mem_ctx,
2fc102
                                         struct ldb_message *msg,
2fc102
                                         struct nss_ctx *nctx,
2fc102
                                         struct sss_domain_info *dom,
2fc102
-                                        const char *name,
2fc102
+                                        const char *orig_name,
2fc102
                                         uint32_t uid)
2fc102
 {
2fc102
     const char *homedir;
2fc102
+    char *name;
2fc102
+    char *domname;
2fc102
+    errno_t ret;
2fc102
 
2fc102
     homedir = ldb_msg_find_attr_as_string(msg, SYSDB_HOMEDIR, NULL);
2fc102
 
2fc102
+    /* Subdomain users store FQDN in their name attribute */
2fc102
+    ret = sss_parse_name(mem_ctx, dom->names, orig_name, &domname, &name);
2fc102
+    if (ret != EOK) {
2fc102
+        DEBUG(SSSDBG_MINOR_FAILURE, ("Could not parse [%s] into "
2fc102
+              "name-value components.\n", orig_name));
2fc102
+        return NULL;
2fc102
+    }
2fc102
+
2fc102
     /* Check whether we are unconditionally overriding the server
2fc102
      * for home directory locations.
2fc102
      */
2fc102
-- 
2fc102
1.8.4.2
2fc102