コード例 #1
0
        internal static void ObjectIdSetter(object value, IPropertyBag propertyBag)
        {
            ADObjectId adobjectId = value as ADObjectId;

            if (adobjectId == null)
            {
                throw new ArgumentNullException("Id");
            }
            ulong num;

            if (!ConsumerIdentityHelper.TryGetPuidFromGuid(adobjectId.ObjectGuid, out num))
            {
                throw new ArgumentException("Id.ObjectGuid");
            }
            ulong num2;

            if (!ConsumerIdentityHelper.TryGetPuidFromDN(adobjectId.DistinguishedName, out num2))
            {
                throw new ArgumentException("Id.DistinguishedName");
            }
            if (num != num2)
            {
                throw new ArgumentException("Id");
            }
            propertyBag[MServRecipientSchema.Puid] = num2;
        }
コード例 #2
0
        // Token: 0x06000E74 RID: 3700 RVA: 0x000452C4 File Offset: 0x000434C4
        public static ADRawEntry FindADRawEntryByPuid(ulong puid, Guid mdbGuid, bool readOnly, IEnumerable <MbxPropertyDefinition> properties)
        {
            Guid                   exchangeGuidFromPuid = ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid);
            ADObjectId             adobjectIdFromPuid   = ConsumerIdentityHelper.GetADObjectIdFromPuid(puid);
            List <ValidationError> errors = new List <ValidationError>();

            return(MbxRecipientSession.ReadUserInformationRecord(adobjectIdFromPuid, mdbGuid, exchangeGuidFromPuid, readOnly, properties, errors));
        }
コード例 #3
0
        public static ADRawEntry PerformMbxLookupByPuid(ADObjectId resultId, Guid mdbGuid, bool isReadOnly, List <MbxPropertyDefinition> properties)
        {
            ulong puid;

            if (ConsumerIdentityHelper.TryGetPuidFromGuid(resultId.ObjectGuid, out puid))
            {
                return(MbxRecipientSession.FindADRawEntryByPuid(puid, mdbGuid, isReadOnly, properties));
            }
            throw new ArgumentException("resultId");
        }
コード例 #4
0
        private static bool TrySaveChanges(IRecipientSession session, ulong puid, ADPropertyDefinition prop, object addedValue, object removedValue, Action <string> logAction, Action <string> warningLogAction)
        {
            if (addedValue != null && removedValue != null)
            {
                throw new InvalidOperationException("You must set a value to addedValue or removedValue, not both.");
            }
            object obj = addedValue;
            bool   result;

            try
            {
                ADUser aduser = new ADUser();
                aduser.SetId(ConsumerIdentityHelper.GetADObjectIdFromPuid(puid));
                if (prop.IsMultivalued)
                {
                    if (addedValue != null)
                    {
                        ((MultiValuedPropertyBase)aduser[prop]).Add(addedValue);
                    }
                    else if (removedValue != null)
                    {
                        ((MultiValuedPropertyBase)aduser[prop]).Remove(removedValue);
                        obj = removedValue;
                    }
                }
                else
                {
                    aduser[prop] = addedValue;
                }
                session.Save(aduser);
                result = true;
            }
            catch (Exception ex)
            {
                logAction(string.Format("Error writing value. PUID: {0} Property: {1} Value: {2} Error: {3}", new object[]
                {
                    ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid),
                    prop.Name,
                    obj ?? "<NULL>",
                    ex.ToString()
                }));
                warningLogAction(string.Format("Error writing value. PUID: {0} Property: {1} Value: {2} Error: {3}", new object[]
                {
                    ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid),
                    prop.Name,
                    obj ?? "<NULL>",
                    ex.Message
                }));
                result = false;
            }
            return(result);
        }
