Exemplo n.º 1
0
        // Token: 0x06001AA4 RID: 6820 RVA: 0x0006F970 File Offset: 0x0006DB70
        public void Expand(ADRawEntry recipientToExpand, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure)
        {
            if (recipientToExpand == null)
            {
                throw new ArgumentNullException("recipientToExpand");
            }
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Requested to expand recipient: {0}", new object[]
            {
                recipientToExpand[ADObjectSchema.Id]
            });
            Stack <ADRecipientExpansion.ExpandableEntry> stack = new Stack <ADRecipientExpansion.ExpandableEntry>();

            if (!this.ProcessChild(recipientToExpand, null, handleRecipient, handleFailure, stack))
            {
                return;
            }
            while (stack.Count > 0)
            {
                ADRecipientExpansion.ExpandableEntry expandableEntry = stack.Pop();
                ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expanding recipient: {0}", new object[]
                {
                    expandableEntry.Entry[ADObjectSchema.Id]
                });
                if (!this.ExpandEntry(expandableEntry, handleRecipient, handleFailure, stack))
                {
                    ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expansion terminated by delegate");
                    return;
                }
            }
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expansion completed");
        }
Exemplo n.º 2
0
        // Token: 0x06001AB2 RID: 6834 RVA: 0x0006FFDC File Offset: 0x0006E1DC
        private bool ExpandContactChain(ADRecipientExpansion.ExpandableEntry contact, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure, Stack <ADRecipientExpansion.ExpandableEntry> expansionStack)
        {
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expanding possible contact chain for: {0}", new object[]
            {
                contact.Entry[ADObjectSchema.Id]
            });
            ADRawEntry adrawEntry = this.session.FindByProxyAddress((ProxyAddress)contact.Entry[ADRecipientSchema.ExternalEmailAddress], this.allProperties);

            if (handleRecipient != null)
            {
                ExpansionType    expansionType    = (adrawEntry == null) ? ExpansionType.None : ExpansionType.ContactChain;
                ExpansionControl expansionControl = ADRecipientExpansion.InvokeRecipientDelegate(handleRecipient, contact.Entry, expansionType, contact.Parent);
                if (expansionControl != ExpansionControl.Continue)
                {
                    return(expansionControl != ExpansionControl.Terminate);
                }
            }
            if (adrawEntry != null)
            {
                ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Found chained object: {0}", new object[]
                {
                    adrawEntry[ADObjectSchema.Id]
                });
                return(this.ProcessChild(adrawEntry, contact, handleRecipient, handleFailure, expansionStack));
            }
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "No contact chain found");
            return(true);
        }
Exemplo n.º 3
0
 // Token: 0x06001AB6 RID: 6838 RVA: 0x00070278 File Offset: 0x0006E478
 private bool IsLoopDetected(ADRawEntry entry, ADRecipientExpansion.ExpandableEntry parent)
 {
     while (parent != null)
     {
         if ((Guid)entry[ADObjectSchema.Guid] == (Guid)parent.Entry[ADObjectSchema.Guid])
         {
             ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Loop detected for recipient {0}", new object[]
             {
                 entry[ADObjectSchema.Id]
             });
             return(true);
         }
         parent = parent.Parent;
     }
     return(false);
 }
