Fix connecting to [homes] share over SMB2.
authorJeremy Allison <jra@samba.org>
Thu, 20 May 2010 04:27:43 +0000 (21:27 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 20 May 2010 04:27:43 +0000 (21:27 -0700)
Jeremy.

source3/smbd/smb2_tcon.c

index 084ded95a4b40a87729efe92d465721b3c99e1ee..f3e3037bdb6baf7df60daf4b1abcc302ba0e226b 100644 (file)
@@ -152,6 +152,7 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
        int snum = -1;
        struct smbd_smb2_tcon *tcon;
        connection_struct *compat_conn = NULL;
+       user_struct *compat_vuser = req->session->compat_vuser;
        int id;
        NTSTATUS status;
 
@@ -169,15 +170,31 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
 
        strlower_m(service);
 
-       snum = find_service(service);
+       /* TODO: do more things... */
+       if (strequal(service,HOMES_NAME)) {
+               if (compat_vuser->homes_snum == -1) {
+                       DEBUG(2, ("[homes] share not available for "
+                               "user %s because it was not found "
+                               "or created at session setup "
+                               "time\n",
+                               compat_vuser->server_info->unix_name));
+                       return NT_STATUS_BAD_NETWORK_NAME;
+               }
+               snum = compat_vuser->homes_snum;
+       } else if ((compat_vuser->homes_snum != -1)
+                   && strequal(service,
+                       lp_servicename(compat_vuser->homes_snum))) {
+               snum = compat_vuser->homes_snum;
+       } else {
+               snum = find_service(service);
+       }
+
        if (snum < 0) {
                DEBUG(3,("smbd_smb2_tree_connect: couldn't find service %s\n",
                         service));
                return NT_STATUS_BAD_NETWORK_NAME;
        }
 
-       /* TODO: do more things... */
-
        /* create a new tcon as child of the session */
        tcon = talloc_zero(req->session, struct smbd_smb2_tcon);
        if (tcon == NULL) {