コード例 #5
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            this.DataObject = (ADUser)base.PrepareDataObject();
            ulong puidNum;

            if (ConsumerIdentityHelper.TryGetPuidFromGuid(this.DataObject.ExchangeGuid, out puidNum))
            {
                base.Fields[ADUserSchema.NetID] = new NetID(ConsumerIdentityHelper.ConvertPuidNumberToPuidString(puidNum));
                TaskLogger.LogExit();
                return(null);
            }
            throw new TaskInvalidOperationException(new LocalizedString(string.Format(CultureInfo.CurrentUICulture, "Could not extract puid from ExchangeGuid for this user", new object[0])));
        }
コード例 #6
0
        private IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            base.DataObject = (ADUser)base.ResolveDataObject();
            ulong puidNum;

            if (ConsumerIdentityHelper.TryGetPuidByExternalDirectoryObjectId(base.DataObject.ExchangeGuid.ToString(), out puidNum))
            {
                base.Fields[ADUserSchema.NetID] = new NetID(ConsumerIdentityHelper.ConvertPuidNumberToPuidString(puidNum));
                TaskLogger.LogExit();
                return(null);
            }
            throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "Could not extract puid from ExchangeGuid for this user", new object[0]));
        }
コード例 #7
0
        protected override void AfterTargetConnect()
        {
            ADUser aduser = null;
            string text   = base.CachedRequestJob.RemoteHostName;

            if (string.IsNullOrEmpty(text))
            {
                aduser = base.MailboxMerger.DestMailbox.GetADUser();
                IPAddress clusterIp = (IPAddress)aduser[ConsumerMailboxSchema.SatchmoClusterIp];
                text = OlcTopology.Instance.FindServerByClusterIP(clusterIp);
            }
            ulong value;
            int   value2;

            if (base.CachedRequestJob.UserPuid != null && base.CachedRequestJob.OlcDGroup != null)
            {
                value  = (ulong)base.CachedRequestJob.UserPuid.Value;
                value2 = base.CachedRequestJob.OlcDGroup.Value;
            }
            else
            {
                if (aduser == null)
                {
                    aduser = base.MailboxMerger.DestMailbox.GetADUser();
                }
                if (!ConsumerIdentityHelper.TryGetPuidFromGuid(aduser.ExchangeGuid, out value))
                {
                    throw new UnexpectedValuePermanentException(aduser.ExchangeGuid.ToString(), "destUser.ExchangeGuid");
                }
                string text2 = (string)aduser[ConsumerMailboxSchema.SatchmoDGroup];
                if (!int.TryParse(text2, out value2))
                {
                    throw new UnexpectedValuePermanentException(text2, "MServRecipientSchema.SatchmoDGroup");
                }
            }
            base.MailboxMerger.SourceMailbox.ConfigOlc(new OlcMailboxConfiguration
            {
                Puid           = (long)value,
                DGroup         = value2,
                RemoteHostName = text
            });
        }
コード例 #8
0
        internal override ADSessionSettings FromTenantAcceptedDomain(string domain)
        {
            if (domain == null)
            {
                throw new ArgumentNullException("domain");
            }
            SmtpDomain domainName;

            if (!SmtpDomain.TryParse(domain, out domainName))
            {
                throw new CannotResolveTenantNameException(DirectoryStrings.CannotResolveTenantNameByAcceptedDomain(domain));
            }
            if (ConsumerIdentityHelper.IsConsumerDomain(domainName))
            {
                return(ADSessionSettings.FromConsumerOrganization());
            }
            OrganizationId scopingOrganizationId = OrganizationId.FromAcceptedDomain(domain);

            return(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(scopingOrganizationId));
        }
コード例 #9
0
        public static ADUser ReadUser(IRecipientSession session, ulong puid, bool mservOnly)
        {
            ADUser result;

            try
            {
                ((IAggregateSession)session).MbxReadMode      = (mservOnly ? MbxReadMode.NoMbxRead : MbxReadMode.OnlyIfLocatorDataAvailable);
                ((IAggregateSession)session).BackendWriteMode = BackendWriteMode.NoWrites;
                result = session.FindADUserByExternalDirectoryObjectId(ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid).ToString());
            }
            catch (ADDriverStoreAccessPermanentException ex)
            {
                if (!(ex.InnerException is MapiExceptionMdbOffline) && !(ex.InnerException is MapiExceptionUserInformationNotFound))
                {
                    throw;
                }
                ((IAggregateSession)session).MbxReadMode      = MbxReadMode.NoMbxRead;
                ((IAggregateSession)session).BackendWriteMode = BackendWriteMode.NoWrites;
                result = session.FindADUserByExternalDirectoryObjectId(ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid).ToString());
            }
            return(result);
        }
