From f0e8a3d5e8bef267c032c0e6a4df666547334cb3 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 18 Dec 2001 06:11:32 +0000 Subject: A fix to override the location of a user's home directory if it is specified in the [homes] section of the smb.conf file. Jeremy, can you take a look at this? This is in response to someone on the samba mailing list worrying about it. Tim. From: Phil Thompson To: samba@lists.samba.org Subject: Different [homes] behavior in 2.2.2 X-Original-Date: Mon, 17 Dec 2001 23:09:28 -0500 Is it possible to configure samba to disregard the home directory in the passwd file when using [homes]? Even though an alternate "path" is set in [homes], the service fails since the unix home directory is invalid (nonexistent) on the server. [...] This behavior of validating the user's home dir as set in the passwd files appears to be new in 2.2.2 and the latest CVS. Anyway to work around this? (This used to be commit c15dec74a360c6b20f536708e00e61d1d27dcbfc) --- source3/lib/username.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3') diff --git a/source3/lib/username.c b/source3/lib/username.c index e65f133812..17627d4dae 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -43,6 +43,22 @@ BOOL name_is_local(const char *name) char *get_user_home_dir(const char *user) { static struct passwd *pass; + int snum; + + /* If a path is specified in [homes] then use it instead of the + user's home directory from struct passwd. */ + + if ((snum = lp_servicenumber(HOMES_NAME)) != -1) { + static pstring home_dir; + + pstrcpy(home_dir, lp_pathname(snum)); + standard_sub_snum(snum, home_dir); + + if (home_dir[0]) + return home_dir; + } + + /* Get home directory from struct passwd. */ pass = Get_Pwnam(user); -- cgit