Add SMB2 QUERY_DIRECTORY Response
authorDavid Mulder <dmulder@samba.org>
Thu, 22 Sep 2022 14:29:03 +0000 (08:29 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 22 Sep 2022 14:30:20 +0000 (08:30 -0600)
Signed-off-by: David Mulder <dmulder@samba.org>
smb3_posix_extensions.md

index 2ac01e9fe3cad4a5b7ac73190cce71ad7a0b3053..7a1ea3f74ba6b3ed9d4fd9d4e9ef17a1e5af1b88 100644 (file)
@@ -699,4 +699,356 @@ pattern for the request, as described by the **FileNameOffset** and
 for this pattern, is specified in [MS-CIFS] section
 [2.2.1.1.3](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/dc92d939-ec45-40c8-96e5-4c4091e4ab43).
 
+### 2.2.34 SMB2 QUERY_DIRECTORY Response
+
+Refer to section
+[2.2.34](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/4f75351b-048c-4a0c-9ea3-addd55a71956)
+of \[MS-SMB2\] for additional details. This section
+only explains details relevant to a SMB2_FIND_POSIX_INFORMATION request.
+
+<table>
+ <tr>
+  <th><p><br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>1<br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>2<br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>3<br>0</p></th>
+  <th><p><br>1</p></th>
+ </tr>
+ <tr>
+  <td colspan="16">
+  <p>StructureSize</p>
+  </td>
+  <td colspan="16">
+  <p>OutputBufferOffset</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>OutputBufferLength</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>Buffer
+  (variable)</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+</table>
+
+**StructureSize (2 bytes):** The server MUST set this field to 9, indicating the
+size of the request structure, not including the header. The server MUST set
+this field to this value regardless of how long Buffer[] actually is in the
+request.
+
+**OutputBufferOffset (2 bytes):** The offset, in bytes, from the beginning of
+the SMB2 header to the directory enumeration data being returned.
+
+**OutputBufferLength (4 bytes):** The length, in bytes, of the directory
+enumeration being returned.
+
+**Buffer (variable):** A variable-length buffer containing the directory
+enumeration being returned in the response, as described by the
+**OutputBufferOffset** and **OutputBufferLength**. The format of this content
+is as specified in [MS-FSCC] section
+[2.4](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/4718fc40-e539-4014-8e33-b675af74e3e1)
+, within the topic for the specific file
+information class referenced in the SMB2 QUERY_DIRECTORY Request. Additionally,
+the format for FilePosixInformation in section
+[2.2.34.1](#2.2.34.1-FilePosixInformation) of this document.
+
+#### 2.2.34.1 FilePosixInformation
+
+This information class is used to query or set file posix information.
+
+A FILE_POSIX_INFORMATION data element, defined as follows, is returned by the
+server or provided by the client.
+
+<table>
+ <tr>
+  <th><p><br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>1<br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>2<br>0</p></th>
+  <th><p><br>1</p></th>
+  <th><p><br>2</p></th>
+  <th><p><br>3</p></th>
+  <th><p><br>4</p></th>
+  <th><p><br>5</p></th>
+  <th><p><br>6</p></th>
+  <th><p><br>7</p></th>
+  <th><p><br>8</p></th>
+  <th><p><br>9</p></th>
+  <th><p>3<br>0</p></th>
+  <th><p><br>1</p></th>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>CreationTime</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>LastAccessTime</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>LastWriteTime</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>ChangeTime</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>AllocationSize</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>EndOfFile</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>FileAttributes</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>Inode</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>FileId</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>Reserved</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>NumberOfLinks</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>ReparseTag</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>POSIXPerms</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>OwnerSID
+  (variable)</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>GroupSID
+  (variable)</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>FilenameLength</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>Filename
+  (variable)</p>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="32">
+  <p>...</p>
+  </td>
+ </tr>
+</table>
+
+**CreationTime (8 bytes):** The time when the file was created; see section
+[2.1.1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/a69cc039-d288-4673-9598-772b6083f8bf)
+of \[MS-FSCC\]. A valid time for this field is an integer greater than or equal
+to 0. When setting file attributes, a value of 0 indicates to the server that it
+MUST NOT change this attribute. When setting file attributes, a value of -1
+indicates to the server that it MUST NOT change this attribute for all
+subsequent operations on the same file handle. When setting file attributes, a
+value of -2 indicates to the server that it MUST change this attribute for all
+subsequent operations on the same file handle. This field MUST NOT be set to a
+value less than -2.
+
+**LastAccessTime (8 bytes):** The last time the file was accessed; see section
+[2.1.1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/a69cc039-d288-4673-9598-772b6083f8bf)
+of \[MS-FSCC\]. A valid time for this field is an integer greater than or equal
+to 0. When setting file attributes, a value of 0 indicates to the server that it
+MUST NOT change this attribute. When setting file attributes, a value of -1
+indicates to the server that it MUST NOT change this attribute for all
+subsequent operations on the same file handle. When setting file attributes, a
+value of -2 indicates to the server that it MUST change this attribute for all
+subsequent operations on the same file handle. This field MUST NOT be set to a
+value less than -2.
+
+**LastWriteTime (8 bytes):** The last time information was written to the file;
+see section
+[2.1.1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/a69cc039-d288-4673-9598-772b6083f8bf)
+of \[MS-FSCC\]. A valid time for this field is an integer greater than or equal
+to 0. When setting file attributes, a value of 0 indicates to the server that
+it MUST NOT change this attribute. When setting file attributes, a value of -1
+indicates to the server that it MUST NOT change this attribute for all
+subsequent operations on the same file handle. When setting file attributes, a
+value of -2 indicates to the server that it MUST change this attribute for all
+subsequent operations on the same file handle. This field MUST NOT be set to a
+value less than -2.
+
+**ChangeTime (8 bytes):** The last time the file was changed; see section
+[2.1.1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/a69cc039-d288-4673-9598-772b6083f8bf)
+of \[MS-FSCC\]. A valid time for this field is an integer greater than or equal
+to 0. When setting file attributes, a value of 0 indicates to the server that it
+MUST NOT change this attribute. When setting file attributes, a value of -1
+indicates to the server that it MUST NOT change this attribute for all
+subsequent operations on the same file handle. When setting file attributes, a
+value of -2 indicates to the server that it MUST change this attribute for all
+subsequent operations on the same file handle. This field MUST NOT be set to a
+value less than -2.
+
+**AllocationSize (8 bytes):** The size allocated on disk for the file.
+
+**EndOfFile (8 bytes):** The size of the file.
+
+**FileAttributes (4 bytes):** A 32-bit unsigned integer that contains the file
+attributes. Valid file attributes are specified in section
+[2.6](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca28ec38-f155-4768-81d6-4bfeb8586fc9)
+of \[MS-FSCC\].
+
+**Inode (8 bytes):** The POSIX inode for the file.
+
+**FileId (4 bytes):** The POSIX fileId for the file.
+
+**Reserved (4 bytes):** A 32-bit field. This field is reserved. This field can be set to any value, and MUST be ignored.
+
+**NumberOfLinks (4 bytes):** The number of hard links to the file.
+
+**ReparseTag (4 bytes):** The reparse tag, as defined in section
+[2.1.2.1](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c8e77b37-3909-4fe6-a4ea-2b9d423b1ee4)
+of [MS-FSCC].
+
+**POSIXPerms (4 bytes):** The posix permissions for the opened file as defined
+in section [4.5](https://pubs.opengroup.org/onlinepubs/9699919799/)
+of IEEE Std 1003.1-2017.
+
+**OwnerSID (variable):** The owner SID as defined in
+[Microsoft Security identifiers](https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-identifiers).
+
+**GroupSID (variable):** The group SID as defined in
+[Microsoft Security identifiers](https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-identifiers).
+
+**FilenameLength (4 bytes):** The length, in bytes, of the filename.
+
+**Filename (variable):** A variable-length buffer containing the filename, the
+length specified by **FilenameLength**.
+
 # 3 Protocol Details
\ No newline at end of file