summaryrefslogtreecommitdiff
path: root/source3/lib/username.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/username.c')
-rw-r--r--source3/lib/username.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 8154a2b40e..c7e25b7cd1 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -45,6 +45,13 @@ char *get_user_home_dir(const char *user)
static struct passwd *pass;
int snum;
+ /* Ensure the user exists. */
+
+ pass = Get_Pwnam(user);
+
+ if (!pass)
+ return(NULL);
+
/* If a path is specified in [homes] then use it instead of the
user's home directory from struct passwd. */
@@ -52,18 +59,14 @@ char *get_user_home_dir(const char *user)
static pstring home_dir;
pstrcpy(home_dir, lp_pathname(snum));
- standard_sub_snum(snum, home_dir);
+ standard_sub_home(snum, user, home_dir);
if (home_dir[0])
return home_dir;
}
- /* Get home directory from struct passwd. */
-
- pass = Get_Pwnam(user);
+ /* Return home directory from struct passwd. */
- if (!pass)
- return(NULL);
return(pass->pw_dir);
}