3.3.5.20.1 Handling SMB2_0_INFO_FILE
The information classes that are supported for querying files are listed in section 2.2.37. Documentation for these is provided in [MS-FSCC] section 2.4.
Requests for information classes that are not listed in section 2.2.37 but which are documented in section 2.4 of [MS-FSCC] SHOULD<412> be failed with STATUS_NOT_SUPPORTED.
Requests for information classes not documented in [MS-FSCC] section 2.4 SHOULD<413> be failed with STATUS_INVALID_INFO_CLASS.
If the server does not implement the SMB 3.x dialect family and the request is for the FileIdInformation information class, the server MUST fail the request with STATUS_NOT_SUPPORTED.
For FileNormalizedNameInformation information class requests, if not supported by the server implementation<414>, or if Connection.Dialect is "2.0.2", "2.1" or "3.0.2", the server MUST fail the request with STATUS_NOT_SUPPORTED.
If the request is for the FilePositionInformation information class, the SMB2 server SHOULD<415> set the CurrentByteOffset field to zero. The CurrentByteOffset field is part of the FILE_POSITION_INFORMATION structure specified in section 2.4.39 of [MS-FSCC].
If the object store supports security and the information class is FileBasicInformation, FileAllInformation, FilePipeInformation, FilePipeLocalInformation, FilePipeRemoteInformation, FileNetworkOpenInformation, or FileAttributeTagInformation, and Open.GrantedAccess does not include FILE_READ_ATTRIBUTES, the server MUST fail the request with STATUS_ACCESS_DENIED.
If the object store supports security and the information class is FileFullEaInformation and Open.GrantedAccess does not include FILE_READ_EA, the server MUST fail the request with STATUS_ACCESS_DENIED.
The server MUST query the information requested from the underlying object store.<416>
If the information class is FileAllInformation, the server SHOULD<417> return an empty FileNameInformation by setting FileNameLength field to zero and FileName field to an empty string. If the store does not support the data requested, the server MUST fail the request with STATUS_NOT_SUPPORTED.
If the information class is FileNormalizedNameInformation, the server MUST convert the information returned from the underlying object store to a normalized path name, as defined in [MS-FSCC] section 2.1.5, in an implementation-specific manner. If the normalized path name is not relative to TreeConnect.Share.LocalPath, the server MUST fail the request with STATUS_NOT_SUPPORTED. Otherwise, the server MUST return the normalized path name.
Depending on the information class, the output data consists of a fixed portion followed by optional variable-length data. If the OutputBufferLength given in the client request is zero or is insufficient to hold the fixed-length part of the information requested, the server MUST fail the request with STATUS_INFO_LENGTH_MISMATCH and MUST return error data as specified in section 2.2.2 with ByteCount set to 8, ErrorDataLength set to 0, and ErrorId set to 0 if Connection.Dialect is "3.1.1"; otherwise, ByteCount set to zero.
If the underlying object store returns an error, the server MUST fail the request with the error code received.
If the underlying object store returns only a portion of the variable-length data, the server MUST construct a response as described below but set the Status field in the SMB2 header to STATUS_BUFFER_OVERFLOW. If FileFullEaInformation is being queried and the requested entries do not fit in the Buffer field of the response, the server MUST construct a response as described below but set the Status field in the SMB2 header to STATUS_BUFFER_OVERFLOW.
If the underlying object store returns the information successfully, the server MUST construct an SMB2 QUERY_INFO Response with the following values:
OutputBufferOffset MUST be set to the offset, in bytes, from the beginning of the SMB2 header to the attribute data at Buffer[].
OutputBufferLength MUST be set to the length of the attribute data being returned to the client.
The data MUST be placed in the response in Buffer[].
The response MUST then be sent to the client.
FullEaList: The list of extended attribute entries maintained by underlying object store.
EaIndex: Index of the EA in FullEaList to start enumerating EA entries. It starts from 1.
EaList: The list of FILE_GET_EA_INFORMATION structures as specified in [MS-FSCC] section 2.4.15.1.
If the object store supports security and the information class is set to FileFullEaInformation, the server MUST return one or more extended attribute entries associated with the current Open, as follows:
If EaList is specified by the client, the server MUST query the EA entries from FullEaList through the EA names in EaList until the buffer is full or has run to the end of EaList. The EaList is contained at the offset InputBufferOffset, starting from the SMB2 header with the length set to InputBufferLength.
If SL_INDEX_SPECIFIED is not set in the Flags field and EaList is not specified, the server MUST enumerate the EA entries from FullEaList starting at Open.CurrentEaIndex until the buffer is full or has run out of the EA entries in FullEaList. Open.CurrentEaIndex MUST be incremented by the number of EA entries returned to the client.
If SL_RESTART_SCAN is set in the Flags field, the server MUST ignore it if either SL_INDEX_SPECIFIED is set in the Flags field or EaList is specified by the client. Otherwise, the server MUST set Open.CurrentEaIndex to 1.
If SL_INDEX_SPECIFIED is set in the Flags field, it SHOULD be ignored by the server if EaList is specified by the client. Otherwise, the server MUST use EaIndex as the starting index in FullEaList to enumerate the EA entries until the buffer is full or has run out of the EA entries in FullEaList. If an out-of-range EaIndex is specified, the server MUST fail the request with STATUS_NONEXISTENT_EA_ENTRY.
If SL_RETURN_SINGLE_ENTRY is set in the Flags field, the server MUST return the single EA entry to the client.