summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-07-15 00:58:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:13 -0500
commitf7463e1bcd956305efe187b958bbd479cca4a820 (patch)
treec63a71b5e19e160b68178e5ea5d6a60a4ae75a86
parent645d67c3770026495baf55713b778926cca420d9 (diff)
downloadsamba-f7463e1bcd956305efe187b958bbd479cca4a820.tar.gz
samba-f7463e1bcd956305efe187b958bbd479cca4a820.tar.bz2
samba-f7463e1bcd956305efe187b958bbd479cca4a820.zip
r1506: Fix inspired by patches from Michael Collin Nielsen <michael@hum.aau.dk> - ensure
home directory service number is correctly reused. Jeremy. (This used to be commit 9d6347be8580d092cda0357b5d1a81fc6876ac1f)
-rw-r--r--source3/smbd/password.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index b2dbde151d..3be1516cf0 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -253,19 +253,23 @@ int register_vuid(auth_serversupplied_info *server_info, DATA_BLOB session_key,
/* Register a home dir service for this user iff
(a) This is not a guest connection,
- (b) we have a home directory defined, and
- (c) there s not an existing static share by that name */
-
- if ( (!vuser->guest)
- && vuser->unix_homedir
- && *(vuser->unix_homedir)
- && (lp_servicenumber(vuser->user.unix_name) == -1) )
- {
- DEBUG(3, ("Adding/updating homes service for user '%s' using home directory: '%s'\n",
+ (b) we have a home directory defined
+ If a share exists by this name (autoloaded or not) reuse it so
+ long as the home directory is the same as the share directory. */
+
+ if ( (!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)) {
+ int servicenumber = lp_servicenumber(vuser->user.unix_name);
+ if ( servicenumber == -1 ) {
+ DEBUG(3, ("Adding homes service for user '%s' using home directory: '%s'\n",
vuser->user.unix_name, vuser->unix_homedir));
-
vuser->homes_snum = add_home_service(vuser->user.unix_name,
- vuser->user.unix_name, vuser->unix_homedir);
+ vuser->user.unix_name, vuser->unix_homedir);
+ } else if (strcmp(lp_pathname(servicenumber),vuser->unix_homedir) == 0) {
+ DEBUG(3, ("Reusing homes service for user '%s' using home directory: '%s'\n",
+ vuser->user.unix_name, vuser->unix_homedir));
+
+ vuser->homes_snum = servicenumber;
+ }
} else {
vuser->homes_snum = -1;
}