コード例 #10
0
        private static bool PopulateMservPuidRecordProperties(ADUser user, ulong puid, bool makePrimary, bool makeSecondary, PropertyBag propertiesToSet)
        {
            bool result = false;

            user.SetId(ConsumerIdentityHelper.GetADObjectIdFromPuid(puid));
            if (propertiesToSet.IsModified(ADMailboxRecipientSchema.Database))
            {
                user.Database = (ADObjectId)propertiesToSet[ADMailboxRecipientSchema.Database];
                result        = true;
            }
            if (makePrimary)
            {
                user[ADUserSchema.PrimaryMailboxSource] = PrimaryMailboxSourceType.Exo;
                result = true;
            }
            else if (makeSecondary)
            {
                user[ADUserSchema.PrimaryMailboxSource] = PrimaryMailboxSourceType.Hotmail;
                result = true;
            }
            return(result);
        }
コード例 #11
0
        private static bool PopulateConsumerMailboxProperties(ADRawEntry user, ulong puid, IEnumerable <ADPropertyDefinition> propertiesToSet, PropertyBag propertyValuesBag, bool setMbxPropertyDefinition = false)
        {
            bool result = false;

            if (!setMbxPropertyDefinition)
            {
                user.SetId(ConsumerIdentityHelper.GetADObjectIdFromPuid(puid));
            }
            foreach (ADPropertyDefinition adpropertyDefinition in propertiesToSet)
            {
                if (propertyValuesBag.IsModified(adpropertyDefinition))
                {
                    if (adpropertyDefinition.IsMultivalued)
                    {
                        MultiValuedPropertyBase multiValuedPropertyBase  = setMbxPropertyDefinition ? ((MultiValuedPropertyBase)user[adpropertyDefinition.MbxPropertyDefinition]) : ((MultiValuedPropertyBase)user[adpropertyDefinition]);
                        MultiValuedPropertyBase multiValuedPropertyBase2 = (MultiValuedPropertyBase)propertyValuesBag[adpropertyDefinition];
                        foreach (object item in multiValuedPropertyBase2.Added)
                        {
                            multiValuedPropertyBase.Add(item);
                        }
                        foreach (object item2 in multiValuedPropertyBase2.Removed)
                        {
                            multiValuedPropertyBase.Remove(item2);
                        }
                    }
                    else if (setMbxPropertyDefinition)
                    {
                        user[adpropertyDefinition.MbxPropertyDefinition] = propertyValuesBag[adpropertyDefinition];
                    }
                    else
                    {
                        user[adpropertyDefinition] = propertyValuesBag[adpropertyDefinition];
                    }
                    result = true;
                }
            }
            return(result);
        }
コード例 #12
0
        private static object SidGetter(IPropertyBag propertyBag)
        {
            ulong puid = (ulong)propertyBag[MServRecipientSchema.Puid];

            return(ConsumerIdentityHelper.GetSecurityIdentifierFromPuid(puid));
        }
