static Type1Message() { DefaultFlags = NtlmsspNegotiateNtlm | (Config.GetBoolean("jcifs.smb.client.useUnicode" , true) ? NtlmsspNegotiateUnicode : NtlmsspNegotiateOem); DefaultDomain = Config.GetProperty("jcifs.smb.client.domain", null); string defaultWorkstation = null; try { defaultWorkstation = NbtAddress.GetLocalHost().GetHostName(); } catch (UnknownHostException) { } DefaultWorkstation = defaultWorkstation; }
static Type3Message() { DefaultFlags = NtlmsspNegotiateNtlm | (Config.GetBoolean("jcifs.smb.client.useUnicode" , true) ? NtlmsspNegotiateUnicode : NtlmsspNegotiateOem); DefaultDomain = Config.GetProperty("jcifs.smb.client.domain", null); DefaultUser = Config.GetProperty("jcifs.smb.client.username", null); DefaultPassword = Config.GetProperty("jcifs.smb.client.password", null); string defaultWorkstation = null; try { defaultWorkstation = NbtAddress.GetLocalHost().GetHostName(); } catch (UnknownHostException) { } DefaultWorkstation = defaultWorkstation; LmCompatibility = Config.GetInt("jcifs.smb.lmCompatibility", 3); }
static Type2Message() { DefaultFlags = NtlmsspNegotiateNtlm | (Config.GetBoolean("jcifs.smb.client.useUnicode" , true) ? NtlmsspNegotiateUnicode : NtlmsspNegotiateOem); DefaultDomain = Config.GetProperty("jcifs.smb.client.domain", null); byte[] domain = new byte[0]; if (DefaultDomain != null) { try { domain = Runtime.GetBytesForString(DefaultDomain, UniEncoding); } catch (IOException) { } } int domainLength = domain.Length; byte[] server = new byte[0]; try { string host = NbtAddress.GetLocalHost().GetHostName(); if (host != null) { try { server = Runtime.GetBytesForString(host, UniEncoding); } catch (IOException) { } } } catch (UnknownHostException) { } int serverLength = server.Length; byte[] targetInfo = new byte[(domainLength > 0 ? domainLength + 4 : 0) + (serverLength > 0 ? serverLength + 4 : 0) + 4]; int offset = 0; if (domainLength > 0) { WriteUShort(targetInfo, offset, 2); offset += 2; WriteUShort(targetInfo, offset, domainLength); offset += 2; Array.Copy(domain, 0, targetInfo, offset, domainLength); offset += domainLength; } if (serverLength > 0) { WriteUShort(targetInfo, offset, 1); offset += 2; WriteUShort(targetInfo, offset, serverLength); offset += 2; Array.Copy(server, 0, targetInfo, offset, serverLength); } DefaultTargetInformation = targetInfo; }