r2077: fix logic bug in the check for creating a user's home directory in register_vu...
authorGerald Carter <jerry@samba.org>
Thu, 26 Aug 2004 20:47:58 +0000 (20:47 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:30 +0000 (10:52 -0500)
(This used to be commit 02571e7f5040a577840c969ff9c46a1e533edc21)

source3/param/loadparm.c
source3/smbd/password.c

index 2750cc7edabdea48d3078fce668151e79a4996fb..bc2b0ced08dc37b791055cf7bde0e8a93e1e62a4 100644 (file)
@@ -2305,6 +2305,10 @@ static int add_a_service(const service *pservice, const char *name)
        copy_service(ServicePtrs[i], &tservice, NULL);
        if (name)
                string_set(&ServicePtrs[i]->szService, name);
+               
+       DEBUG(8,("add_a_service: Creating snum = %d for %s\n", 
+               i, ServicePtrs[i]->szService));
+               
        return (i);
 }
 
@@ -2344,7 +2348,7 @@ BOOL lp_add_home(const char *pszHomename, int iDefaultService,
        ServicePtrs[i]->autoloaded = True;
 
        DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename, 
-              user, newHomedir));
+              user, ServicePtrs[i]->szPath ));
        
        return (True);
 }
index 3be1516cf045807a8a91e304f292b00e6a35dfc5..decac845acdae74f26eb015664ac5f430b493473 100644 (file)
@@ -252,27 +252,30 @@ 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 
-          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. */
+          (c) there s not an existing static share by that name
+          
+          If a share exists by this name (autoloaded or not) reuse it . */
+
+       vuser->homes_snum = -1;
 
-       if ( (!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)) {
+       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);
-               } 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));
-
+               } else {
+                       DEBUG(3, ("Using static (or previously created) service for user '%s'; path = '%s'\n", 
+                               vuser->user.unix_name, lp_path(servicenumber) ));
                        vuser->homes_snum = servicenumber;
                }
-       } else {
-               vuser->homes_snum = -1;
-       }
+       } 
        
        if (srv_is_signing_negotiated() && !vuser->guest && !srv_signing_started()) {
                /* Try and turn on server signing on the first non-guest sessionsetup. */