From 9f79f939b6f5727d2e285e92e78bbe57fca4a627 Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Tue, 7 Feb 2017 13:54:25 +0200 Subject: [PATCH] Corrected TRANS2_FIND_FIRST2 / TRANS2_FIND_NEXT2 requests implementation when InformationLevel = SMB_INFO_QUERY_EAS_FROM_LIST --- .../Transaction2FindFirst2Request.cs | 6 ++--- .../Transaction2FindNext2Request.cs | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs index 1331874..e86ce7c 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindFirst2Request.cs @@ -24,11 +24,11 @@ namespace SMBLibrary.SMB1 public SearchStorageType SearchStorageType; public string FileName; // SMB_STRING // Data: - public FullExtendedAttributeList GetExtendedAttributeList; // Used with FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST + public ExtendedAttributeNameList GetExtendedAttributeList; // Used with FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST public Transaction2FindFirst2Request() : base() { - GetExtendedAttributeList = new FullExtendedAttributeList(); + GetExtendedAttributeList = new ExtendedAttributeNameList(); } public Transaction2FindFirst2Request(byte[] parameters, byte[] data, bool isUnicode) : base() @@ -42,7 +42,7 @@ namespace SMBLibrary.SMB1 if (InformationLevel == FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) { - GetExtendedAttributeList = new FullExtendedAttributeList(data, 0); + GetExtendedAttributeList = new ExtendedAttributeNameList(data, 0); } } diff --git a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs index 28461a3..6574b02 100644 --- a/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs +++ b/SMBLibrary/SMB1/Transaction2Subcommands/Transaction2FindNext2Request.cs @@ -1,4 +1,4 @@ -/* Copyright (C) 2014 Tal Aloni . All rights reserved. +/* Copyright (C) 2014-2017 Tal Aloni . All rights reserved. * * You can redistribute this program and/or modify it under the terms of * the GNU Lesser Public License as published by the Free Software Foundation, @@ -23,9 +23,12 @@ namespace SMBLibrary.SMB1 public uint ResumeKey; public FindFlags Flags; public string FileName; // SMB_STRING + // Data: + public ExtendedAttributeNameList GetExtendedAttributeList; // Used with FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST public Transaction2FindNext2Request() : base() { + GetExtendedAttributeList = new ExtendedAttributeNameList(); } public Transaction2FindNext2Request(byte[] parameters, byte[] data, bool isUnicode) : base() @@ -36,6 +39,11 @@ namespace SMBLibrary.SMB1 ResumeKey = LittleEndianConverter.ToUInt32(parameters, 6); Flags = (FindFlags)LittleEndianConverter.ToUInt16(parameters, 10); FileName = SMB1Helper.ReadSMBString(parameters, 12, isUnicode); + + if (InformationLevel == FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) + { + GetExtendedAttributeList = new ExtendedAttributeNameList(data, 0); + } } public override byte[] GetSetup() @@ -66,6 +74,18 @@ namespace SMBLibrary.SMB1 return parameters; } + public override byte[] GetData(bool isUnicode) + { + if (InformationLevel == FindInformationLevel.SMB_INFO_QUERY_EAS_FROM_LIST) + { + return GetExtendedAttributeList.GetBytes(); + } + else + { + return new byte[0]; + } + } + public override Transaction2SubcommandName SubcommandName { get