SMB1: Minor implementation improvements

This commit is contained in:
Tal Aloni 2017-09-01 23:00:44 +03:00
parent f782235085
commit 7610056a0b
4 changed files with 21 additions and 7 deletions

View file

@ -37,6 +37,10 @@ namespace SMBLibrary.SMB1
public SessionSetupAndXRequest(): base() public SessionSetupAndXRequest(): base()
{ {
AccountName = String.Empty;
PrimaryDomain = String.Empty;
NativeOS = String.Empty;
NativeLanMan = String.Empty;
} }
public SessionSetupAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) public SessionSetupAndXRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
@ -69,6 +73,8 @@ namespace SMBLibrary.SMB1
public override byte[] GetBytes(bool isUnicode) public override byte[] GetBytes(bool isUnicode)
{ {
Capabilities &= ~ServerCapabilities.ExtendedSecurity;
OEMPasswordLength = (ushort)OEMPassword.Length; OEMPasswordLength = (ushort)OEMPassword.Length;
UnicodePasswordLength = (ushort)UnicodePassword.Length; UnicodePasswordLength = (ushort)UnicodePassword.Length;

View file

@ -27,11 +27,13 @@ namespace SMBLibrary.SMB1
public ServerCapabilities Capabilities; public ServerCapabilities Capabilities;
// Data: // Data:
public byte[] SecurityBlob; public byte[] SecurityBlob;
public string NativeOS = String.Empty; // 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 NativeOS; // 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 NativeLanMan = String.Empty; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header) public string NativeLanMan; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header)
public SessionSetupAndXRequestExtended(): base() public SessionSetupAndXRequestExtended(): base()
{ {
NativeOS = String.Empty;
NativeLanMan = String.Empty;
} }
public SessionSetupAndXRequestExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) public SessionSetupAndXRequestExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
@ -60,6 +62,7 @@ namespace SMBLibrary.SMB1
public override byte[] GetBytes(bool isUnicode) public override byte[] GetBytes(bool isUnicode)
{ {
Capabilities |= ServerCapabilities.ExtendedSecurity;
SecurityBlobLength = (ushort)SecurityBlob.Length; SecurityBlobLength = (ushort)SecurityBlob.Length;
this.SMBParameters = new byte[ParametersLength]; this.SMBParameters = new byte[ParametersLength];

View file

@ -23,12 +23,15 @@ namespace SMBLibrary.SMB1
//ushort AndXOffset; //ushort AndXOffset;
public SessionSetupAction Action; public SessionSetupAction Action;
// Data: // Data:
public string NativeOS = String.Empty; // 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 NativeOS; // 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 NativeLanMan = String.Empty; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header) public string NativeLanMan; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header)
public string PrimaryDomain = String.Empty; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header) public string PrimaryDomain; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header)
public SessionSetupAndXResponse() : base() public SessionSetupAndXResponse() : base()
{ {
NativeOS = String.Empty;
NativeLanMan = String.Empty;
PrimaryDomain = String.Empty;
} }
public SessionSetupAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) public SessionSetupAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)

View file

@ -25,12 +25,14 @@ namespace SMBLibrary.SMB1
private ushort SecurityBlobLength; private ushort SecurityBlobLength;
// Data: // Data:
public byte[] SecurityBlob; public byte[] SecurityBlob;
public string NativeOS = String.Empty; // 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 NativeOS; // 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 NativeLanMan = String.Empty; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header) public string NativeLanMan; // SMB_STRING (this field WILL be aligned to start on a 2-byte boundary from the start of the SMB header)
public SessionSetupAndXResponseExtended() : base() public SessionSetupAndXResponseExtended() : base()
{ {
SecurityBlob = new byte[0]; SecurityBlob = new byte[0];
NativeOS = String.Empty;
NativeLanMan = String.Empty;
} }
public SessionSetupAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode) public SessionSetupAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)