コード例 #1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            ADSystemAttendantMailbox adsystemAttendantMailbox = null;
            Server             server             = null;
            SecurityIdentifier sid                = this.exs.Sid;
            SecurityIdentifier securityIdentifier = new SecurityIdentifier("SY");

            try
            {
                server = ((ITopologyConfigurationSession)this.configurationSession).FindLocalServer();
            }
            catch (LocalServerNotFoundException ex)
            {
                base.WriteError(new CouldNotFindExchangeServerDirectoryEntryException(ex.Fqdn), ErrorCategory.InvalidData, null);
            }
            if (server != null)
            {
                base.LogReadObject(server);
                this.recipientSession.DomainController = server.OriginatingServer;
                ADRecipient[] array = this.recipientSession.Find(server.Id.GetChildId("Microsoft System Attendant"), QueryScope.Base, null, null, 1);
                if (array.Length > 0)
                {
                    adsystemAttendantMailbox = (array[0] as ADSystemAttendantMailbox);
                }
            }
            if (adsystemAttendantMailbox != null)
            {
                base.LogReadObject(adsystemAttendantMailbox);
                GenericAce[] aces = new GenericAce[]
                {
                    new CommonAce(AceFlags.None, AceQualifier.AccessAllowed, 131073, securityIdentifier, false, null)
                };
                DirectoryCommon.SetAclOnAlternateProperty(adsystemAttendantMailbox, aces, ADSystemAttendantMailboxSchema.ExchangeSecurityDescriptor);
                if (base.ShouldProcess(adsystemAttendantMailbox.DistinguishedName, Strings.InfoProcessAction(securityIdentifier.ToString()), null))
                {
                    this.recipientSession.Save(adsystemAttendantMailbox);
                }
            }
            TaskLogger.LogExit();
        }
コード例 #2
0
 // Token: 0x06000A62 RID: 2658 RVA: 0x000229E2 File Offset: 0x00020BE2
 public GeneralMailboxIdParameter(ADSystemAttendantMailbox systemAttendant) : this(systemAttendant.Id)
 {
 }
コード例 #3
0
        // Token: 0x06000154 RID: 340 RVA: 0x000067F4 File Offset: 0x000049F4
        private void Initialize(Guid guid, string databaseName, string databaseLegacyDN, bool isPublic)
        {
            this.guid = guid;
            this.systemMailboxName = "SystemMailbox{" + this.guid + "}";
            this.databaseName      = databaseName;
            this.isPublic          = isPublic;
            this.displayName       = string.Concat(new object[]
            {
                this.databaseName,
                " (",
                this.guid,
                ")"
            });
            Exception ex = null;

            if (!this.isPublic)
            {
                try
                {
                    this.systemMailboxPrincipal = ExchangePrincipal.FromADSystemMailbox(ADSessionSettings.FromRootOrgScopeSet(), this.FindSystemMailbox(), LocalServer.GetServer());
                }
                catch (DataValidationException ex2)
                {
                    ex = ex2;
                }
                catch (ObjectNotFoundException ex3)
                {
                    ex = ex3;
                }
                catch (ADExternalException ex4)
                {
                    ex = ex4;
                }
                if (ex != null)
                {
                    ExTraceGlobals.DatabaseInfoTracer.TraceError <DatabaseInfo, Exception>((long)this.GetHashCode(), "{0}: Unable to find valid system mailbox. Exception: {1}", this, ex);
                    throw new MissingSystemMailboxException(this.DisplayName, ex, base.Logger);
                }
                Guid guid2 = Guid.Empty;
                try
                {
                    ADSystemAttendantMailbox systemAttendant = this.GetSystemAttendant();
                    if (systemAttendant != null && systemAttendant.Database != null)
                    {
                        guid2 = systemAttendant.Database.ObjectGuid;
                        this.systemAttendantMailboxGuid = ((systemAttendant.ExchangeGuid == Guid.Empty) ? systemAttendant.Guid : systemAttendant.ExchangeGuid);
                        ExTraceGlobals.DatabaseInfoTracer.TraceDebug <DatabaseInfo, Guid, Guid>((long)this.GetHashCode(), "{0}: System Attendant Mailbox: Database GUID: {1}, Mailbox GUID: {2}", this, guid2, this.systemAttendantMailboxGuid);
                    }
                }
                catch (DataValidationException ex5)
                {
                    ex = ex5;
                }
                catch (ObjectNotFoundException ex6)
                {
                    ex = ex6;
                }
                if (ex != null)
                {
                    base.TracePfd("PFD AIS {0} {1}: System Attendant Mailbox: Database GUID: {2}, Mailbox GUID: {3}", new object[]
                    {
                        30551,
                        this,
                        ex
                    });
                    throw new MissingSystemMailboxException(this.DisplayName, ex, base.Logger);
                }
                this.systemAttendantMailboxPresent = (this.guid == guid2);
                ExTraceGlobals.DatabaseInfoTracer.TraceDebug <DatabaseInfo>((long)this.GetHashCode(), "{0}: Created database info", this);
            }
            base.TracePfd("PFD AIS {0} {1}: Created database info Sucessfully", new object[]
            {
                19287,
                this
            });
        }
