summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-12-18 06:11:32 +0000
committerTim Potter <tpot@samba.org>2001-12-18 06:11:32 +0000
commitc15dec74a360c6b20f536708e00e61d1d27dcbfc (patch)
tree8ed786dbb51facaa59f67162b0ef92584b10fa6b
parent5095941dcb312d75c232d15232d5998ca05b632f (diff)
downloadsamba-c15dec74a360c6b20f536708e00e61d1d27dcbfc.tar.gz
samba-c15dec74a360c6b20f536708e00e61d1d27dcbfc.tar.xz
samba-c15dec74a360c6b20f536708e00e61d1d27dcbfc.zip
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 <philnanne@mediaone.net> 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?
-rw-r--r--source/lib/username.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/lib/username.c b/source/lib/username.c
index e65f1338123..17627d4dae0 100644
--- a/source/lib/username.c
+++ b/source/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);