コード例 #13
0
        public static void CreateOrUpdateConsumerMailbox(WriteOperationType writeOperationType, PropertyBag propertyValuesBag, IRecipientSession session, Action <string> logAction, Action <string> warningLogAction = null)
        {
            MbxReadMode      mbxReadMode      = ((IAggregateSession)session).MbxReadMode;
            BackendWriteMode backendWriteMode = ((IAggregateSession)session).BackendWriteMode;

            try
            {
                if (logAction == null)
                {
                    throw new ArgumentNullException("logAction");
                }
                if (warningLogAction == null)
                {
                    throw new ArgumentNullException("warningLogAction");
                }
                if (!propertyValuesBag.IsModified(ADUserSchema.NetID))
                {
                    throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "Property 'ADUserSchema.NetID' must be set", new object[0]));
                }
                ulong  puid   = ((NetID)propertyValuesBag[ADUserSchema.NetID]).ToUInt64();
                string text   = ((NetID)propertyValuesBag[ADUserSchema.NetID]).ToString();
                bool   flag   = propertyValuesBag.IsModified("MakeExoPrimary") && (bool)propertyValuesBag["MakeExoPrimary"];
                bool   flag2  = propertyValuesBag.IsModified("MakeExoSecondary") && (bool)propertyValuesBag["MakeExoSecondary"];
                bool   flag3  = propertyValuesBag.IsModified("SkipMigration") && (bool)propertyValuesBag["SkipMigration"];
                ADUser aduser = ConsumerMailboxHelper.ReadUser(session, puid, true);
                if (aduser == null && (writeOperationType == WriteOperationType.Update || writeOperationType == WriteOperationType.RepairUpdate))
                {
                    throw new ADNoSuchObjectException(new LocalizedString(string.Format(CultureInfo.CurrentUICulture, "Cannot update object. Mserv entry for PUID: '{0}' not found", new object[]
                    {
                        text
                    })));
                }
                if (aduser != null && writeOperationType == WriteOperationType.Create && !flag2 && (!flag || !flag3))
                {
                    throw new ADObjectAlreadyExistsException(new LocalizedString(string.Format(CultureInfo.CurrentUICulture, "Cannot create object. Mserv entry for PUID: '{0}' already exists", new object[]
                    {
                        text
                    })));
                }
                if (aduser != null && aduser.Database != null && propertyValuesBag.IsModified(ADMailboxRecipientSchema.Database) && !aduser.Database.Equals((ADObjectId)propertyValuesBag[ADMailboxRecipientSchema.Database]))
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "Cannot update database of an existing consumer mailbox in EXO. PUID: '{0}' Existing database: {1}", new object[]
                    {
                        text,
                        aduser.Database
                    }));
                }
                if (flag && flag2)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "Cannot set MakeExoPrimary and MakeExoSecondary at the same time. PUID: '{0}'", new object[]
                    {
                        text
                    }));
                }
                if (aduser == null)
                {
                    aduser = new ADUser();
                }
                if (flag)
                {
                    if (writeOperationType == WriteOperationType.Create && aduser.PrimaryMailboxSource() == PrimaryMailboxSourceType.None)
                    {
                        logAction("Current state: No mserv footprint - i.e. no mailbox in EXO and Hotmail.");
                        logAction("Action requested: MakeExoPrimary: Create a brand new primary consumer mailbox in EXO. ");
                    }
                    else if (writeOperationType == WriteOperationType.RepairCreate && (aduser.PrimaryMailboxSource() == PrimaryMailboxSourceType.None || aduser.PrimaryMailboxSource() == PrimaryMailboxSourceType.Exo))
                    {
                        logAction("Current state: Either no mserv footprint exists or a primary mailbox exists in EXO.");
                        logAction("Action requested: MakeExoPrimary: Retry creation of primary consumer mailbox in EXO. ");
                    }
                    else if ((writeOperationType == WriteOperationType.Update || writeOperationType == WriteOperationType.RepairUpdate) && aduser.Database != null && aduser.PrimaryMailboxSource() == PrimaryMailboxSourceType.Hotmail)
                    {
                        logAction("Current state: Primary mailbox exists in Hotmail and Secondary mailbox exists in EXO.");
                        logAction("Action requested: MakeExoPrimary: Switch from hotmail to EXO. ");
                    }
                    else
                    {
                        if ((writeOperationType != WriteOperationType.Create && writeOperationType != WriteOperationType.RepairCreate) || aduser.PrimaryMailboxSource() != PrimaryMailboxSourceType.Hotmail || aduser.Database != null || !flag3)
                        {
                            throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "Cannot proceed with MakeExoPrimary operation. Invalid state detected. PUID: '{0}' Current primary mailbox source: {1} Write operation type: {2}", new object[]
                            {
                                text,
                                aduser.PrimaryMailboxSource(),
                                writeOperationType
                            }));
                        }
                        logAction("Current state: Primary mailbox exists in Hotmail and no secondary mailbox exists in EXO.");
                        logAction("Action requested: MakeExoPrimary: Switch directly from hotmail to EXO w/o migrating email contents and SkipMigration flag is supplied. ");
                    }
                }
                if (flag2)
                {
                    if (writeOperationType == WriteOperationType.Create && aduser.PrimaryMailboxSource() == PrimaryMailboxSourceType.Hotmail)
                    {
                        logAction("Current state: An existing primary mailbox in Hotmail.");
                        logAction("Action requested: MakeExoSecondary: Create a brand new secondary consumer mailbox in EXO. ");
                    }
                    else
                    {
                        if (writeOperationType != WriteOperationType.RepairCreate || aduser.PrimaryMailboxSource() != PrimaryMailboxSourceType.Hotmail)
                        {
                            throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "Invalid state detected. Cannot proceed with MakeExoSecondary operation. A hotmail account must exist for PUID: '{0}'. Current primary mailbox source: {1} Write operation type: {2}", new object[]
                            {
                                text,
                                aduser.PrimaryMailboxSource(),
                                writeOperationType
                            }));
                        }
                        logAction("Current state: An existing primary mailbox in Hotmail with or without a secondary mailbox in EXO.");
                        logAction("Action requested: MakeExoSecondary: Retry creating a brand new secondary consumer mailbox in EXO. ");
                    }
                    propertyValuesBag[ADUserSchema.IsMigratedConsumerMailbox] = true;
                }
                if ((flag || flag2) && aduser.Database == null && !propertyValuesBag.IsModified(ADMailboxRecipientSchema.Database))
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, "You must specify Database for creating a new mailbox. PUID: '{0}'", new object[]
                    {
                        text
                    }));
                }
                if (!flag && !flag2 && aduser.Database == null)
                {
                    throw new ADNoSuchObjectException(new LocalizedString(string.Format(CultureInfo.CurrentUICulture, "Cannot perform this operation. No consumer mailbox (primary/secondary) exists for this user in EXO. PUID: '{0}'", new object[]
                    {
                        text
                    })));
                }
                ADRawEntry adrawEntry = new ADRawEntry();
                ADObjectId adobjectId = aduser.Database ?? (propertyValuesBag[ADMailboxRecipientSchema.Database] as ADObjectId);
                if (adobjectId != null && ConsumerMailboxHelper.PopulateStoreOnlyProperties(adrawEntry, puid, propertyValuesBag, true))
                {
                    logAction(string.Format("Saving store properties for user - puid: {0}", text));
                    AggregationHelper.PerformMbxModification(adobjectId.ObjectGuid, ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid), adrawEntry.propertyBag as ADPropertyBag, false);
                }
                if (ConsumerMailboxHelper.PopulateMservPuidRecordProperties(aduser, puid, flag, flag2, propertyValuesBag))
                {
                    logAction(string.Format("Saving PUID records in Mserv for user - puid: {0}", text));
                    ((IAggregateSession)session).MbxReadMode      = MbxReadMode.NoMbxRead;
                    ((IAggregateSession)session).BackendWriteMode = BackendWriteMode.WriteToMServ;
                    session.Save(aduser);
                    aduser = ConsumerMailboxHelper.ReadUser(session, puid, true);
                }
                if (writeOperationType == WriteOperationType.RepairCreate || writeOperationType == WriteOperationType.RepairUpdate)
                {
                    ((IAggregateSession)session).MbxReadMode      = MbxReadMode.NoMbxRead;
                    ((IAggregateSession)session).BackendWriteMode = BackendWriteMode.WriteToMServ;
                    ConsumerMailboxHelper.SaveChangesInRepairMode(session, puid, ConsumerMailboxHelper.MServAliasAndOtherRecordProperties, propertyValuesBag, logAction, warningLogAction);
                }
                else if (ConsumerMailboxHelper.PopulateAliasAndOtherRecordProperties(aduser, puid, propertyValuesBag))
                {
                    logAction(string.Format("Saving Aliases and other records in Mserv for user - puid: {0}", text));
                    ((IAggregateSession)session).MbxReadMode      = MbxReadMode.NoMbxRead;
                    ((IAggregateSession)session).BackendWriteMode = BackendWriteMode.WriteToMServ;
                    session.Save(aduser);
                }
            }
            finally
            {
                ((IAggregateSession)session).MbxReadMode      = mbxReadMode;
                ((IAggregateSession)session).BackendWriteMode = backendWriteMode;
            }
        }