コード例 #4
0
 public SystemAttendantMailboxPresentationObject(ADSystemAttendantMailbox dataObject) : base(dataObject)
 {
 }
コード例 #5
0
        // Token: 0x060003B5 RID: 949 RVA: 0x00015440 File Offset: 0x00013640
        internal static ADObject CreateAndInitializeRecipientObject <TRecipientObject>(ADPropertyBag propertyBag, ADRawEntry dummyObject, IRecipientSession recipientSession) where TRecipientObject : IConfigurable, new()
        {
            ArgumentValidator.ThrowIfNull("propertyBag", propertyBag);
            ArgumentValidator.ThrowIfNull("dummyObject", dummyObject);
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADObjectSchema.ObjectClass];
            ADObject adobject;

            if (dummyObject is OWAMiniRecipient)
            {
                adobject = new OWAMiniRecipient();
            }
            else if (dummyObject is ActiveSyncMiniRecipient)
            {
                adobject = new ActiveSyncMiniRecipient();
            }
            else if (dummyObject is StorageMiniRecipient)
            {
                adobject = new StorageMiniRecipient();
            }
            else if (dummyObject is TransportMiniRecipient)
            {
                adobject = new TransportMiniRecipient();
            }
            else if (dummyObject is LoadBalancingMiniRecipient)
            {
                adobject = new LoadBalancingMiniRecipient();
            }
            else if (dummyObject is MiniRecipientWithTokenGroups)
            {
                adobject = new MiniRecipientWithTokenGroups();
            }
            else if (dummyObject is FrontEndMiniRecipient)
            {
                adobject = new FrontEndMiniRecipient();
            }
            else if (dummyObject is MiniRecipient)
            {
                adobject = new MiniRecipient();
            }
            else if (dummyObject is RemovedMailbox)
            {
                adobject = new RemovedMailbox();
            }
            else if (dummyObject is DeletedRecipient)
            {
                adobject = new DeletedRecipient();
            }
            else if (multiValuedProperty.Contains(ADComputerRecipient.MostDerivedClass))
            {
                adobject = new ADComputerRecipient();
            }
            else if (multiValuedProperty.Contains(ADUser.MostDerivedClass))
            {
                adobject = new ADUser();
            }
            else if (multiValuedProperty.Contains(ADContact.MostDerivedClass))
            {
                adobject = new ADContact();
            }
            else if (multiValuedProperty.Contains(ADGroup.MostDerivedClass))
            {
                adobject = new ADGroup();
            }
            else if (multiValuedProperty.Contains(ADDynamicGroup.MostDerivedClass))
            {
                adobject = new ADDynamicGroup();
            }
            else if (multiValuedProperty.Contains(ADPublicFolder.MostDerivedClass))
            {
                adobject = new ADPublicFolder();
            }
            else if (multiValuedProperty.Contains(ADSystemAttendantMailbox.MostDerivedClass))
            {
                adobject = new ADSystemAttendantMailbox();
            }
            else if (multiValuedProperty.Contains(ADSystemMailbox.MostDerivedClass))
            {
                adobject = new ADSystemMailbox();
            }
            else if (multiValuedProperty.Contains(ADPublicDatabase.MostDerivedClass))
            {
                adobject = new ADPublicDatabase();
            }
            else
            {
                if (!multiValuedProperty.Contains(ADMicrosoftExchangeRecipient.MostDerivedClass))
                {
                    string objectClass = string.Empty;
                    foreach (string text in multiValuedProperty)
                    {
                        objectClass = text;
                    }
                    ObjectValidationError error = new ObjectValidationError(DirectoryStrings.UnsupportedObjectClass(objectClass), (ADObjectId)propertyBag[ADObjectSchema.Id], string.Empty);
                    ADProviderPerf.UpdateProcessCounter(Counter.ProcessRateCriticalValidationFailures, UpdateType.Update, 1U);
                    Globals.LogEvent(DirectoryEventLogConstants.Tuple_DSC_EVENT_VALIDATION_FAILED_FCO_MODE_RECIPIENT, ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToString(), new object[]
                    {
                        ((ADObjectId)propertyBag[ADObjectSchema.Id]).ToDNString()
                    });
                    throw new DataValidationException(error);
                }
                adobject = new ADMicrosoftExchangeRecipient();
            }
            adobject.m_Session   = recipientSession;
            adobject.propertyBag = propertyBag;
            adobject.Initialize();
            adobject.ResetChangeTracking(true);
            if (recipientSession != null)
            {
                adobject.SetIsReadOnly(recipientSession.ReadOnly);
            }
            ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, RecipientType>((long)((recipientSession != null) ? recipientSession.GetHashCode() : 0), "ADRecipientObjectSession::CreateObject - Got {0} as {1}", adobject.DistinguishedName, (RecipientType)adobject[ADRecipientSchema.RecipientType]);
            return(adobject);
        }
