summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/substitute.c6
-rw-r--r--source3/lib/username.c19
2 files changed, 20 insertions, 5 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index deef085c99..5a2bc1d890 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -97,10 +97,7 @@ static char *automount_path(const char *user_name)
/* use the passwd entry as the default */
/* this will be the default if WITH_AUTOMOUNT is not used or fails */
- if (((pass = Get_Pwnam(user_name))!=NULL) && (pass->pw_dir != NULL))
- pstrcpy(server_path, pass->pw_dir );
- else
- *server_path = '\0';
+ pstrcpy(server_path, get_user_home_dir(user_name));
#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
@@ -117,7 +114,6 @@ static char *automount_path(const char *user_name)
}
} else {
/* NIS key lookup failed: default to user home directory from password file */
- pstrcpy(server_path, get_user_home_dir(user_name));
DEBUG(5, ("NIS lookup failed. Using Home path from passwd file. Home path is: %s\n", server_path ));
}
}
diff --git a/source3/lib/username.c b/source3/lib/username.c
index c7e25b7cd1..81408f4569 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -43,6 +43,25 @@ BOOL name_is_local(const char *name)
char *get_user_home_dir(const char *user)
{
static struct passwd *pass;
+
+ /* Ensure the user exists. */
+
+ pass = Get_Pwnam(user);
+
+ if (!pass)
+ return(NULL);
+ /* Return home directory from struct passwd. */
+
+ return(pass->pw_dir);
+}
+
+/****************************************************************************
+ Get a users service home directory.
+****************************************************************************/
+
+char *get_user_service_home_dir(const char *user)
+{
+ static struct passwd *pass;
int snum;
/* Ensure the user exists. */