コード例 #14
0
        private static object NameGetter(IPropertyBag propertyBag)
        {
            ulong puid = (ulong)propertyBag[MServRecipientSchema.Puid];

            return(ConsumerIdentityHelper.GetCommonNameFromPuid(puid));
        }
コード例 #15
0
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            notFoundReason = null;
            if (typeof(T) != typeof(ADUser))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type");
            }
            List <ADUser> list   = new List <ADUser>();
            ADUser        aduser = null;
            Guid          exchangeGuid;
            WindowsLiveId windowsLiveId;

            if (Guid.TryParse(base.RawIdentity, out exchangeGuid))
            {
                aduser = ((IRecipientSession)session).FindByExchangeGuidIncludingAlternate <ADUser>(exchangeGuid);
            }
            else if (ConsumerMailboxIdParameter.TryParseWindowsLiveId(base.RawIdentity, out windowsLiveId))
            {
                if (windowsLiveId.NetId != null)
                {
                    aduser = ((IRecipientSession)session).FindByExchangeGuidIncludingAlternate <ADUser>(ConsumerIdentityHelper.GetExchangeGuidFromPuid(windowsLiveId.NetId.ToUInt64()));
                }
                else
                {
                    aduser = ((IRecipientSession)session).FindByProxyAddress <ADUser>(new SmtpProxyAddress(windowsLiveId.SmtpAddress.ToString(), true));
                }
            }
            else if (base.InternalADObjectId != null)
            {
                aduser = ((IRecipientSession)session).FindADUserByObjectId(base.InternalADObjectId);
            }
            if (aduser != null)
            {
                list.Add(aduser);
            }
            return(list as IEnumerable <T>);
        }
