/// <summary> /// generate the target info of challenge packet /// </summary> /// <returns>the target info in the challenge packet</returns> private ICollection <AV_PAIR> GenerateTargetInfo() { ICollection <AV_PAIR> targetInfo = new Collection <AV_PAIR>(); // nb machine name if (this.nlmpServer.Context.NbMachineName != null) { byte[] nbMachineName = NlmpUtility.Unicode(this.nlmpServer.Context.NbMachineName); NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvNbComputerName, (ushort)nbMachineName.Length, nbMachineName); } // nb domain name if (this.nlmpServer.Context.NbDomainName != null) { byte[] nbDomainName = NlmpUtility.Unicode(this.nlmpServer.Context.NbDomainName); NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvNbDomainName, (ushort)nbDomainName.Length, nbDomainName); } // dns machine name if (this.nlmpServer.Context.DnsMachineName != null) { byte[] dnsMachineName = NlmpUtility.Unicode(this.nlmpServer.Context.DnsMachineName); NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvDnsComputerName, (ushort)dnsMachineName.Length, dnsMachineName); } // dns domain name if (this.nlmpServer.Context.DnsDomainName != null) { byte[] dnsDomainName = NlmpUtility.Unicode(this.nlmpServer.Context.DnsDomainName); NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvDnsDomainName, (ushort)dnsDomainName.Length, dnsDomainName); } // dns forest name if (this.nlmpServer.Context.DnsForestName != null) { byte[] dnsForestName = NlmpUtility.Unicode(this.nlmpServer.Context.DnsForestName); NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvDnsTreeName, (ushort)dnsForestName.Length, dnsForestName); } // eol NlmpUtility.AddAVPair(targetInfo, AV_PAIR_IDs.MsvAvEOL, 0, null); return(targetInfo); }
// If ClientSuppliedTargetName (section 3.1.1.2) is not NULL private void InitializeMsvAvTargetName( ICollection <AV_PAIR> targetInfo ) { // update the MsvAvTargetName of targetInfo // Add an AV_PAIR structure (section 2.2.2.1) and set the AvId field to MsvAvTargetName and the Value field to ClientSuppliedTargetName without terminating NULL. byte[] targetName = NlmpUtility.Unicode(this.credential.TargetName); if (NlmpUtility.AvPairContains(targetInfo, AV_PAIR_IDs.MsvAvTargetName)) { NlmpUtility.UpdateAvPair( targetInfo, AV_PAIR_IDs.MsvAvTargetName, (ushort)targetName.Length, targetName); } else { NlmpUtility.AddAVPair( targetInfo, AV_PAIR_IDs.MsvAvTargetName, (ushort)targetName.Length, targetName); } }