Ejemplo n.º 1
0
        private void InternalConfigureProviders(bool continueAfterConfiguringProviders)
        {
            RequestStatisticsBase cachedRequestJob = base.CachedRequestJob;
            bool flag = cachedRequestJob.RequestStyle == RequestStyle.CrossOrg;
            LocalMailboxFlags localMailboxFlags = LocalMailboxFlags.LegacyPublicFolders | LocalMailboxFlags.ParallelPublicFolderMigration;

            if (flag)
            {
                localMailboxFlags |= LocalMailboxFlags.PureMAPI;
            }
            this.sourceDatabases = new MapiSourceMailbox(localMailboxFlags);
            if (flag)
            {
                this.sourceDatabases.ConfigRPCHTTP(cachedRequestJob.RemoteMailboxLegacyDN, null, cachedRequestJob.RemoteMailboxServerLegacyDN, cachedRequestJob.OutlookAnywhereHostName, cachedRequestJob.RemoteCredential, true, cachedRequestJob.AuthenticationMethod != null && cachedRequestJob.AuthenticationMethod.Value == AuthenticationMethod.Ntlm);
            }
            else
            {
                ((IMailbox)this.sourceDatabases).Config(base.GetReservation(cachedRequestJob.SourceDatabase.ObjectGuid, ReservationFlags.Read), cachedRequestJob.SourceDatabase.ObjectGuid, cachedRequestJob.SourceDatabase.ObjectGuid, CommonUtils.GetPartitionHint(cachedRequestJob.OrganizationId), cachedRequestJob.SourceDatabase.ObjectGuid, MailboxType.SourceMailbox, null);
            }
            LocalizedString tracingId = flag ? MrsStrings.RPCHTTPPublicFoldersId(cachedRequestJob.RemoteMailboxLegacyDN) : MrsStrings.PublicFoldersId(cachedRequestJob.OrganizationId.ToString());

            this.sourceDatabases.ConfigPublicFolders(cachedRequestJob.SourceDatabase);
            this.SourceDatabasesWrapper = new SourceMailboxWrapper(this.sourceDatabases, MailboxWrapperFlags.Source, tracingId);
            this.publicFolderMailboxMigrator.SetSourceDatabasesWrapper(this.SourceDatabasesWrapper);
            base.ConfigureProviders(continueAfterConfiguringProviders);
            if (flag)
            {
                this.publicFolderMailboxMigrator.ConfigTranslators(new PrincipalTranslator(this.SourceDatabasesWrapper.PrincipalMapper, this.publicFolderMailboxMigrator.DestMailboxWrapper.PrincipalMapper), null);
            }
        }
