SMB1: Corrected SMB_COM_TREE_CONNECT_ANDX request implementation and added constructor

This commit is contained in:
Tal Aloni 2017-09-05 20:17:14 +03:00
parent 573b14d9e1
commit d98ed6c2b0

View file

@ -26,6 +26,11 @@ namespace SMBLibrary.SMB1
public string Path; // SMB_STRING (If Unicode, this field MUST be aligned to start on a 2-byte boundary from the start of the SMB header) public string Path; // SMB_STRING (If Unicode, this field MUST be aligned to start on a 2-byte boundary from the start of the SMB header)
public ServiceName Service; // OEM string public ServiceName Service; // OEM string
public TreeConnectAndXRequest()
{
Password = new byte[0];
}
public TreeConnectAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) public TreeConnectAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
{ {
int parametersOffset = 4; int parametersOffset = 4;
@ -56,7 +61,7 @@ namespace SMBLibrary.SMB1
LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, passwordLength); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, passwordLength);
string serviceString = ServiceNameHelper.GetServiceString(Service); string serviceString = ServiceNameHelper.GetServiceString(Service);
int dataLength = Password.Length + serviceString.Length; int dataLength = Password.Length + serviceString.Length + 1;
if (isUnicode) if (isUnicode)
{ {
int padding = (1 + passwordLength) % 2; int padding = (1 + passwordLength) % 2;