dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 90e871a816440af34f095d3b1003476a0978a348 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Tue, 14 Jan 2014 11:10:25 +0100
Subject: [PATCH 50/53] NSS: Use plain user name when expanding homedir

---
 src/responder/nss/nsssrv_cmd.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 550017c0e4385a7147ed5ef83da2c37cb97c8092..c59078b545842561a7e5f62e9a99da6057b23660 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -172,13 +172,24 @@ static const char *get_homedir_override(TALLOC_CTX *mem_ctx,
                                         struct ldb_message *msg,
                                         struct nss_ctx *nctx,
                                         struct sss_domain_info *dom,
-                                        const char *name,
+                                        const char *orig_name,
                                         uint32_t uid)
 {
     const char *homedir;
+    char *name;
+    char *domname;
+    errno_t ret;
 
     homedir = ldb_msg_find_attr_as_string(msg, SYSDB_HOMEDIR, NULL);
 
+    /* Subdomain users store FQDN in their name attribute */
+    ret = sss_parse_name(mem_ctx, dom->names, orig_name, &domname, &name);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_MINOR_FAILURE, ("Could not parse [%s] into "
+              "name-value components.\n", orig_name));
+        return NULL;
+    }
+
     /* Check whether we are unconditionally overriding the server
      * for home directory locations.
      */
-- 
1.8.4.2