示例#1
0
        internal static bool TryGetRoutingAddressFromAD(IADRecipientCache recipientCache, string address, string type, out RoutingAddress result)
        {
            ProxyAddress proxyAddress = ProxyAddress.Parse(type, address);

            if (proxyAddress is InvalidProxyAddress)
            {
                TraceHelper.StoreDriverTracer.TracePass(TraceHelper.MessageProbeActivityId, 0L, "Proxy address is invalid");
                return(false);
            }
            Result <ADRawEntry> result2 = recipientCache.FindAndCacheRecipient(proxyAddress);

            if (result2.Data != null)
            {
                string primarySmtpAddress = SubmissionItemUtils.GetPrimarySmtpAddress(result2.Data);
                if (string.IsNullOrEmpty(primarySmtpAddress))
                {
                    TraceHelper.StoreDriverTracer.TracePass <string, string>(TraceHelper.MessageProbeActivityId, 0L, "Primary SMTP address for \"{0}:{1}\" is invalid or missing", address, type);
                    return(false);
                }
                TraceHelper.StoreDriverTracer.TracePass <string>(TraceHelper.MessageProbeActivityId, 0L, "Use primary smtp address {0}", primarySmtpAddress);
                result = new RoutingAddress(primarySmtpAddress);
                return(true);
            }
            else
            {
                if (result2.Error != null && result2.Error != ProviderError.NotFound)
                {
                    TraceHelper.StoreDriverTracer.TracePass <ProviderError>(TraceHelper.MessageProbeActivityId, 0L, "Failed to look up due to error :{0}", result2.Error);
                    return(false);
                }
                TraceHelper.StoreDriverTracer.TracePass(TraceHelper.MessageProbeActivityId, 0L, "The address doesn't exist in AD");
                return(false);
            }
        }
示例#2
0
 internal static bool TryGetRoutingAddressFromParticipant(IADRecipientCache recipientCache, Participant participant, string context, out RoutingAddress result, out bool usedParticipantSmtpEmailAddress, bool useParticipantSmtpEmailAddressIfNecessary)
 {
     usedParticipantSmtpEmailAddress = false;
     if (participant == null)
     {
         TraceHelper.StoreDriverTracer.TracePass(TraceHelper.MessageProbeActivityId, 0L, "Null participant");
         return(false);
     }
     return(SubmissionItemUtils.TryGetRoutingAddress(recipientCache, participant.EmailAddress, participant.RoutingType, context, participant.SmtpEmailAddress, out result, out usedParticipantSmtpEmailAddress, useParticipantSmtpEmailAddressIfNecessary));
 }
 public InboundConversionOptions(IADRecipientCache scopedRecipientCache, string imceaDomain)
 {
     if (string.IsNullOrEmpty(imceaDomain))
     {
         this.ignoreImceaDomain = true;
     }
     else
     {
         this.imceaResolvableDomain = InboundConversionOptions.CheckImceaDomain(imceaDomain);
     }
     this.RecipientCache = scopedRecipientCache;
 }
示例#4
0
        private static bool IsRententionPolicyEnabled(IADRecipientCache cache, ProxyAddress address)
        {
            ADRawEntry data = cache.FindAndCacheRecipient(address).Data;

            if (data == null)
            {
                return(false);
            }
            ElcMailboxFlags elcMailboxFlags = (ElcMailboxFlags)data[ADUserSchema.ElcMailboxFlags];
            ADObjectId      adobjectId      = (ADObjectId)data[ADUserSchema.ElcPolicyTemplate];

            return(((elcMailboxFlags & ElcMailboxFlags.ElcV2) != ElcMailboxFlags.None && adobjectId != null) || ((elcMailboxFlags & ElcMailboxFlags.ShouldUseDefaultRetentionPolicy) != ElcMailboxFlags.None && adobjectId == null));
        }