Exemplo n.º 4
0
        // Token: 0x06001AB3 RID: 6835 RVA: 0x000700C4 File Offset: 0x0006E2C4
        private bool ProcessChild(ADRawEntry child, ADRecipientExpansion.ExpandableEntry parent, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure, Stack <ADRecipientExpansion.ExpandableEntry> expansionStack)
        {
            ExpansionFailure failure       = ExpansionFailure.NotMailEnabled;
            bool             flag          = false;
            ExpansionType    expansionType = ADRecipientExpansion.GetExpansionType(child);

            ExTraceGlobals.ADExpansionTracer.TraceDebug <object, string>((long)this.GetHashCode(), "Processing recipient {0} with expansion type {1}", child[ADObjectSchema.Id], ADRecipientExpansion.GetExpansionTypeString(expansionType));
            if (!this.ignoreMailEnabledCase && !this.IsMailEnabled(child))
            {
                failure = ExpansionFailure.NotMailEnabled;
                flag    = true;
            }
            if (!flag && !this.IsAuthorized(child))
            {
                failure = ExpansionFailure.NotAuthorized;
                flag    = true;
            }
            if (!flag && expansionType != ExpansionType.None && this.IsLoopDetected(child, parent))
            {
                failure = ExpansionFailure.LoopDetected;
                flag    = true;
            }
            if (flag)
            {
                return(ADRecipientExpansion.InvokeFailureDelegate(handleFailure, failure, child, expansionType, parent) != ExpansionControl.Terminate);
            }
            ExpansionControl expansionControl = ExpansionControl.Continue;

            if (expansionType != ExpansionType.ContactChain)
            {
                expansionControl = ADRecipientExpansion.InvokeRecipientDelegate(handleRecipient, child, expansionType, parent);
            }
            if (expansionControl == ExpansionControl.Terminate)
            {
                return(false);
            }
            if (expansionControl != ExpansionControl.Skip && expansionType != ExpansionType.None)
            {
                expansionStack.Push(new ADRecipientExpansion.ExpandableEntry(child, expansionType, parent));
                ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Recipient {0} pushed on the expansion stack", new object[]
                {
                    child[ADObjectSchema.Id]
                });
            }
            return(true);
        }
Exemplo n.º 5
0
        // Token: 0x06001AAF RID: 6831 RVA: 0x0006FD54 File Offset: 0x0006DF54
        private bool ExpandEntry(ADRecipientExpansion.ExpandableEntry entry, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure, Stack <ADRecipientExpansion.ExpandableEntry> expansionStack)
        {
            switch (entry.ExpansionType)
            {
            case ExpansionType.GroupMembership:
                return(this.ExpandGroup(entry, handleRecipient, handleFailure, expansionStack));

            case ExpansionType.AlternateRecipientForward:
            case ExpansionType.AlternateRecipientDeliverAndForward:
                return(this.ExpandAlternateRecipient(entry, handleRecipient, handleFailure, expansionStack));

            case ExpansionType.ContactChain:
                return(this.ExpandContactChain(entry, handleRecipient, handleFailure, expansionStack));

            default:
                throw new InvalidOperationException("Invalid expansion type: " + entry.ExpansionType.ToString());
            }
        }
Exemplo n.º 6
0
        // Token: 0x06001AB1 RID: 6833 RVA: 0x0006FF18 File Offset: 0x0006E118
        private bool ExpandAlternateRecipient(ADRecipientExpansion.ExpandableEntry recipient, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure, Stack <ADRecipientExpansion.ExpandableEntry> expansionStack)
        {
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expanding alternate recipient for: {0}", new object[]
            {
                recipient.Entry[ADObjectSchema.Id]
            });
            ADRawEntry adrawEntry = this.session.ReadADRawEntry((ADObjectId)recipient.Entry[ADRecipientSchema.ForwardingAddress], this.allProperties);

            if (adrawEntry == null)
            {
                ExTraceGlobals.ADExpansionTracer.TraceError((long)this.GetHashCode(), "Alternate recipient {0} for recipient {1} not found", new object[]
                {
                    recipient.Entry[ADRecipientSchema.ForwardingAddress],
                    recipient.Entry[ADObjectSchema.Id]
                });
                return(ADRecipientExpansion.InvokeFailureDelegate(handleFailure, ExpansionFailure.AlternateRecipientNotFound, recipient));
            }
            return(this.ProcessChild(adrawEntry, recipient, handleRecipient, handleFailure, expansionStack));
        }
