s3:smbd: remember the client unix capabilities on the connection
authorStefan Metzmacher <metze@samba.org>
Mon, 12 Sep 2011 03:12:50 +0000 (05:12 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 14 Sep 2011 19:37:02 +0000 (12:37 -0700)
metze

Signed-off-by: Jeremy Allison <jra@samba.org>
source3/smbd/globals.h
source3/smbd/trans2.c

index 92532c2d090199f7cf6814e131c3175c40e97a29..4d954534dc393d254a49b915fcc79615c87c49b5 100644 (file)
@@ -531,6 +531,13 @@ struct smbd_server_connection {
                        int max_recv;
                } negprot;
 
+               struct {
+                       uint16_t client_major;
+                       uint16_t client_minor;
+                       uint32_t client_cap_low;
+                       uint32_t client_cap_high;
+               } unix_info;
+
                struct {
                        bool done_sesssetup;
                        /*
index 881dced3103ce4bb23161e1ab7c359980840d2b4..8d3482873ac066cc826a8abda5790e28c9f5c0a7 100644 (file)
@@ -3539,6 +3539,7 @@ static void call_trans2setfsinfo(connection_struct *conn,
                                 char **ppdata, int total_data,
                                 unsigned int max_data_bytes)
 {
+       struct smbd_server_connection *sconn = req->sconn;
        char *pdata = *ppdata;
        char *params = *pparams;
        uint16 info_level;
@@ -3579,54 +3580,47 @@ static void call_trans2setfsinfo(connection_struct *conn,
 
        switch(info_level) {
                case SMB_SET_CIFS_UNIX_INFO:
-                       {
-                               uint16 client_unix_major;
-                               uint16 client_unix_minor;
-                               uint32 client_unix_cap_low;
-                               uint32 client_unix_cap_high;
-
-                               if (!lp_unix_extensions()) {
-                                       reply_nterror(req,
-                                                     NT_STATUS_INVALID_LEVEL);
-                                       return;
-                               }
+                       if (!lp_unix_extensions()) {
+                               reply_nterror(req,
+                                             NT_STATUS_INVALID_LEVEL);
+                               return;
+                       }
 
-                               /* There should be 12 bytes of capabilities set. */
-                               if (total_data < 8) {
-                                       reply_nterror(
-                                               req,
-                                               NT_STATUS_INVALID_PARAMETER);
-                                       return;
-                               }
-                               client_unix_major = SVAL(pdata,0);
-                               client_unix_minor = SVAL(pdata,2);
-                               client_unix_cap_low = IVAL(pdata,4);
-                               client_unix_cap_high = IVAL(pdata,8);
-                               /* Just print these values for now. */
-                               DEBUG(10,("call_trans2setfsinfo: set unix info. major = %u, minor = %u \
-cap_low = 0x%x, cap_high = 0x%x\n",
-                                       (unsigned int)client_unix_major,
-                                       (unsigned int)client_unix_minor,
-                                       (unsigned int)client_unix_cap_low,
-                                       (unsigned int)client_unix_cap_high ));
-
-                               /* Here is where we must switch to posix pathname processing... */
-                               if (client_unix_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
-                                       lp_set_posix_pathnames();
-                                       mangle_change_to_posix();
-                               }
+                       /* There should be 12 bytes of capabilities set. */
+                       if (total_data < 8) {
+                               reply_nterror(
+                                       req,
+                                       NT_STATUS_INVALID_PARAMETER);
+                               return;
+                       }
+                       sconn->smb1.unix_info.client_major = SVAL(pdata,0);
+                       sconn->smb1.unix_info.client_minor = SVAL(pdata,2);
+                       sconn->smb1.unix_info.client_cap_low = IVAL(pdata,4);
+                       sconn->smb1.unix_info.client_cap_high = IVAL(pdata,8);
+                       /* Just print these values for now. */
+                       DEBUG(10,("call_trans2setfsinfo: set unix_info info. major = %u, minor = %u \
+cap_low = 0x%x, cap_highn",
+                               (unsigned int)sconn->smb1.unix_info.client_major,
+                               (unsigned int)sconn->smb1.unix_info.client_minor,
+                               (unsigned int)sconn->smb1.unix_info.client_cap_low,
+                               (unsigned int)sconn->smb1.unix_info.client_cap_high));
+
+                       /* Here is where we must switch to posix pathname processing... */
+                       if (sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
+                               lp_set_posix_pathnames();
+                               mangle_change_to_posix();
+                       }
 
-                               if ((client_unix_cap_low & CIFS_UNIX_FCNTL_LOCKS_CAP) &&
-                                   !(client_unix_cap_low & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)) {
-                                       /* Client that knows how to do posix locks,
-                                        * but not posix open/mkdir operations. Set a
-                                        * default type for read/write checks. */
+                       if ((sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_FCNTL_LOCKS_CAP) &&
+                           !(sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)) {
+                               /* Client that knows how to do posix locks,
+                                * but not posix open/mkdir operations. Set a
+                                * default type for read/write checks. */
 
-                                       lp_set_posix_default_cifsx_readwrite_locktype(POSIX_LOCK);
+                               lp_set_posix_default_cifsx_readwrite_locktype(POSIX_LOCK);
 
-                               }
-                               break;
                        }
+                       break;
 
                case SMB_REQUEST_TRANSPORT_ENCRYPTION:
                        {