Ejemplo n.º 2
0
 public ProxyServerSettings(string fqdn, LocalMailboxFlags extraFlags, ProxyScenarios proxyScenario)
 {
     this            = default(ProxyServerSettings);
     this.Fqdn       = fqdn;
     this.ExtraFlags = extraFlags;
     this.Scenario   = proxyScenario;
 }
        private void InternalConfigureProviders(bool continueAfterConfiguringProviders)
        {
            if (this.publicFolderConfiguration.GetHierarchyMailboxInformation().Type != PublicFolderInformation.HierarchyType.InTransitMailboxGuid)
            {
                throw new PublicFolderMailboxesNotProvisionedForMigrationException();
            }
            RequestStatisticsBase cachedRequestJob = base.CachedRequestJob;
            bool flag = cachedRequestJob.RequestStyle == RequestStyle.CrossOrg;
            LocalMailboxFlags localMailboxFlags = LocalMailboxFlags.LegacyPublicFolders;

            if (flag)
            {
                localMailboxFlags |= LocalMailboxFlags.PureMAPI;
            }
            this.sourceDatabases = new MapiSourceMailbox(localMailboxFlags);
            if (flag)
            {
                this.sourceDatabases.ConfigRPCHTTP(cachedRequestJob.RemoteMailboxLegacyDN, null, cachedRequestJob.RemoteMailboxServerLegacyDN, cachedRequestJob.OutlookAnywhereHostName, cachedRequestJob.RemoteCredential, true, cachedRequestJob.AuthenticationMethod != null && cachedRequestJob.AuthenticationMethod.Value == AuthenticationMethod.Ntlm);
            }
            else
            {
                ((IMailbox)this.sourceDatabases).Config(base.GetReservation(cachedRequestJob.SourceDatabase.ObjectGuid, ReservationFlags.Read), cachedRequestJob.SourceDatabase.ObjectGuid, cachedRequestJob.SourceDatabase.ObjectGuid, CommonUtils.GetPartitionHint(cachedRequestJob.OrganizationId), cachedRequestJob.SourceDatabase.ObjectGuid, MailboxType.SourceMailbox, null);
            }
            LocalizedString tracingId = flag ? MrsStrings.RPCHTTPPublicFoldersId(cachedRequestJob.RemoteMailboxLegacyDN) : MrsStrings.PublicFoldersId(cachedRequestJob.OrganizationId.ToString());

            this.sourceDatabases.ConfigPublicFolders(cachedRequestJob.SourceDatabase);
            this.SourceDatabasesWrapper = new SourceMailboxWrapper(this.sourceDatabases, MailboxWrapperFlags.Source, tracingId);
            foreach (MailboxCopierBase mailboxCopierBase in this.GetAllCopiers())
            {
                PublicFolderMigrator publicFolderMigrator = (PublicFolderMigrator)mailboxCopierBase;
                publicFolderMigrator.SetSourceDatabasesWrapper(this.SourceDatabasesWrapper);
            }
            base.ConfigureProviders(continueAfterConfiguringProviders);
            MailboxCopierBase rootMailboxContext = base.GetRootMailboxContext();

            foreach (MailboxCopierBase mailboxCopierBase2 in this.GetAllCopiers())
            {
                PublicFolderMigrator publicFolderMigrator2 = (PublicFolderMigrator)mailboxCopierBase2;
                if (!publicFolderMigrator2.IsRoot)
                {
                    publicFolderMigrator2.SetHierarchyMailbox(rootMailboxContext.DestMailbox);
                }
                if (flag)
                {
                    publicFolderMigrator2.ConfigTranslators(new PrincipalTranslator(this.SourceDatabasesWrapper.PrincipalMapper, publicFolderMigrator2.DestMailboxWrapper.PrincipalMapper), null);
                }
            }
        }
 public MapiDestinationMailbox(LocalMailboxFlags flags) : base(flags)
 {
 }
Ejemplo n.º 5
0
        public RemoteMailbox(string serverName, string remoteOrgName, NetworkCredential remoteCred, ProxyControlFlags proxyControlFlags, IEnumerable <MRSProxyCapabilities> requiredCapabilities, bool useHttps, LocalMailboxFlags flags) : base(null, 0L)
        {
            this.serverName           = serverName;
            this.remoteOrgName        = remoteOrgName;
            this.remoteCred           = remoteCred;
            this.proxyControlFlags    = proxyControlFlags;
            this.requiredCapabilities = requiredCapabilities;
            this.useHttps             = useHttps;
            this.flags = flags;
            TestIntegration.Instance.ForceRefresh();
            this.longOperationTimeout = ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("MRSProxyLongOperationTimeout");

            this.ExportBufferSizeKB = ConfigBase <MRSConfigSchema> .GetConfig <int>("ExportBufferSizeKB");
        }