コード例 #16
0
        private ADRawEntry GetADRawEntry(ulong puid, string emailAddress)
        {
            ADRawEntry result;

            try
            {
                List <ADPropertyDefinition> properties = new List <ADPropertyDefinition>(new ADPropertyDefinition[]
                {
                    ADMailboxRecipientSchema.ExchangeGuid,
                    ADUserSchema.NetID,
                    ADMailboxRecipientSchema.Database,
                    ADUserSchema.PrimaryMailboxSource,
                    ADUserSchema.SatchmoClusterIp,
                    ADUserSchema.SatchmoDGroup,
                    ADUserSchema.FblEnabled
                });
                ADRawEntry adrawEntry = this.tenantRecipientSession.FindByExchangeGuid(ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid), properties) ?? this.tenantRecipientSession.FindByProxyAddress(ProxyAddress.Parse(emailAddress), properties);
                FBLPerfCounters.NumberOfSuccessfulMSERVReadRequests.Increment();
                result = adrawEntry;
            }
            catch (Exception ex)
            {
                FBLPerfCounters.NumberOfFailedMSERVReadRequests.Increment();
                LoggingUtilities.LogEvent(ClientsEventLogConstants.Tuple_TransientFblErrorReadingMServ, new object[]
                {
                    ex.InnerException ?? ex
                });
                throw;
            }
            return(result);
        }
