Print this page
NEX-4324 Should not include $DATA when enumerating streams (try 2)
NEX-3409 SMB2: OSX - cannot display nested folders in finder
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-2106 SMB2 query_file_info FileAlternateNameInformation fails
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 /*
  17  * Dispatch function for SMB2_QUERY_INFO
  18  *
  19  * [MS-FSCC 2.4] If a file system does not support ...
  20  * an Information Classs, NT_STATUS_INVALID_PARAMETER...
  21  */
  22 
  23 #include <smbsrv/smb2_kproto.h>
  24 #include <smbsrv/smb_fsops.h>
  25 #include <smbsrv/ntifs.h>
  26 
  27 static uint32_t smb2_qif_all(smb_request_t *, smb_queryinfo_t *);
  28 static uint32_t smb2_qif_basic(smb_request_t *, smb_queryinfo_t *);
  29 static uint32_t smb2_qif_standard(smb_request_t *, smb_queryinfo_t *);
  30 static uint32_t smb2_qif_internal(smb_request_t *, smb_queryinfo_t *);
  31 static uint32_t smb2_qif_ea_size(smb_request_t *, smb_queryinfo_t *);
  32 static uint32_t smb2_qif_access(smb_request_t *, smb_queryinfo_t *);
  33 static uint32_t smb2_qif_name(smb_request_t *, smb_queryinfo_t *);


  69         case FileInternalInformation:
  70                 mask = SMB_AT_NODEID;
  71                 break;
  72         case FileAllInformation:
  73                 mask = SMB_AT_ALL;
  74                 getstd = B_TRUE;
  75                 getname = B_TRUE;
  76                 break;
  77 
  78         case FileNameInformation:
  79                 getname = B_TRUE;
  80                 break;
  81 
  82         case FileAlternateNameInformation:
  83                 mask = SMB_AT_NODEID;
  84                 getname = B_TRUE;
  85                 break;
  86 
  87         case FileStreamInformation:
  88                 mask = SMB_AT_STANDARD;

  89                 break;
  90 
  91         case FileCompressionInformation:
  92                 mask = SMB_AT_SIZE | SMB_AT_ALLOCSZ;
  93                 break;
  94 
  95         case FileNetworkOpenInformation:
  96                 mask = SMB_AT_BASIC | SMB_AT_STANDARD;
  97 
  98         default:
  99                 break;
 100         }
 101 
 102         qi->qi_attr.sa_mask = mask;
 103         qi->qi_node = of->f_node;
 104         if (mask & SMB_AT_ALL) {
 105                 status = smb2_ofile_getattr(sr, of, &qi->qi_attr);
 106                 if (status)
 107                         return (status);
 108         }


 271             &sr->raw_data, "qqlbbw",
 272             sa->sa_allocsz,          /* q */
 273             sa->sa_vattr.va_size,    /* q */
 274             sa->sa_vattr.va_nlink,   /* l */
 275             qi->qi_delete_on_close,  /* b */
 276             qi->qi_isdir,            /* b */
 277             0); /* reserved */          /* w */
 278 
 279         return (0);
 280 }
 281 
 282 /*
 283  * FileInternalInformation
 284  * See also:
 285  *      SMB_FILE_INTERNAL_INFORMATION
 286  */
 287 static uint32_t
 288 smb2_qif_internal(smb_request_t *sr, smb_queryinfo_t *qi)
 289 {
 290         smb_attr_t *sa = &qi->qi_attr;

 291 
 292         ASSERT((sa->sa_mask & SMB_AT_NODEID) == SMB_AT_NODEID);

 293 




 294         (void) smb_mbc_encodef(
 295             &sr->raw_data, "q",
 296             sa->sa_vattr.va_nodeid); /* q */
 297 
 298         return (0);
 299 }
 300 
 301 /*
 302  * FileEaInformation
 303  * See also:
 304  *      SMB_QUERY_FILE_EA_INFO
 305  *      SMB_FILE_EA_INFORMATION
 306  */
 307 static uint32_t
 308 smb2_qif_ea_size(smb_request_t *sr, smb_queryinfo_t *qi)
 309 {
 310         _NOTE(ARGUNUSED(qi))
 311 
 312         (void) smb_mbc_encodef(
 313             &sr->raw_data, "l", 0);
 314 
 315         return (0);
 316 }


   1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  14  */
  15 
  16 /*
  17  * Dispatch function for SMB2_QUERY_INFO
  18  *
  19  * [MS-FSCC 2.4] If a file system does not support ...
  20  * an Information Classs, NT_STATUS_INVALID_PARAMETER...
  21  */
  22 
  23 #include <smbsrv/smb2_kproto.h>
  24 #include <smbsrv/smb_fsops.h>
  25 #include <smbsrv/ntifs.h>
  26 
  27 static uint32_t smb2_qif_all(smb_request_t *, smb_queryinfo_t *);
  28 static uint32_t smb2_qif_basic(smb_request_t *, smb_queryinfo_t *);
  29 static uint32_t smb2_qif_standard(smb_request_t *, smb_queryinfo_t *);
  30 static uint32_t smb2_qif_internal(smb_request_t *, smb_queryinfo_t *);
  31 static uint32_t smb2_qif_ea_size(smb_request_t *, smb_queryinfo_t *);
  32 static uint32_t smb2_qif_access(smb_request_t *, smb_queryinfo_t *);
  33 static uint32_t smb2_qif_name(smb_request_t *, smb_queryinfo_t *);


  69         case FileInternalInformation:
  70                 mask = SMB_AT_NODEID;
  71                 break;
  72         case FileAllInformation:
  73                 mask = SMB_AT_ALL;
  74                 getstd = B_TRUE;
  75                 getname = B_TRUE;
  76                 break;
  77 
  78         case FileNameInformation:
  79                 getname = B_TRUE;
  80                 break;
  81 
  82         case FileAlternateNameInformation:
  83                 mask = SMB_AT_NODEID;
  84                 getname = B_TRUE;
  85                 break;
  86 
  87         case FileStreamInformation:
  88                 mask = SMB_AT_STANDARD;
  89                 getstd = B_TRUE;
  90                 break;
  91 
  92         case FileCompressionInformation:
  93                 mask = SMB_AT_SIZE | SMB_AT_ALLOCSZ;
  94                 break;
  95 
  96         case FileNetworkOpenInformation:
  97                 mask = SMB_AT_BASIC | SMB_AT_STANDARD;
  98 
  99         default:
 100                 break;
 101         }
 102 
 103         qi->qi_attr.sa_mask = mask;
 104         qi->qi_node = of->f_node;
 105         if (mask & SMB_AT_ALL) {
 106                 status = smb2_ofile_getattr(sr, of, &qi->qi_attr);
 107                 if (status)
 108                         return (status);
 109         }


 272             &sr->raw_data, "qqlbbw",
 273             sa->sa_allocsz,          /* q */
 274             sa->sa_vattr.va_size,    /* q */
 275             sa->sa_vattr.va_nlink,   /* l */
 276             qi->qi_delete_on_close,  /* b */
 277             qi->qi_isdir,            /* b */
 278             0); /* reserved */          /* w */
 279 
 280         return (0);
 281 }
 282 
 283 /*
 284  * FileInternalInformation
 285  * See also:
 286  *      SMB_FILE_INTERNAL_INFORMATION
 287  */
 288 static uint32_t
 289 smb2_qif_internal(smb_request_t *sr, smb_queryinfo_t *qi)
 290 {
 291         smb_attr_t *sa = &qi->qi_attr;
 292         u_longlong_t nodeid;
 293 
 294         ASSERT((sa->sa_mask & SMB_AT_NODEID) == SMB_AT_NODEID);
 295         nodeid = sa->sa_vattr.va_nodeid;
 296 
 297         if (smb2_aapl_use_file_ids == 0 &&
 298             (sr->session->s_flags & SMB_SSN_AAPL_CCEXT) != 0)
 299                 nodeid = 0;
 300 
 301         (void) smb_mbc_encodef(
 302             &sr->raw_data, "q",
 303             nodeid);    /* q */
 304 
 305         return (0);
 306 }
 307 
 308 /*
 309  * FileEaInformation
 310  * See also:
 311  *      SMB_QUERY_FILE_EA_INFO
 312  *      SMB_FILE_EA_INFORMATION
 313  */
 314 static uint32_t
 315 smb2_qif_ea_size(smb_request_t *sr, smb_queryinfo_t *qi)
 316 {
 317         _NOTE(ARGUNUSED(qi))
 318 
 319         (void) smb_mbc_encodef(
 320             &sr->raw_data, "l", 0);
 321 
 322         return (0);
 323 }