示例#5
0
        internal static bool IsSameUser(IRuleEvaluationContext context, IADRecipientCache recipientCache, ProxyAddress addressToResolve, ProxyAddress addressToCompare)
        {
            if (addressToResolve == null || addressToResolve is InvalidProxyAddress)
            {
                return(false);
            }
            if (addressToCompare == null || addressToCompare is InvalidProxyAddress)
            {
                return(false);
            }
            if (addressToResolve.Equals(addressToCompare))
            {
                return(true);
            }
            ADRawEntry data = recipientCache.FindAndCacheRecipient(addressToResolve).Data;

            if (data == null)
            {
                context.TraceDebug <string>("Message recipient {0} did not resolve, IsSameUser returning false.", addressToResolve.ToString());
                return(false);
            }
            string text = (string)data[ADRecipientSchema.LegacyExchangeDN];

            if (text != null && addressToCompare.ValueString.Equals(text, StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }
            ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)data[ADRecipientSchema.EmailAddresses];

            if (proxyAddressCollection == null)
            {
                return(false);
            }
            foreach (ProxyAddress proxyAddress in proxyAddressCollection)
            {
                if (addressToCompare.ValueString.Equals(proxyAddress.ValueString, StringComparison.OrdinalIgnoreCase))
                {
                    return(true);
                }
            }
            return(false);
        }
示例#6
0
        internal IADRecipientCache InternalGetRecipientCache(int count)
        {
            IADRecipientCache iadrecipientCache = this.RecipientCache;

            if (iadrecipientCache == null)
            {
                IRecipientSession tenantOrRootOrgRecipientSession = this.UserADSession;
                if (tenantOrRootOrgRecipientSession == null)
                {
                    try
                    {
                        tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 2002, "InternalGetRecipientCache", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ContentConversion\\ConversionOptions.cs");
                    }
                    catch (ExAssertException)
                    {
                        throw new ArgumentException(InboundConversionOptions.NoScopedTenantInfoNotice);
                    }
                }
                iadrecipientCache = new ADRecipientCache <ADRawEntry>(tenantOrRootOrgRecipientSession, Util.CollectionToArray <ADPropertyDefinition>(ParticipantSchema.SupportedADProperties), count);
            }
            return(iadrecipientCache);
        }
        // Token: 0x06001A85 RID: 6789 RVA: 0x0006F0DC File Offset: 0x0006D2DC
        bool IADRecipientCache.CopyEntryFrom(IADRecipientCache cacheToCopyFrom, ProxyAddress proxyAddress)
        {
            if (cacheToCopyFrom == null)
            {
                throw new ArgumentNullException("cacheToCopyFrom");
            }
            if (proxyAddress == null)
            {
                throw new ArgumentNullException("proxyAddress");
            }
            if (!this.CachedADProperties.SequenceEqual(cacheToCopyFrom.CachedADProperties))
            {
                return(false);
            }
            Result <ADRawEntry> result;

            if (cacheToCopyFrom.TryGetValue(proxyAddress, out result))
            {
                this.AddCacheEntry(proxyAddress, new Result <TEntry>((TEntry)((object)result.Data), result.Error), false);
                return(true);
            }
            return(false);
        }
 public InboundConversionOptions(IADRecipientCache scopedRecipientCache) : this(scopedRecipientCache, null)
 {
 }
 protected RuleEvaluationContextBase(Folder folder, MessageItem message, StoreSession session, ProxyAddress recipient, IADRecipientCache recipientCache, long mimeSize, IRuleConfig ruleConfig, Trace tracer)
 {
     if (message != null)
     {
         this.ruleHistory = message.GetRuleHistory(session);
     }
     this.message     = message;
     this.session     = session;
     this.cultureInfo = this.session.PreferedCulture;
     this.folderSet   = new Dictionary <StoreId, Folder>();
     this.TrackFolder(folder.Id, folder);
     this.folder           = folder;
     this.recipientAddress = recipient;
     this.recipientCache   = recipientCache;
     this.mimeSize         = mimeSize;
     this.ruleConfig       = ruleConfig;
     this.tracer           = tracer;
 }
 // Token: 0x06001A84 RID: 6788 RVA: 0x0006F0C2 File Offset: 0x0006D2C2
 bool IADRecipientCache.CopyEntryFrom(IADRecipientCache cacheToCopyFrom, string smtpAddress)
 {
     return(SmtpAddress.IsValidSmtpAddress(smtpAddress) && ((IADRecipientCache)this).CopyEntryFrom(cacheToCopyFrom, new SmtpProxyAddress(smtpAddress, true)));
 }
 private RmsClientManagerContext(OrganizationId orgId, RmsClientManagerContext.ContextId contextId, string contextValue, Guid transactionId, IADRecipientCache recipientCache, IRmsLatencyTracker latencyTracker)
 {
     ArgumentValidator.ThrowIfNull("orgId", orgId);
     this.orgId          = orgId;
     this.tenantId       = RmsClientManagerUtils.GetTenantGuidFromOrgId(this.orgId);
     this.contextId      = contextId;
     this.contextValue   = contextValue;
     this.transactionId  = transactionId;
     this.recipientCache = recipientCache;
     this.latencyTracker = (latencyTracker ?? NoopRmsLatencyTracker.Instance);
     if (this.recipientCache != null && this.recipientCache.ADSession != null)
     {
         this.recipientSession = this.recipientCache.ADSession;
         return;
     }
     this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, this.orgId.Equals(OrganizationId.ForestWideOrgId) ? ADSessionSettings.FromRootOrgScopeSet() : ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId), 248, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerContext.cs");
 }
 // Token: 0x06001A73 RID: 6771 RVA: 0x0006E168 File Offset: 0x0006C368
 public virtual bool CopyEntryFrom(IADRecipientCache <TEntry> cacheToCopyFrom, string smtpAddress)
 {
     return(SmtpAddress.IsValidSmtpAddress(smtpAddress) && this.CopyEntryFrom(cacheToCopyFrom, new SmtpProxyAddress(smtpAddress, true)));
 }
