/// <summary> /// TRANS2_QUERY_FILE_INFORMATION Request. /// </summary> /// <param name="messageId">This is used to associate a response with a request.</param> /// <param name="sessionId"> /// Set this value to 0 to request a new session setup, or set this value to a previously established session /// identifier to request reauthenticate to an existing session. /// </param> /// <param name="treeId"> /// This field identifies the subdirectory (or tree) (also referred as a share in this document) on the /// server that the client is accessing. /// </param> /// <param name="isSigned"> /// Indicate whether the SUT has message signing enabled or required. /// </param> /// <param name="isUsePassthrough"> /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request. /// </param> /// <param name="isReparse">Indicate whether it is reparsed or not.</param> /// <param name="informationLevel">This can be used to query information from the server.</param> /// <param name="gmtTokenIndex">The index of the GMT token configured by CheckPreviousVersion action.</param> public void Trans2QueryPathInfoRequest( int messageId, int sessionId, int treeId, bool isSigned, bool isUsePassthrough, bool isReparse, [Domain("InfoLevelQueriedByPath")] InformationLevel informationLevel, int gmtTokenIndex) { #region Create Packet SmbTrans2QueryPathInformationRequestPacket smbPacket = new SmbTrans2QueryPathInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort requestedTid = (ushort)this.tId[(uint)treeId]; ushort transactOptions = ushort.MinValue; string fileName = string.Empty; if (gmtTokenIndex < (int)uint.MinValue) { fileName = Site.Properties["SmbTestCaseBadGmt"] as string; } else { fileName = this.openedFileName; } ushort level = this.informationLevelBytes[(ushort)informationLevel]; this.smbClientStack.Capability.IsUsePathThrough = isUsePassthrough; smbPacket = this.smbClientStack.CreateTrans2QueryPathInformationRequest( requestedTid, fileName, (NamespaceCifs.Trans2SmbParametersFlags)transactOptions, (NamespaceCifs.QueryInformationLevel)level, this.maxDataCount, isReparse); if (isSigned) { NamespaceCifs.CifsClientPerConnection connection = this.smbClientStack.Context.GetConnection(ConnectionId); NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid); smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey); } #endregion #region Send and Receive ExpectPacket this.smbClientStack.SendPacket(smbPacket); StackPacket response = this.smbClientStack.ExpectPacket(this.timeout); NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response; this.QueryUidTable(smbPacketResponse); this.QueryTidTable(smbPacketResponse); VerifyTransport(smbPacketResponse); VerifyCommonMessageSyntax(smbPacketResponse); if (response.GetType() == typeof(SmbErrorResponsePacket)) { SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket; NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader; if (smbErrorHeader.Status == (uint)MessageStatus.StatusInvalidInfoClass) { smbErrorHeader.Status = (uint)MessageStatus.NotSupported; } this.ErrorTrans2QueryPathInfoResponse( smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status, Boolean.Parse(this.Site.Properties["SHOULDMAYR2076Implementation"])); } else { SmbTrans2QueryPathInformationResponsePacket smbTrans2QueryPathInformationPacket = response as SmbTrans2QueryPathInformationResponsePacket; NamespaceCifs.SmbHeader trans2QueryPathInformationResponseHeader = smbTrans2QueryPathInformationPacket.SmbHeader; this.Trans2QueryPathInfoResponse( trans2QueryPathInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2QueryPathInformationResponseHeader.Status); } #endregion }
/// <summary> /// TRANS2_QUERY_FILE_INFORMATION Request. /// </summary> /// <param name="messageId">This is used to associate a response with a request.</param> /// <param name="sessionId"> /// Set this value to 0 to request a new session setup, or set this value to a previously established session /// identifier to request reauthenticate to an existing session. /// </param> /// <param name="treeId"> /// This field identifies the subdirectory (or tree) (also referred as a share in this document) on the /// server that the client is accessing. /// </param> /// <param name="isSigned"> /// Indicate whether the SUT has message signing enabled or required. /// </param> /// <param name="isUsePassthrough"> /// Indicate whether adding SMB_INFO_PASSTHROUGH in InformationLevel field of the request. /// </param> /// <param name="isReparse">Indicate whether it is reparsed or not.</param> /// <param name="informationLevel">This can be used to query information from the server.</param> /// <param name="gmtTokenIndex">The index of the GMT token configured by CheckPreviousVersion action.</param> public void FSCCTrans2QueryPathInfoRequest( int messageId, int sessionId, int treeId, bool isSigned, //bool isUsePassthrough, //bool isReparse, //[Domain("InfoLevelQueriedByPath")] InformationLevel informationLevel, //int gmtTokenIndex) FSCCTransaction2QueryPathInforLevel informationLevel) { #region Create Packet SmbTrans2QueryPathInformationRequestPacket smbPacket = new SmbTrans2QueryPathInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort requestedTid = (ushort)this.tId[(uint)treeId]; ushort transactOptions = ushort.MinValue; string fileName = string.Empty; fsccQueryPathLevel = (ushort)informationLevel; fileName = Site.Properties["SutShareExistFile"] as string; ushort level = this.FSCCInformationLevelBytesQueryPath[(ushort)informationLevel]; smbPacket = this.smbClientStack.CreateTrans2QueryPathInformationRequest( requestedTid, fileName, (NamespaceCifs.Trans2SmbParametersFlags)transactOptions, (NamespaceCifs.QueryInformationLevel)level, this.maxDataCount, false); if (isSigned) { NamespaceCifs.CifsClientPerConnection connection = this.smbClientStack.Context.GetConnection(ConnectionId); NamespaceCifs.CifsClientPerSession session = this.smbClientStack.Context.GetSession(ConnectionId, uid); smbPacket.Sign(connection.ClientNextSendSequenceNumber, session.SessionKey); } #endregion #region Send and Receive ExpectPacket this.smbClientStack.SendPacket(smbPacket); StackPacket response = this.smbClientStack.ExpectPacket(this.timeout); NamespaceCifs.SmbPacket smbPacketResponse = (NamespaceCifs.SmbPacket)response; this.QueryUidTable(smbPacketResponse); this.QueryTidTable(smbPacketResponse); if (response.GetType() == typeof(SmbErrorResponsePacket)) { SmbErrorResponsePacket smbErrorResponsePacket = response as SmbErrorResponsePacket; NamespaceCifs.SmbHeader smbErrorHeader = smbErrorResponsePacket.SmbHeader; this.ErrorResponse( smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status); } else { SmbTrans2QueryPathInformationResponsePacket smbTrans2QueryPathInformationPacket = response as SmbTrans2QueryPathInformationResponsePacket; NamespaceCifs.SmbHeader trans2QueryPathInformationResponseHeader = smbTrans2QueryPathInformationPacket.SmbHeader; FSCCTrans2QueryPathInformation(smbTrans2QueryPathInformationPacket); this.FSCCTrans2QueryPathInfoResponse( trans2QueryPathInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2QueryPathInformationResponseHeader.Status); } #endregion }