This should fix a nastly little bug where if a user had already done one
authorAndrew Bartlett <abartlet@samba.org>
Sat, 27 Jul 2002 02:54:39 +0000 (02:54 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 27 Jul 2002 02:54:39 +0000 (02:54 +0000)
session setup, it would not correctly pick up the [homes] share on a subsequent
session setup.

The new rules are:  If you want to connect to [homes], then it must have been
available at session setup time, or you must be in security=share.  At each
session setup, the user's copy of [homes] is updated to ensure it has the right
path etc.

Andrew Bartlett
(This used to be commit 5d2c7816a3ea02a67c5b501626d91d43557e9dd9)

source3/smbd/password.c
source3/smbd/service.c

index 9c67edd25519e01be95df013af5ed26a8f72e8ee..391de02dea80ff81abc1ececd107795c2c67fa20 100644 (file)
@@ -274,7 +274,7 @@ int register_vuid(auth_serversupplied_info *server_info, char *smb_name)
        /* Create an NT_USER_TOKEN struct for this user. */
        vuser->nt_user_token = create_nt_token(vuser->uid, vuser->gid, vuser->n_groups, vuser->groups, vuser->guest, server_info->ptok);
 
-       DEBUG(3,("uid %d registered to name %s\n",(int)vuser->uid,vuser->user.unix_name));
+       DEBUG(3,("UNIX uid %d is UNIX user %s, and will be vuid %u\n",(int)vuser->uid,vuser->user.unix_name, vuser->vuid));
 
        next_vuid++;
        num_validated_vuids++;
@@ -288,8 +288,9 @@ int register_vuid(auth_serversupplied_info *server_info, char *smb_name)
        }
 
        /* Register a home dir service for this user */
-       if ((!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)
-               && (lp_servicenumber(vuser->user.unix_name) < 0)) {
+       if ((!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)) {
+               DEBUG(3, ("Adding/updating homes service for user '%s' using home direcotry: '%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 {
                vuser->homes_snum = -1;
index 7dd61f23257eb2c57681a16c2356ec1f2a3e471e..aac90f2fdcfe52c2884068e2aaf4c2015043d8b3 100644 (file)
@@ -523,7 +523,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
                pstrcpy(s,lp_pathname(snum));
                standard_sub_conn(conn,s,sizeof(s));
                string_set(&conn->connectpath,s);
-               DEBUG(3,("Connect path is %s\n",s));
+               DEBUG(3,("Connect path is '%s' for service [%s]\n",s, lp_servicename(snum)));
        }
 
        /* groups stuff added by ih */
@@ -761,6 +761,7 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
                vuser = get_valid_user_struct(vuid);
                if (!vuser) {
                        DEBUG(1,("make_connection: refusing to connect with no session setup\n"));
+                       *status = NT_STATUS_ACCESS_DENIED;
                        return NULL;
                }
        }
@@ -775,12 +776,15 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
        if (strequal(service_in,HOMES_NAME)) {
                if(lp_security() != SEC_SHARE) {
                        DATA_BLOB no_pw = data_blob(NULL, 0);
-                       if (vuser->homes_snum != -1) {
-                               DEBUG(5, ("making a connection to [homes] service created at session setup time\n"));
-                                       return make_connection_snum(vuser->homes_snum,
-                                                                   vuser, no_pw, 
-                                                           dev, status);
+                       if (vuser->homes_snum == -1) {
+                               DEBUG(2, ("[homes] share not available for this user becouse it was not found or created at session setup time\n"));
+                               *status = NT_STATUS_BAD_NETWORK_NAME;
+                               return NULL;
                        }
+                       DEBUG(5, ("making a connection to [homes] service created at session setup time\n"));
+                       return make_connection_snum(vuser->homes_snum,
+                                                   vuser, no_pw, 
+                                                   dev, status);
                } else {
                        /* Security = share. Try with current_user_info.smb_name
                         * as the username.  */