示例#13
0
        internal static bool TryGetRoutingAddress(IADRecipientCache recipientCache, string address, string type, string context, out RoutingAddress result)
        {
            bool flag;

            return(SubmissionItemUtils.TryGetRoutingAddress(recipientCache, address, type, context, string.Empty, out result, out flag, false));
        }
示例#14
0
 public OutboundConversionOptions(IADRecipientCache scopedRecipientCache, string imceaDomain) : this(imceaDomain)
 {
     this.RecipientCache = scopedRecipientCache;
 }
示例#15
0
        internal static bool TryGetRoutingAddress(IADRecipientCache recipientCache, string participantEmailAddress, string type, string context, string participantSmtpAddress, out RoutingAddress result, out bool usedParticipantSmtpEmailAddress, bool useParticipantSmtpEmailAddressIfNecessary = false)
        {
            result = RoutingAddress.Empty;
            usedParticipantSmtpEmailAddress = false;
            TraceHelper.StoreDriverTracer.TracePass <string, string>(TraceHelper.MessageProbeActivityId, 0L, "Try to get routing address for {0}:{1}.", type, participantEmailAddress);
            string text = SubmissionItemUtils.StripSingleQuotes(participantEmailAddress);

            if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(text))
            {
                TraceHelper.StoreDriverTracer.TracePass <string>(TraceHelper.MessageProbeActivityId, 0L, "Required {0} properties are empty", context);
                return(false);
            }
            if (type.Equals("SMTP", StringComparison.OrdinalIgnoreCase))
            {
                result = new RoutingAddress(text);
                if (result.IsValid)
                {
                    return(true);
                }
                string text2;
                if (ConfigurationProvider.TryGetDefaultDomainName(recipientCache.OrganizationId, out text2) && !string.IsNullOrEmpty(text2))
                {
                    result = new RoutingAddress(text, text2);
                    if (result.IsValid)
                    {
                        return(true);
                    }
                }
                result = RoutingAddress.Empty;
                TraceHelper.StoreDriverTracer.TracePass <string, string>(TraceHelper.MessageProbeActivityId, 0L, "{0} Smtp Address is invalid {1}", context, text);
                return(false);
            }
            else
            {
                if (SubmissionItemUtils.TryGetRoutingAddressFromAD(recipientCache, participantEmailAddress, type, out result))
                {
                    return(true);
                }
                if (type.Equals("X400", StringComparison.OrdinalIgnoreCase))
                {
                    bool flag;
                    if (!X400AddressParser.TryGetCanonical(participantEmailAddress, false, out text, out flag))
                    {
                        return(false);
                    }
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }
                }
                if (useParticipantSmtpEmailAddressIfNecessary && !string.IsNullOrEmpty(participantSmtpAddress))
                {
                    result = new RoutingAddress(participantSmtpAddress);
                    if (result.IsValid)
                    {
                        usedParticipantSmtpEmailAddress = true;
                        return(true);
                    }
                }
                result = RoutingAddress.Empty;
                SmtpProxyAddress smtpProxyAddress;
                if (SmtpProxyAddress.TryEncapsulate(type, text, ConfigurationProvider.GetDefaultDomainName(), out smtpProxyAddress))
                {
                    result = (RoutingAddress)smtpProxyAddress.SmtpAddress;
                    return(true);
                }
                TraceHelper.StoreDriverTracer.TracePass <string, string>(TraceHelper.MessageProbeActivityId, 0L, "Couldn't encapsulate address {0}:{1}.", type, participantEmailAddress);
                return(false);
            }
        }
 // Token: 0x06001C7D RID: 7293 RVA: 0x000761B6 File Offset: 0x000743B6
 public bool CopyEntryFrom(IADRecipientCache cacheToCopyFrom, ProxyAddress proxyAddress)
 {
     throw new NotImplementedException();
 }