Ejemplo n.º 6
0
        public override void ConfigureProviders()
        {
            base.ConfigureProviders();
            RequestStatisticsBase       cachedRequestJob  = base.MRSJob.CachedRequestJob;
            LocalMailboxFlags           localMailboxFlags = LocalMailboxFlags.Move;
            List <MRSProxyCapabilities> list = new List <MRSProxyCapabilities>();

            if (cachedRequestJob.IgnoreRuleLimitErrors)
            {
                localMailboxFlags |= LocalMailboxFlags.StripLargeRulesForDownlevelTargets;
            }
            if (cachedRequestJob.IsSplitPrimaryAndArchive)
            {
                list.Add(MRSProxyCapabilities.ArchiveSeparation);
            }
            if (cachedRequestJob.TargetContainerGuid != null)
            {
                list.Add(MRSProxyCapabilities.ContainerOperations);
            }
            LocalMailboxFlags localMailboxFlags2 = LocalMailboxFlags.Move;

            if (base.Flags.HasFlag(MailboxCopierFlags.ContainerAggregated))
            {
                localMailboxFlags  |= LocalMailboxFlags.AggregatedMailbox;
                localMailboxFlags2 |= LocalMailboxFlags.AggregatedMailbox;
            }
            if (cachedRequestJob.RequestType == MRSRequestType.Move && base.IsRoot && base.IsPrimary && base.TargetMailboxContainerGuid != null)
            {
                localMailboxFlags2 |= LocalMailboxFlags.CreateNewPartition;
            }
            ADObjectId adobjectId = base.IsRoot ? cachedRequestJob.SourceDatabase : cachedRequestJob.SourceArchiveDatabase;

            if (base.Flags.HasFlag(MailboxCopierFlags.SourceIsArchive) && cachedRequestJob.JobType >= MRSJobType.RequestJobE14R5_PrimaryOrArchiveExclusiveMoves)
            {
                MrsTracer.Service.Debug("Overwriting archive guid in Archive MailboxMover...", new object[0]);
                ADObjectId adobjectId2;
                if ((adobjectId2 = cachedRequestJob.SourceArchiveDatabase) == null)
                {
                    adobjectId2 = new ADObjectId(cachedRequestJob.RemoteArchiveDatabaseGuid ?? Guid.Empty);
                }
                adobjectId         = adobjectId2;
                base.SourceMdbGuid = adobjectId.ObjectGuid;
                base.DestMdbGuid   = ((cachedRequestJob.TargetArchiveDatabase != null) ? cachedRequestJob.TargetArchiveDatabase.ObjectGuid : (cachedRequestJob.RemoteArchiveDatabaseGuid ?? Guid.Empty));
            }
            ISourceMailbox      sourceMailbox      = this.GetSourceMailbox(adobjectId, localMailboxFlags, list);
            IDestinationMailbox destinationMailbox = this.GetDestinationMailbox(base.DestMdbGuid, localMailboxFlags2, list);

            if (cachedRequestJob.RequestStyle == RequestStyle.CrossOrg && (cachedRequestJob.Flags & RequestFlags.RemoteLegacy) != RequestFlags.None)
            {
                if (cachedRequestJob.Direction == RequestDirection.Push)
                {
                    destinationMailbox.ConfigADConnection(cachedRequestJob.TargetDCName, cachedRequestJob.TargetDCName, cachedRequestJob.TargetCredential);
                }
                else
                {
                    sourceMailbox.ConfigADConnection(cachedRequestJob.SourceDCName, cachedRequestJob.SourceDCName, cachedRequestJob.SourceCredential);
                }
            }
            TenantPartitionHint partitionHint  = (cachedRequestJob.SourceIsLocal || cachedRequestJob.CrossResourceForest) ? this.partitionHintToUse : null;
            TenantPartitionHint partitionHint2 = (cachedRequestJob.TargetIsLocal || cachedRequestJob.CrossResourceForest) ? this.partitionHintToUse : null;

            if (base.MRSJob.TestIntegration.RemoteExchangeGuidOverride != Guid.Empty)
            {
                if (!cachedRequestJob.SourceIsLocal)
                {
                    partitionHint = this.partitionHintToUse;
                }
                if (!cachedRequestJob.TargetIsLocal)
                {
                    partitionHint2 = this.partitionHintToUse;
                }
            }
            Guid primaryMailboxGuid = base.Flags.HasFlag(MailboxCopierFlags.ContainerOrg) ? base.SourceMailboxGuid : cachedRequestJob.ExchangeGuid;

            sourceMailbox.Config(base.MRSJob.GetReservation(base.SourceMdbGuid, ReservationFlags.Read), primaryMailboxGuid, base.SourceMailboxGuid, partitionHint, base.SourceMdbGuid, MailboxType.SourceMailbox, null);
            destinationMailbox.Config(base.MRSJob.GetReservation(base.DestMdbGuid, ReservationFlags.Write), primaryMailboxGuid, base.TargetMailboxGuid, partitionHint2, base.DestMdbGuid, (cachedRequestJob.RequestStyle == RequestStyle.CrossOrg) ? MailboxType.DestMailboxCrossOrg : MailboxType.DestMailboxIntraOrg, base.TargetMailboxContainerGuid);
            base.Config(sourceMailbox, destinationMailbox);
        }
