r22122: Start to fix csc issue with Vista. Make smbd support
authorJeremy Allison <jra@samba.org>
Sat, 7 Apr 2007 05:49:24 +0000 (05:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:14 +0000 (12:19 -0500)
the extended 7 word response for tconX rather than the
3 word one we supported previously.
Jeremy.

source/include/smb.h
source/libsmb/cliconnect.c
source/smbd/reply.c

index 27c1af1f82b7aca43567351b910008054f51e562..e9352a2fb15f0c8981ae33faffb2388abea0645c 100644 (file)
@@ -1199,6 +1199,10 @@ struct bitmap {
 #define SMB_SUPPORT_SEARCH_BITS        0x0001
 #define SMB_SHARE_IN_DFS               0x0002
 
+/* Share specific rights. */
+#define SHARE_ALL_ACCESS      0x001F01FF
+#define SHARE_READ_ONLY       0x001200A9
+
 /* Named pipe write mode flags. Used in writeX calls. */
 #define PIPE_RAW_MODE 0x4
 #define PIPE_START_MESSAGE 0x8
@@ -1480,6 +1484,9 @@ char *strdup(char *s);
 
 #define FLAGS2_WIN2K_SIGNATURE         0xC852 /* Hack alert ! For now... JRA. */
 
+/* TCONX Flag (smb_vwv2). */
+#define TCONX_FLAG_EXTENDED_RESPONSE   0x8
+
 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
 
 #define CAP_RAW_MODE         0x0001
index 3b9c477b26a04f4a30725b128c0f7dcbcfbcdff7..dff098cd01172e1f20dea7ae7e3fa054cc3ac21e 100644 (file)
@@ -1064,6 +1064,7 @@ BOOL cli_send_tconX(struct cli_state *cli,
        cli_setup_packet(cli);
 
        SSVAL(cli->outbuf,smb_vwv0,0xFF);
+       SSVAL(cli->outbuf,smb_vwv2,TCONX_FLAG_EXTENDED_RESPONSE);
        SSVAL(cli->outbuf,smb_vwv3,passlen);
 
        p = smb_buf(cli->outbuf);
index 5be086f7491cb7dace571f59fa91b26ae3367afd..d7b3a0fab1e8ecdf4e6bb7cbe497706505e28ac1 100644 (file)
@@ -452,6 +452,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
        int passlen = SVAL(inbuf,smb_vwv3);
        pstring path;
        char *p, *q;
+       uint16 tcon_flags = SVAL(inbuf,smb_vwv2);
        
        START_PROFILE(SMBtconX);        
 
@@ -522,7 +523,27 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
                /* NT sets the fstype of IPC$ to the null string */
                const char *fstype = IS_IPC(conn) ? "" : lp_fstype(SNUM(conn));
                
-               set_message(outbuf,3,0,True);
+               if (tcon_flags & TCONX_FLAG_EXTENDED_RESPONSE) {
+                       /* Return permissions. */
+                       uint32 perm1 = 0;
+                       uint32 perm2 = 0;
+
+                       set_message(outbuf,7,0,True);
+
+                       if (IS_IPC(conn)) {
+                               perm1 = FILE_ALL_ACCESS;
+                               perm2 = FILE_ALL_ACCESS;
+                       } else {
+                               perm1 = CAN_WRITE(conn) ?
+                                               SHARE_ALL_ACCESS :
+                                               SHARE_READ_ONLY;
+                       }
+
+                       SIVAL(outbuf, smb_vwv3, perm1);
+                       SIVAL(outbuf, smb_vwv5, perm2);
+               } else {
+                       set_message(outbuf,3,0,True);
+               }
 
                p = smb_buf(outbuf);
                p += srvstr_push(outbuf, p, server_devicetype, -1,