示例#17
0
        internal static bool TryGetRoutingAddressFromParticipant(IADRecipientCache recipientCache, Participant participant, string context, out RoutingAddress result)
        {
            bool flag;

            return(SubmissionItemUtils.TryGetRoutingAddressFromParticipant(recipientCache, participant, context, out result, out flag, false));
        }
        protected PFRuleEvaluationContext(Folder folder, ICoreItem message, StoreSession session, ProxyAddress recipient, IADRecipientCache recipientCache, long mimeSize) : base(folder, null, session, recipient, recipientCache, mimeSize, PFRuleConfig.Instance, ExTraceGlobals.SessionTracer)
        {
            AcrPropertyBag acrPropertyBag = message.PropertyBag as AcrPropertyBag;

            if (acrPropertyBag != null)
            {
                this.messageContextStoreObject = acrPropertyBag.Context.StoreObject;
            }
            base.Message      = new MessageItem(message, false);
            this.ruleHistory  = base.Message.GetRuleHistory();
            base.LimitChecker = new LimitChecker(this);
            this.ruleConfig   = PFRuleConfig.Instance;
        }
 public RmsClientManagerContext(OrganizationId orgId, RmsClientManagerContext.ContextId contextId, string contextValue, IADRecipientCache recipientCache, IRmsLatencyTracker latencyTracker, string publishingLicense, Guid externalDirectoryOrgId) : this(orgId, contextId, contextValue, recipientCache, latencyTracker, publishingLicense)
 {
     this.externalDirectoryOrgId = externalDirectoryOrgId;
 }
 public RmsClientManagerContext(OrganizationId orgId, RmsClientManagerContext.ContextId contextId, string contextValue, IADRecipientCache recipientCache, IRmsLatencyTracker latencyTracker, string publishingLicense = null) : this(orgId, contextId, contextValue, Guid.NewGuid(), recipientCache, latencyTracker)
 {
     if (!string.IsNullOrEmpty(publishingLicense))
     {
         this.orgId = RmsClientManagerUtils.OrgIdFromPublishingLicenseOrDefault(publishingLicense, orgId, out this.externalDirectoryOrgId);
     }
 }
示例#21
0
 public PFMessageContext(Folder folder, ICoreItem message, StoreSession session, ProxyAddress recipientAddress, IADRecipientCache recipientCache, long mimeSize) : base(folder, message, session, recipientAddress, recipientCache, mimeSize)
 {
 }