public static void Trans2SetFsInfoRequestAdditional( int messageId, int sessionId, int treeId, int fId, bool isSigned, [Domain("InfoLevelSetByFsAdditional")] InformationLevel informationLevel, Trans2SetFsInfoResponseParameter requestPara) { Condition.IsTrue(smbConnection.openedFiles.ContainsKey(fId)); Condition.IsTrue(smbConnection.openedFiles[fId].treeId == treeId); Checker.CheckRequest(smbConnection, messageId, sessionId, treeId, isSigned, smbState); if (createFileAccess == 1) { Condition.IsTrue(requestPara == Trans2SetFsInfoResponseParameter.AccessDenied); Condition.IsTrue(informationLevel != InformationLevel.Invalid); } else { Condition.IsTrue(requestPara != Trans2SetFsInfoResponseParameter.AccessDenied); } smbRequest = new Trans2SetFSInfoRequestAdditional(messageId, sessionId, treeId, fId, isSigned, informationLevel, requestPara); Update.UpdateRequest(smbConnection, smbRequest); }
/// <summary> /// TRANS2_SET_FS_INFORMATION request additional. /// </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="fid">The file identifier.</param> /// <param name="isSigned"> /// Indicate whether the SUT has message signing enabled or required. /// </param> /// <param name="informationLevel">This can be used to query information from the server.</param> /// <param name="requestPara">Trans2SetFSInfo response parameter.</param> public void Trans2SetFsInfoRequestAdditional( int messageId, int sessionId, int treeId, int fid, bool isSigned, [Domain("InfoLevelSetByFS")] InformationLevel informationLevel, Trans2SetFsInfoResponseParameter requestPara) { #region Create Packet SmbTrans2SetFsInformationRequestPacket smbPacket = new SmbTrans2SetFsInformationRequestPacket(); ushort uid = (ushort)this.uId[(uint)sessionId]; ushort fileId = (ushort)this.fId[(uint)fid]; NamespaceCifs.Trans2SmbParametersFlags transactOptions = NamespaceCifs.Trans2SmbParametersFlags.NONE; ushort level = ushort.MaxValue; if (informationLevel != InformationLevel.Invalid) { level = this.informationLevelBytes[(ushort)informationLevel]; //This field MUST be a pass-through Information Level this.smbClientStack.Capability.IsUsePathThrough = true; } else { level = this.informationLevelBytes[(ushort)InformationLevel.FileFsControlInformaiton]; //This field MUST be a pass-through Information Level this.smbClientStack.Capability.IsUsePathThrough = false; } byte[] data = new byte[DataCount]; smbPacket = this.smbClientStack.CreateTrans2SetFileSystemInformationRequest( fileId, transactOptions, (NamespaceCifs.QueryFSInformationLevel)level, data); bool isInvalidFileId = false; if (requestPara == Trans2SetFsInfoResponseParameter.FileIdErrror) { isInvalidFileId = true; } if (isInvalidFileId) { TRANS2_SET_FILE_SYSTEM_INFORMATION_Request_Trans2_Parameters trans2Parameters = smbPacket.Trans2Parameters; trans2Parameters.FID = ushort.MaxValue; smbPacket.Trans2Parameters = trans2Parameters; } 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; } //Workaround temp code (How to trigger the error Status_Data_Error) if ((informationLevel == InformationLevel.FileFsControlInformaiton) && !bool.Parse(Site.Properties["IsTDQ49846Fixed"])) { smbErrorHeader.Status = (uint)MessageStatus.StatusDataError; } this.ErrorTrans2SetFsInfoResponseAdditional( smbErrorHeader.Mid + this.addMidMark, (MessageStatus)smbErrorHeader.Status); } else { SmbTrans2SetFsInformationResponsePacket smbTrans2SetFsInformationPacket = response as SmbTrans2SetFsInformationResponsePacket; NamespaceCifs.SmbHeader trans2SetFsInformationResponseHeader = smbTrans2SetFsInformationPacket.SmbHeader; this.Trans2SetFsInfoResponseAdditional( trans2SetFsInformationResponseHeader.Mid + this.addMidMark, this.QueryUidTable(smbPacketResponse), this.QueryTidTable(smbPacketResponse), (smbPacketResponse).IsSignRequired, (MessageStatus)trans2SetFsInformationResponseHeader.Status); } #endregion }
/// <summary> /// TRANS2_SET_FS_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 the re-authentication of an existing session.</param> /// <param name="treeId">This is used to indicate the share that the client is accessing.</param> /// <param name="fId"></param> /// <param name="isUsePassthrough">isUsePassthrough.</param> /// <param name="isSigned">It indicates whether the SUT has message signing enabled or required.</param> /// <param name="informationLevel">This can be used to query information from the SUT.</param> /// <param name="requestPara">TRANS2_SET_FS_INFORMATION request parameter.</param> public Trans2SetFSInfoRequestAdditional( int messageId, int sessionId, int treeId, int fId, bool isSigned, InformationLevel informationLevel, Trans2SetFsInfoResponseParameter requestPara) : base(messageId, Command.Trans2SetFsInforamtionAdditional) { this.sessionId = sessionId; this.treeId = treeId; this.fId = fId; this.isSigned = isSigned; this.requestPara = requestPara; this.informationLevel = informationLevel; }