Ejemplo n.º 7
0
        public override void ConfigureProviders()
        {
            base.ConfigureProviders();
            RequestStatisticsBase cachedRequestJob   = base.MRSJob.CachedRequestJob;
            LocalMailboxFlags     localMailboxFlags  = LocalMailboxFlags.None;
            LocalMailboxFlags     localMailboxFlags2 = LocalMailboxFlags.None;

            if (cachedRequestJob.RequestType != MRSRequestType.MailboxRestore && cachedRequestJob.IgnoreRuleLimitErrors)
            {
                localMailboxFlags |= LocalMailboxFlags.StripLargeRulesForDownlevelTargets;
            }
            if (cachedRequestJob.OrganizationId == null)
            {
                OrganizationId forestWideOrgId = OrganizationId.ForestWideOrgId;
            }
            switch (cachedRequestJob.RequestType)
            {
            case MRSRequestType.Merge:
                if (cachedRequestJob.SourceIsLocal)
                {
                    localMailboxFlags |= LocalMailboxFlags.UseHomeMDB;
                }
                else
                {
                    localMailboxFlags |= LocalMailboxFlags.PureMAPI;
                }
                if (cachedRequestJob.TargetIsLocal)
                {
                    localMailboxFlags2 |= LocalMailboxFlags.UseHomeMDB;
                }
                else
                {
                    localMailboxFlags2 |= LocalMailboxFlags.PureMAPI;
                }
                break;

            case MRSRequestType.MailboxImport:
                localMailboxFlags2 |= LocalMailboxFlags.UseHomeMDB;
                break;

            case MRSRequestType.MailboxExport:
                localMailboxFlags |= LocalMailboxFlags.UseHomeMDB;
                break;

            case MRSRequestType.MailboxRestore:
                localMailboxFlags2 |= LocalMailboxFlags.UseHomeMDB;
                localMailboxFlags  |= LocalMailboxFlags.Restore;
                break;

            case MRSRequestType.Sync:
                localMailboxFlags2 |= LocalMailboxFlags.UseHomeMDB;
                if (cachedRequestJob.Flags.HasFlag(RequestFlags.TargetIsAggregatedMailbox))
                {
                    localMailboxFlags2 |= LocalMailboxFlags.AggregatedMailbox;
                }
                if (cachedRequestJob.SyncProtocol == SyncProtocol.Olc)
                {
                    localMailboxFlags2 |= LocalMailboxFlags.OlcSync;
                }
                break;
            }
            ISourceMailbox      sourceMailbox      = null;
            IDestinationMailbox destinationMailbox = null;

            switch (cachedRequestJob.RequestType)
            {
            case MRSRequestType.Merge:
            case MRSRequestType.MailboxExport:
            case MRSRequestType.MailboxRestore:
            {
                Guid primaryMailboxGuid = base.SourceMailboxGuid;
                Guid guid = cachedRequestJob.SourceMDBGuid;
                if (cachedRequestJob.SourceUser != null)
                {
                    primaryMailboxGuid = cachedRequestJob.SourceUser.ExchangeGuid;
                    if (localMailboxFlags.HasFlag(LocalMailboxFlags.UseHomeMDB))
                    {
                        ADObjectId adobjectId = cachedRequestJob.SourceIsArchive ? cachedRequestJob.SourceUser.ArchiveDatabase : cachedRequestJob.SourceUser.Database;
                        if (adobjectId != null)
                        {
                            guid = adobjectId.ObjectGuid;
                        }
                    }
                }
                sourceMailbox = this.GetSourceMailbox(new ADObjectId(guid, PartitionId.LocalForest.ForestFQDN), localMailboxFlags, null);
                sourceMailbox.Config(base.MRSJob.GetReservation(cachedRequestJob.SourceMDBGuid, ReservationFlags.Read), primaryMailboxGuid, base.SourceMailboxGuid, CommonUtils.GetPartitionHint(cachedRequestJob.OrganizationId), guid, MailboxType.SourceMailbox, null);
                if (cachedRequestJob.RequestType == MRSRequestType.MailboxRestore)
                {
                    sourceMailbox.ConfigRestore((cachedRequestJob.MailboxRestoreFlags != null) ? cachedRequestJob.MailboxRestoreFlags.Value : MailboxRestoreType.None);
                }
                break;
            }

            case MRSRequestType.MailboxImport:
                sourceMailbox = this.GetSourceMailbox(new ADObjectId(Guid.Empty), localMailboxFlags, null);
                sourceMailbox.ConfigPst(cachedRequestJob.FilePath, cachedRequestJob.ContentCodePage);
                break;

            case MRSRequestType.Sync:
            {
                sourceMailbox = this.GetSourceMailbox(new ADObjectId(Guid.Empty), localMailboxFlags, null);
                SyncProtocol syncProtocol = cachedRequestJob.SyncProtocol;
                if (syncProtocol == SyncProtocol.Eas)
                {
                    sourceMailbox.ConfigEas(cachedRequestJob.RemoteCredential, cachedRequestJob.EmailAddress, cachedRequestJob.TargetExchangeGuid, cachedRequestJob.SourceServer);
                }
                break;
            }
            }
            switch (cachedRequestJob.RequestType)
            {
            case MRSRequestType.Merge:
            case MRSRequestType.MailboxImport:
            case MRSRequestType.MailboxRestore:
            case MRSRequestType.Sync:
            {
                Guid primaryMailboxGuid2 = base.TargetMailboxGuid;
                Guid mdbGuid             = cachedRequestJob.TargetMDBGuid;
                if (cachedRequestJob.TargetUser != null)
                {
                    primaryMailboxGuid2 = cachedRequestJob.TargetUser.ExchangeGuid;
                    ADObjectId adobjectId2 = cachedRequestJob.TargetIsArchive ? cachedRequestJob.TargetUser.ArchiveDatabase : cachedRequestJob.TargetUser.Database;
                    if (adobjectId2 != null)
                    {
                        mdbGuid = adobjectId2.ObjectGuid;
                    }
                }
                destinationMailbox = this.GetDestinationMailbox(mdbGuid, localMailboxFlags2, null);
                if (cachedRequestJob.RequestType == MRSRequestType.Sync && localMailboxFlags2.HasFlag(LocalMailboxFlags.AggregatedMailbox) && !string.IsNullOrEmpty(cachedRequestJob.DomainControllerToUpdate))
                {
                    destinationMailbox.ConfigPreferredADConnection(cachedRequestJob.DomainControllerToUpdate);
                }
                destinationMailbox.Config(base.MRSJob.GetReservation(cachedRequestJob.TargetMDBGuid, ReservationFlags.Write), primaryMailboxGuid2, base.TargetMailboxGuid, CommonUtils.GetPartitionHint(cachedRequestJob.OrganizationId), mdbGuid, cachedRequestJob.TargetIsLocal ? MailboxType.DestMailboxIntraOrg : MailboxType.DestMailboxCrossOrg, null);
                if (cachedRequestJob.IsPublicFolderMailboxRestore && cachedRequestJob.RequestType == MRSRequestType.MailboxRestore)
                {
                    MailboxRestoreType restoreFlags = (cachedRequestJob.MailboxRestoreFlags != null) ? (cachedRequestJob.MailboxRestoreFlags.Value & ~MailboxRestoreType.Recovery) : MailboxRestoreType.None;
                    destinationMailbox.ConfigRestore(restoreFlags);
                }
                break;
            }

            case MRSRequestType.MailboxExport:
                destinationMailbox = this.GetDestinationMailbox(Guid.Empty, localMailboxFlags2, null);
                destinationMailbox.ConfigPst(cachedRequestJob.FilePath, null);
                destinationMailbox.Config(null, Guid.Empty, Guid.Empty, cachedRequestJob.PartitionHint, Guid.Empty, cachedRequestJob.TargetIsLocal ? MailboxType.DestMailboxIntraOrg : MailboxType.DestMailboxCrossOrg, null);
                break;
            }
            if (cachedRequestJob.RequestType == MRSRequestType.Merge && cachedRequestJob.RequestStyle == RequestStyle.CrossOrg)
            {
                bool credentialIsAdmin = cachedRequestJob.IsAdministrativeCredential == null || cachedRequestJob.IsAdministrativeCredential.Value;
                bool useNTLMAuth       = cachedRequestJob.AuthenticationMethod != null && cachedRequestJob.AuthenticationMethod.Value == AuthenticationMethod.Ntlm;
                if (cachedRequestJob.Direction == RequestDirection.Pull)
                {
                    ((MapiSourceMailbox)sourceMailbox).ConfigRPCHTTP(cachedRequestJob.RemoteMailboxLegacyDN, cachedRequestJob.RemoteUserLegacyDN, cachedRequestJob.RemoteMailboxServerLegacyDN, cachedRequestJob.OutlookAnywhereHostName, cachedRequestJob.RemoteCredential, credentialIsAdmin, useNTLMAuth);
                }
                else
                {
                    ((MapiDestinationMailbox)destinationMailbox).ConfigRPCHTTP(cachedRequestJob.RemoteMailboxLegacyDN, cachedRequestJob.RemoteUserLegacyDN, cachedRequestJob.RemoteMailboxServerLegacyDN, cachedRequestJob.OutlookAnywhereHostName, cachedRequestJob.RemoteCredential, credentialIsAdmin, useNTLMAuth);
                }
            }
            base.Config(sourceMailbox, destinationMailbox);
            FolderHierarchyFlags folderHierarchyFlags = FolderHierarchyFlags.None;

            if (cachedRequestJob.IsPublicFolderMailboxRestore)
            {
                folderHierarchyFlags |= FolderHierarchyFlags.PublicFolderMailbox;
            }
            this.SourceHierarchy = new FolderHierarchy(folderHierarchyFlags, base.SourceMailboxWrapper);
            this.DestHierarchy   = new FolderHierarchy(folderHierarchyFlags, base.DestMailboxWrapper);
            FolderIdTranslator  folderIdTranslator = new FolderIdTranslator(this.SourceHierarchy, this.DestHierarchy);
            PrincipalTranslator principalTranslator;

            if (cachedRequestJob.RequestStyle == RequestStyle.CrossOrg)
            {
                principalTranslator = new PrincipalTranslator(base.SourceMailboxWrapper.PrincipalMapper, base.DestMailboxWrapper.PrincipalMapper);
            }
            else
            {
                principalTranslator = null;
            }
            base.ConfigTranslators(principalTranslator, folderIdTranslator);
        }
Ejemplo n.º 8
0
 public MapiSourceMailbox(LocalMailboxFlags flags) : base(flags)
 {
 }
Ejemplo n.º 9
0
 public StorageSourceMailbox(LocalMailboxFlags flags) : base(flags)
 {
 }
 public RemoteDestinationMailbox(string serverName, string remoteOrgName, NetworkCredential remoteCred, ProxyControlFlags proxyControlFlags, IEnumerable <MRSProxyCapabilities> requiredCapabilities, bool useHttps, LocalMailboxFlags flags) : base(serverName, remoteOrgName, remoteCred, proxyControlFlags, requiredCapabilities, useHttps, flags)
 {
 }
Ejemplo n.º 11
0
 public StorageMailbox(LocalMailboxFlags flags) : base(flags)
 {
     this.InTransitStatus   = InTransitStatus.NotInTransit;
     this.StoreSession      = null;
     this.isStorageProvider = true;
 }
Ejemplo n.º 12
0
 public StorageDestinationMailbox(LocalMailboxFlags flags) : base(flags)
 {
 }