Exemplo n.º 7
0
        // Token: 0x06001AB0 RID: 6832 RVA: 0x0006FDC8 File Offset: 0x0006DFC8
        private bool ExpandGroup(ADRecipientExpansion.ExpandableEntry group, ADRecipientExpansion.HandleRecipientDelegate handleRecipient, ADRecipientExpansion.HandleFailureDelegate handleFailure, Stack <ADRecipientExpansion.ExpandableEntry> expansionStack)
        {
            ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expanding group: {0}", new object[]
            {
                group.Entry[ADObjectSchema.Id]
            });
            IADDistributionList iaddistributionList = this.session.FindByObjectGuid((Guid)group.Entry[ADObjectSchema.Guid]) as IADDistributionList;

            if (iaddistributionList == null)
            {
                ExTraceGlobals.ADExpansionTracer.TraceError((long)this.GetHashCode(), "Could not find group object by GUID {0}; treating the group as empty", new object[]
                {
                    group.Entry[ADObjectSchema.Guid]
                });
                return(ADRecipientExpansion.InvokeFailureDelegate(handleFailure, ExpansionFailure.NoMembers, group));
            }
            ADPagedReader <ADRawEntry> adpagedReader = iaddistributionList.Expand(1000, this.allProperties);
            bool flag = false;

            foreach (ADRawEntry child in adpagedReader)
            {
                flag = true;
                if (!this.ProcessChild(child, group, handleRecipient, handleFailure, expansionStack))
                {
                    return(false);
                }
            }
            if (!flag)
            {
                ExTraceGlobals.ADExpansionTracer.TraceDebug((long)this.GetHashCode(), "Expanded empty group: {0}", new object[]
                {
                    group.Entry[ADObjectSchema.Id]
                });
                return(ADRecipientExpansion.InvokeFailureDelegate(handleFailure, ExpansionFailure.NoMembers, group));
            }
            return(true);
        }
Exemplo n.º 8
0
 // Token: 0x06001AC2 RID: 6850 RVA: 0x000704E2 File Offset: 0x0006E6E2
 public ExpandableEntry(ADRawEntry entry, ExpansionType expansionType, ADRecipientExpansion.ExpandableEntry parent)
 {
     this.entry         = entry;
     this.expansionType = expansionType;
     this.parent        = parent;
 }
Exemplo n.º 9
0
 // Token: 0x06001AAD RID: 6829 RVA: 0x0006FCE2 File Offset: 0x0006DEE2
 private static bool InvokeFailureDelegate(ADRecipientExpansion.HandleFailureDelegate handleFailure, ExpansionFailure failure, ADRecipientExpansion.ExpandableEntry recipient)
 {
     return(ADRecipientExpansion.InvokeFailureDelegate(handleFailure, failure, recipient.Entry, recipient.ExpansionType, recipient.Parent) != ExpansionControl.Terminate);
 }
Exemplo n.º 10
0
        // Token: 0x06001AA9 RID: 6825 RVA: 0x0006FC14 File Offset: 0x0006DE14
        private static ExpansionControl InvokeFailureDelegate(ADRecipientExpansion.HandleFailureDelegate handleFailure, ExpansionFailure failure, ADRawEntry recipient, ExpansionType expansionType, ADRecipientExpansion.ExpandableEntry parent)
        {
            if (handleFailure == null)
            {
                return(ExpansionControl.Continue);
            }
            ExpansionType expansionType2 = (parent == null) ? ExpansionType.None : parent.ExpansionType;

            ExTraceGlobals.ADExpansionTracer.TraceDebug(0L, "Invoking failure delegate: failure={0}; recipient={1}; expansion-type={2}; parent={3}; parent-expansion-type={4}", new object[]
            {
                ADRecipientExpansion.GetExpansionFailureString(failure),
                recipient[ADObjectSchema.Id],
                ADRecipientExpansion.GetExpansionTypeString(expansionType),
                (parent == null) ? "<null>" : parent.Entry[ADObjectSchema.Id],
                ADRecipientExpansion.GetExpansionTypeString(expansionType2)
            });
            ExpansionControl expansionControl = handleFailure(failure, recipient, expansionType, (parent == null) ? null : parent.Entry, expansionType2);

            ExTraceGlobals.ADExpansionTracer.TraceDebug <string>(0L, "Delegate returned '{0}'", ADRecipientExpansion.GetExpansionControlString(expansionControl));
            return(expansionControl);
        }