internal static ADObjectId GetRelativeDnForEntryType(Utils.EntryType entryType, IConfigurationSession session) { string unescapedCommonName = (entryType == Utils.EntryType.SmtpAddress) ? Utils.EmailEntriesRDn : Utils.DomainEntriesRDn; ADObjectId childId = Utils.RootId.GetChildId(Utils.AddressRewriteConfigRDn); return(childId.GetChildId(unescapedCommonName)); }
internal static ADObjectId ValidateEntryAddresses(string internalAddress, string externalAddress, bool outboundOnly, MultiValuedProperty <string> exceptionList, IConfigurationSession session, Guid?skipGuid) { if (!outboundOnly && exceptionList != null && exceptionList.Count != 0) { throw new ArgumentException(Strings.AddressRewriteExceptionListDisallowed, null); } Utils.EntryType entryType = Utils.ValidateSyntax(internalAddress, externalAddress, outboundOnly); outboundOnly = (outboundOnly || entryType == Utils.EntryType.WildCardedDomain); ADObjectId relativeDnForEntryType = Utils.GetRelativeDnForEntryType(entryType, session); Utils.CheckConflicts(relativeDnForEntryType, outboundOnly, internalAddress, externalAddress, session, skipGuid); return(relativeDnForEntryType); }
internal static Utils.EntryType ValidateSyntax(string internalAddress, string externalAddress, bool outboundOnly) { Utils.EntryType entryType = Utils.ValidateAddressEntrySyntax(internalAddress); Utils.EntryType entryType2 = Utils.ValidateAddressEntrySyntax(externalAddress); if (entryType == Utils.EntryType.SmtpAddress && entryType2 == Utils.EntryType.SmtpAddress) { return(Utils.EntryType.SmtpAddress); } if ((entryType != Utils.EntryType.Domain && entryType != Utils.EntryType.WildCardedDomain) || entryType2 != Utils.EntryType.Domain) { throw new ArgumentException(Strings.AddressRewriteInvalidMapping, null); } if (entryType == Utils.EntryType.WildCardedDomain && !outboundOnly) { throw new ArgumentException(Strings.AddressRewriteWildcardWarning, null); } return(entryType); }