コード例 #6
0
 public LogonableObjectIdParameter(ADSystemAttendantMailbox systemAttendant) : base(systemAttendant)
 {
 }
コード例 #7
0
        protected void ResolveDatabaseAndServer()
        {
            DatabaseIdParameter databaseIdParameter   = this.Database;
            ServerIdParameter   serverIdParameter     = this.Server ?? new ServerIdParameter();
            ActiveManager       activeManagerInstance = ActiveManager.GetActiveManagerInstance();

            if (this.Identity != null)
            {
                bool flag = false;
                if (this.isRunningLogonStatisticsTask)
                {
                    TIdentity tidentity            = this.Identity;
                    IEnumerable <Database> objects = tidentity.GetObjects <Database>(null, base.GlobalConfigSession);
                    foreach (Database item in objects)
                    {
                        this.databases.Add(item);
                    }
                    if (this.databases.Count > 0)
                    {
                        if (this.databases[0].Server == null)
                        {
                            string    name       = typeof(Database).Name;
                            TIdentity tidentity2 = this.Identity;
                            base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(name, tidentity2.ToString(), DatabaseSchema.Server.Name)), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(this.databases[0].Guid);
                        serverIdParameter = ServerIdParameter.Parse(serverForDatabase.ServerFqdn);
                        if (string.IsNullOrEmpty(this.databases[0].ExchangeLegacyDN))
                        {
                            string    name2      = typeof(Database).Name;
                            TIdentity tidentity3 = this.Identity;
                            base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(name2, tidentity3.ToString(), DatabaseSchema.ExchangeLegacyDN.Name)), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        this.identity = new MailboxId(this.databases[0].ExchangeLegacyDN);
                        flag          = true;
                    }
                }
                if (!flag)
                {
                    IIdentityParameter  id            = this.Identity;
                    IConfigDataProvider session       = this.readOnlyRecipientSession;
                    ObjectId            rootID        = null;
                    TIdentity           tidentity4    = this.Identity;
                    LocalizedString?    notFoundError = new LocalizedString?(Strings.ErrorMailboxNotFound(tidentity4.ToString()));
                    TIdentity           tidentity5    = this.Identity;
                    ADRecipient         adrecipient   = (ADRecipient)base.GetDataObject <ADRecipient>(id, session, rootID, notFoundError, new LocalizedString?(Strings.ErrorMailboxNotUnique(tidentity5.ToString())));
                    Guid       guid = Guid.Empty;
                    string     mailboxExchangeLegacyDn = null;
                    ADObjectId adobjectId = null;
                    if (string.IsNullOrEmpty(adrecipient.LegacyExchangeDN))
                    {
                        string    name3      = typeof(ADRecipient).Name;
                        TIdentity tidentity6 = this.Identity;
                        base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(name3, tidentity6.ToString(), ADRecipientSchema.LegacyExchangeDN.Name)), ErrorCategory.InvalidArgument, this.Identity);
                    }
                    ADUser                   aduser                   = adrecipient as ADUser;
                    ADSystemMailbox          adsystemMailbox          = adrecipient as ADSystemMailbox;
                    ADSystemAttendantMailbox adsystemAttendantMailbox = adrecipient as ADSystemAttendantMailbox;
                    ADPublicDatabase         adpublicDatabase         = adrecipient as ADPublicDatabase;
                    if (aduser != null)
                    {
                        if (this.isRunningMailboxStatisticsTask && aduser.RecipientTypeDetails == RecipientTypeDetails.AuditLogMailbox && !this.GetAuditLogMailboxStatistics())
                        {
                            TIdentity tidentity7 = this.Identity;
                            base.WriteError(new MdbAdminTaskException(Strings.RecipientNotFoundException(tidentity7.ToString())), ErrorCategory.InvalidArgument, null);
                        }
                        bool archiveMailboxStatistics = this.GetArchiveMailboxStatistics();
                        if (aduser.RecipientType == RecipientType.MailUser && !archiveMailboxStatistics)
                        {
                            base.WriteError(new MdbAdminTaskException(Strings.RecipientTypeNotValid(aduser.ToString())), (ErrorCategory)1003, this.Identity);
                        }
                        RecipientIdParameter recipientIdParameter = this.Identity as RecipientIdParameter;
                        if (this.isRunningMailboxStatisticsTask && recipientIdParameter != null && recipientIdParameter.RawMailboxGuidInvolvedInSearch != Guid.Empty && aduser.MailboxLocations != null)
                        {
                            IMailboxLocationInfo mailboxLocation = aduser.MailboxLocations.GetMailboxLocation(recipientIdParameter.RawMailboxGuidInvolvedInSearch);
                            if (mailboxLocation != null)
                            {
                                guid       = mailboxLocation.MailboxGuid;
                                adobjectId = mailboxLocation.DatabaseLocation;
                            }
                        }
                        if (guid == Guid.Empty || adobjectId == null)
                        {
                            if (archiveMailboxStatistics)
                            {
                                if (aduser.ArchiveGuid != Guid.Empty)
                                {
                                    if (aduser.ArchiveDomain != null)
                                    {
                                        base.WriteError(new MdbAdminTaskException(Strings.ErrorRemoteArchiveNoStats(aduser.ToString())), (ErrorCategory)1003, this.Identity);
                                    }
                                    else
                                    {
                                        guid       = aduser.ArchiveGuid;
                                        adobjectId = (aduser.ArchiveDatabase ?? aduser.Database);
                                    }
                                }
                                else
                                {
                                    base.WriteError(new MdbAdminTaskException(Strings.ErrorArchiveNotEnabled(aduser.ToString())), ErrorCategory.InvalidArgument, this.Identity);
                                }
                            }
                            else
                            {
                                guid       = aduser.ExchangeGuid;
                                adobjectId = aduser.Database;
                            }
                        }
                        mailboxExchangeLegacyDn = aduser.LegacyExchangeDN;
                    }
                    else if (adsystemMailbox != null)
                    {
                        guid = adsystemMailbox.ExchangeGuid;
                        mailboxExchangeLegacyDn = adsystemMailbox.LegacyExchangeDN;
                        adobjectId = adsystemMailbox.Database;
                    }
                    else if (adsystemAttendantMailbox != null)
                    {
                        guid = adsystemAttendantMailbox.Guid;
                        mailboxExchangeLegacyDn = adsystemAttendantMailbox.LegacyExchangeDN;
                        adobjectId = adsystemAttendantMailbox.Database;
                    }
                    else if (adpublicDatabase != null)
                    {
                        mailboxExchangeLegacyDn = adpublicDatabase.LegacyExchangeDN;
                        adobjectId = (ADObjectId)adpublicDatabase.Identity;
                    }
                    if (adobjectId == null)
                    {
                        string    name4      = adrecipient.GetType().Name;
                        TIdentity tidentity8 = this.Identity;
                        base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(name4, tidentity8.ToString(), IADMailStorageSchema.Database.Name)), ErrorCategory.InvalidArgument, adrecipient);
                    }
                    databaseIdParameter = new DatabaseIdParameter(adobjectId);
                    if (this.isRunningLogonStatisticsTask)
                    {
                        this.identity = new MailboxId(mailboxExchangeLegacyDn);
                    }
                    else
                    {
                        this.identity = new MailboxId(MapiTaskHelper.ConvertDatabaseADObjectIdToDatabaseId(adobjectId), guid);
                    }
                }
            }
            if (databaseIdParameter != null)
            {
                databaseIdParameter.AllowLegacy = true;
                LocalizedString empty  = LocalizedString.Empty;
                LocalizedString empty2 = LocalizedString.Empty;
                Database        database;
                if (this.isRunningLogonStatisticsTask)
                {
                    database = (Database)base.GetDataObject <Database>(databaseIdParameter, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(databaseIdParameter.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(databaseIdParameter.ToString())));
                }
                else
                {
                    database = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(databaseIdParameter, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(databaseIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(databaseIdParameter.ToString())));
                }
                if (database.Server == null)
                {
                    base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(this.isRunningLogonStatisticsTask ? typeof(Database).Name : typeof(MailboxDatabase).Name, databaseIdParameter.ToString(), DatabaseSchema.Server.Name)), ErrorCategory.InvalidArgument, database);
                }
                this.databases = new List <Database>(new Database[]
                {
                    database
                });
                if (this.CopyOnServer != null)
                {
                    serverIdParameter = this.CopyOnServer;
                }
                else
                {
                    DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(database.Guid);
                    serverIdParameter = ServerIdParameter.Parse(serverForDatabase.ServerFqdn);
                }
            }
            if (this.Server != null)
            {
                serverIdParameter = this.Server;
                this.server       = MapiTaskHelper.GetMailboxServer(this.Server, base.GlobalConfigSession, new Task.ErrorLoggerDelegate(base.WriteError));
            }
            else
            {
                this.server = (Server)base.GetDataObject <Server>(serverIdParameter, base.GlobalConfigSession, null, new LocalizedString?((this.Identity == null && this.Database == null) ? Strings.ErrorLocalMachineIsNotExchangeServer : Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString())));
                if (!this.server.IsExchange2007OrLater || !this.server.IsMailboxServer)
                {
                    if (this.Identity != null)
                    {
                        TIdentity tidentity9 = this.Identity;
                        base.WriteError(new MdbAdminTaskException(Strings.ErrorMailboxInNonMailboxServer(tidentity9.ToString())), ErrorCategory.InvalidArgument, this.server);
                    }
                    if (this.Database != null)
                    {
                        base.WriteError(new MdbAdminTaskException(Strings.ErrorDatabaseInNonMailboxServer(this.Database.ToString())), ErrorCategory.InvalidArgument, this.server);
                    }
                    base.WriteError(new MdbAdminTaskException(Strings.ErrorLocalServerIsNotMailboxServer), ErrorCategory.InvalidArgument, this.server);
                }
            }
            if (string.IsNullOrEmpty(this.server.ExchangeLegacyDN))
            {
                base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Server).Name, serverIdParameter.ToString(), ServerSchema.ExchangeLegacyDN.Name)), ErrorCategory.InvalidArgument, this.Identity);
            }
            if (this.databases.Count == 0)
            {
                if (this.isRunningLogonStatisticsTask)
                {
                    this.FilterActiveDatabases(activeManagerInstance, this.server.GetDatabases());
                    return;
                }
                this.FilterActiveDatabases(activeManagerInstance, this.server.GetMailboxDatabases());
            }
        }