コード例 #17
0
        private ADUser GetADUser(ulong puid, string emailAddress)
        {
            ADUser result;

            try
            {
                ADUser aduser = ((ADUser)this.tenantRecipientSession.FindByObjectGuid(ConsumerIdentityHelper.GetExchangeGuidFromPuid(puid))) ?? this.tenantRecipientSession.FindByProxyAddress <ADUser>(ProxyAddress.Parse(emailAddress));
                FBLPerfCounters.NumberOfSuccessfulMSERVReadRequests.Increment();
                result = aduser;
            }
            catch (Exception ex)
            {
                FBLPerfCounters.NumberOfFailedMSERVReadRequests.Increment();
                LoggingUtilities.LogEvent(ClientsEventLogConstants.Tuple_TransientFblErrorReadingMServ, new object[]
                {
                    ex.InnerException ?? ex
                });
                throw;
            }
            return(result);
        }
コード例 #18
0
        // Token: 0x06000EFF RID: 3839 RVA: 0x000484C4 File Offset: 0x000466C4
        private ADRawEntry ADRawEntryFromMservRecords(ulong puid, IList <MservRecord> mservRecords, IEnumerable <MServPropertyDefinition> properties, string originatingServerName, List <ValidationError> errors)
        {
            ADObjectId    adobjectIdFromPuid = ConsumerIdentityHelper.GetADObjectIdFromPuid(puid);
            ADPropertyBag adpropertyBag      = new ADPropertyBag(this.isReadOnly, 16);

            adpropertyBag.SetField(ADObjectSchema.Id, adobjectIdFromPuid);
            adpropertyBag.SetField(MServRecipientSchema.Puid, puid);
            foreach (MservRecord mservRecord in mservRecords)
            {
                object value = mservRecord;
                ProviderPropertyDefinition providerPropertyDefinition;
                switch (mservRecord.ResourceId)
                {
                case 0:
                    if (mservRecord.SourceKey == null)
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservPrimaryRecord;
                    }
                    else
                    {
                        providerPropertyDefinition = MServRecipientSchema.MservEmailAddressesRecord;
                        value = new MultiValuedProperty <MservRecord>
                        {
                            mservRecord
                        };
                    }
                    break;

                case 1:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedPrimaryRecord;
                    break;

                case 2:
                case 3:
                case 5:
                case 6:
                    goto IL_D0;

                case 4:
                    providerPropertyDefinition = MServRecipientSchema.MservCalendarRecord;
                    break;

                case 7:
                    providerPropertyDefinition = MServRecipientSchema.MservSecondaryRecord;
                    break;

                case 8:
                    providerPropertyDefinition = MServRecipientSchema.MservSoftDeletedCalendarRecord;
                    break;

                default:
                    goto IL_D0;
                }
                PropertyValidationError propertyValidationError = providerPropertyDefinition.ValidateValue(value, true);
                if (propertyValidationError != null)
                {
                    errors.Add(propertyValidationError);
                }
                adpropertyBag.SetField(providerPropertyDefinition, value);
                continue;
IL_D0:
                throw new NotSupportedException("Unexpected record received:" + mservRecord.ToString());
            }
            ADRawEntry adrawEntry = new ADRawEntry(adpropertyBag);

            adrawEntry.OriginatingServer = originatingServerName;
            adrawEntry.WhenReadUTC       = new DateTime?(DateTime.UtcNow);
            adrawEntry.IsCached          = false;
            adrawEntry.ValidateRead(errors, properties);
            adrawEntry.ResetChangeTracking(true);
            return(adrawEntry);
        }
コード例 #19
0
        private static object LegacyExchangeDNGetter(IPropertyBag propertyBag)
        {
            ulong puid = (ulong)propertyBag[MServRecipientSchema.Puid];

            return(ConsumerIdentityHelper.GetLegacyExchangeDNFromPuid(puid));
        }