Ejemplo n.º 1
0
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings adsessionSettings  = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            this.currentOrgConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, null, adsessionSettings, 313, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            adsessionSettings            = ADSessionSettings.RescopeToSubtree(adsessionSettings);
            if (MapiTaskHelper.IsDatacenter || MapiTaskHelper.IsDatacenterDedicated)
            {
                adsessionSettings.IncludeSoftDeletedObjects = true;
                adsessionSettings.IncludeInactiveMailbox    = true;
            }
            this.gcSession     = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 330, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            this.recipSession  = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 337, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            this.configSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromRootOrgScopeSet(), 343, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            if (this.rjProvider != null)
            {
                this.rjProvider.Dispose();
                this.rjProvider = null;
            }
            if (base.ParameterSetName.Equals("MigrationRequestQueue"))
            {
                MailboxDatabase mailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.RequestQueue, this.configSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(this.RequestQueue.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(this.RequestQueue.ToString())));
                this.rjProvider = new RequestJobProvider(mailboxDatabase.Guid);
            }
            else
            {
                this.rjProvider = new RequestJobProvider(this.gcSession, this.currentOrgConfigSession);
            }
            this.rjProvider.LoadReport = this.IncludeReport;
            return(this.rjProvider);
        }
Ejemplo n.º 2
0
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);

            this.SessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            ADSessionSettings adsessionSettings = ADSessionSettings.RescopeToSubtree(this.SessionSettings);

            if (MapiTaskHelper.IsDatacenter || MapiTaskHelper.IsDatacenterDedicated)
            {
                adsessionSettings.IncludeSoftDeletedObjects = true;
            }
            this.GCSession        = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 413, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\MoveRequest\\SetMoveRequestBase.cs");
            this.WriteableSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, adsessionSettings, 419, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\MoveRequest\\SetMoveRequestBase.cs");
            if (base.CurrentTaskContext.CanBypassRBACScope)
            {
                this.WriteableSession.EnforceDefaultScope = false;
            }
            if (this.DataObject != null)
            {
                this.DataObject.Dispose();
                this.DataObject = null;
            }
            if (this.MRProvider != null)
            {
                this.MRProvider.Dispose();
                this.MRProvider = null;
            }
            this.MRProvider = new RequestJobProvider(this.WriteableSession, this.ConfigSession);
            return(this.MRProvider);
        }
Ejemplo n.º 3
0
        public static IConfigurationSession CreateOrganizationFindingSession(OrganizationId currentOrgId, OrganizationId executingUserOrgId)
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(null, null);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, currentOrgId, executingUserOrgId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 643, "CreateOrganizationFindingSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\RequestTaskHelper.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            return(tenantOrTopologyConfigurationSession);
        }
Ejemplo n.º 4
0
        private IConfigurationSession CreateScopedSession(ExchangeConfigurationUnit cu)
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, cu.OrganizationId, base.ExecutingUserOrganizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 473, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\EdgeSync\\TestEdgeSyncEhf.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = true;
            return(tenantOrTopologyConfigurationSession);
        }
        protected override IConfigDataProvider CreateSession()
        {
            TaskLogger.LogEnter();
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            sessionSettings            = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.readOnlyConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 121, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OnlineIsInteg\\RemoveMailboxRepairRequest.cs");
            TaskLogger.LogExit();
            return(this.readOnlyConfigSession);
        }
Ejemplo n.º 6
0
        private OrganizationId ResolveCurrentOrganization()
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 695, "ResolveCurrentOrganization", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Migration\\MigrationObjectTaskBase.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));

            return(adorganizationalUnit.OrganizationId);
        }
Ejemplo n.º 7
0
 internal virtual ADObjectId GetRootOrgContainerId(PartitionId partitionId)
 {
     if (partitionId == null)
     {
         throw new ArgumentNullException("partitionId");
     }
     if (ADSession.IsBoundToAdam || partitionId.IsLocalForestPartition())
     {
         return(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest());
     }
     return(ADSystemConfigurationSession.GetRootOrgContainerId(partitionId.ForestFQDN, null, null));
 }
        protected override IConfigDataProvider CreateSession()
        {
            TaskLogger.LogEnter();
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(null, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            sessionSettings       = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 176, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\Mailbox\\MailboxQuarantineTaskBase.cs");
            this.recipientSession.UseGlobalCatalog = true;
            this.systemConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 186, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\Mailbox\\MailboxQuarantineTaskBase.cs");
            TaskLogger.LogExit();
            return(this.systemConfigSession);
        }
Ejemplo n.º 9
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.Organization != null)
     {
         ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
         ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
         IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 105, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\rms\\SetRmsTemplate.cs");
         tenantOrTopologyConfigurationSession.UseConfigNC = false;
         ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));
         base.CurrentOrganizationId = adorganizationalUnit.OrganizationId;
     }
 }
Ejemplo n.º 10
0
        private IPowerShellBudget GetBudget(HttpContext context)
        {
            if (context.User is DelegatedPrincipal)
            {
                using (new MonitoredScope("ThrottlingHttpModule", "AcquireDelegatedPrincipalBudget", HttpModuleHelper.HttpPerfMonitors))
                {
                    return(PowerShellBudget.Acquire(new DelegatedPrincipalBudgetKey((DelegatedPrincipal)context.User, BudgetType.WSMan)));
                }
            }
            if (context.CurrentUserToken() == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] No CAT.");
                return(null);
            }
            SecurityIdentifier userSid = context.CurrentUserToken().UserSid;

            if (userSid == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] sid = null.");
                return(null);
            }
            OrganizationId organization = context.CurrentUserToken().Organization;

            if (organization == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] orgId = null.");
                return(null);
            }
            ADObjectId adobjectId;

            if (organization.Equals(OrganizationId.ForestWideOrgId))
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] Forest Wide Org Id.");
                adobjectId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            }
            else
            {
                adobjectId = ADSystemConfigurationSession.GetRootOrgContainerId(organization.PartitionId.ForestFQDN, null, null);
            }
            ExTraceGlobals.HttpModuleTracer.TraceDebug <string>((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] rootOrgId = {0}.", (adobjectId == null) ? null : adobjectId.DistinguishedName);
            IPowerShellBudget result;

            using (new MonitoredScope("ThrottlingHttpModule", "AcquireBudget", HttpModuleHelper.HttpPerfMonitors))
            {
                result = PowerShellBudget.Acquire(userSid, BudgetType.WSMan, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(adobjectId, organization, organization, true));
            }
            return(result);
        }
Ejemplo n.º 11
0
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            this.CurrentOrgConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 772, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            sessionSettings   = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.GCSession    = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 783, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            this.RecipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 791, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            if (this.RJProvider != null)
            {
                this.RJProvider.Dispose();
                this.RJProvider = null;
            }
            this.RJProvider = new RequestJobProvider(this.RecipSession, this.CurrentOrgConfigSession);
            return(this.RJProvider);
        }
            // Token: 0x06000E81 RID: 3713 RVA: 0x00057330 File Offset: 0x00055530
            protected override void InitializeRunspace(Runspace runspace)
            {
                base.InitializeRunspace(runspace);
                string token = (this.organizationId == OrganizationId.ForestWideOrgId) ? "RootOrg" : RunspaceServerSettings.GetTokenForOrganization(this.organizationId);
                RunspaceServerSettings runspaceServerSettings;

                if (this.organizationId != null && !this.organizationId.PartitionId.IsLocalForestPartition())
                {
                    runspaceServerSettings = RunspaceServerSettings.CreateGcOnlyRunspaceServerSettings(token, this.organizationId.PartitionId.ForestFQDN, false);
                    runspaceServerSettings.RecipientViewRoot = ADSystemConfigurationSession.GetRootOrgContainerId(null, null).DomainId;
                }
                else
                {
                    runspaceServerSettings = RunspaceServerSettings.CreateGcOnlyRunspaceServerSettings(token, false);
                }
                runspace.SessionStateProxy.SetVariable(ExchangePropertyContainer.ADServerSettingsVarName, runspaceServerSettings);
            }
Ejemplo n.º 13
0
        private static IPowerShellBudget AcquirePowerShellBudget(ExchangeRunspaceConfiguration configuration)
        {
            IPowerShellBudget  powerShellBudget;
            SecurityIdentifier callerSid;

            if (configuration.DelegatedPrincipal != null)
            {
                powerShellBudget = PowerShellBudget.Acquire(new DelegatedPrincipalBudgetKey(configuration.DelegatedPrincipal, BudgetType.PowerShell));
            }
            else if (!configuration.TryGetExecutingUserSid(out callerSid))
            {
                ADObjectId adobjectId;
                if (!configuration.TryGetExecutingUserId(out adobjectId))
                {
                    throw new ExecutingUserPropertyNotFoundException("ExecutingUserSid");
                }
                powerShellBudget = PowerShellBudget.AcquireFallback(adobjectId.ObjectGuid.ToString(), BudgetType.PowerShell);
            }
            else
            {
                ADObjectId rootOrgId;
                if (configuration.ExecutingUserOrganizationId == null || configuration.ExecutingUserOrganizationId.Equals(OrganizationId.ForestWideOrgId))
                {
                    rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
                }
                else
                {
                    rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerId(configuration.ExecutingUserOrganizationId.PartitionId.ForestFQDN, null, null);
                }
                powerShellBudget = PowerShellBudget.Acquire(callerSid, BudgetType.PowerShell, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgId, configuration.ExecutingUserOrganizationId, configuration.ExecutingUserOrganizationId, true));
            }
            PowerShellThrottlingPolicyUpdater.RevertExpiredThrottlingPolicyIfNeeded(powerShellBudget);
            if (configuration.IsPowerShellWebService)
            {
                IPowerShellBudget result = new PswsBudgetWrapper(((BudgetWrapper <PowerShellBudget>)powerShellBudget).GetInnerBudget());
                if (powerShellBudget != null)
                {
                    powerShellBudget.Dispose();
                }
                return(result);
            }
            return(powerShellBudget);
        }
        protected override void InternalProcessRecord()
        {
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;
            ADObjectId   rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null);
            Organization organization       = topologyConfigurationSession.Read <Organization>(rootOrgContainerId);

            if (organization == null)
            {
                base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorOrganizationNotFound(rootOrgContainerId)), ErrorCategory.ObjectNotFound, rootOrgContainerId);
            }
            if (organization.ExchangeVersion == ExchangeObjectVersion.Exchange2003 && !topologyConfigurationSession.HasAnyServer())
            {
                base.WriteVerbose(Strings.VerboseBumpOrganizationExchangeVersion(organization.Identity.ToString(), organization.ExchangeVersion.ToString(), Organization.CurrentExchangeRootOrgVersion.ToString()));
                organization.SetExchangeVersion(Organization.CurrentExchangeRootOrgVersion);
                organization[ADLegacyVersionableObjectSchema.MinAdminVersion] = Organization.CurrentExchangeRootOrgVersion.ExchangeBuild.ToExchange2003FormatInt32();
                if (Datacenter.IsMicrosoftHostedOnly(true))
                {
                    organization[OrganizationSchema.ForestMode] = ForestModeFlags.TenantConfigInDomainNC;
                }
                topologyConfigurationSession.Save(organization);
            }
        }
Ejemplo n.º 15
0
        internal virtual IPowerShellBudget CreateBudget(BudgetType budgetType)
        {
            IPowerShellBudget result = null;

            if (this.DelegatedPrincipal != null)
            {
                ExTraceGlobals.PublicPluginAPITracer.TraceDebug <BudgetType, string>(0L, "Create Budge {0} for AuthZPluginUserToken {1} using DelegatedPrincipal.", budgetType, this.UserName);
                result = PowerShellBudget.Acquire(new DelegatedPrincipalBudgetKey(this.DelegatedPrincipal, budgetType));
            }
            else
            {
                ExTraceGlobals.PublicPluginAPITracer.TraceDebug <BudgetType, string>(0L, "Create Budge {0} for AuthZPluginUserToken {1} using UserEntry.", budgetType, this.UserName);
                if (budgetType == BudgetType.WSManTenant)
                {
                    return(PowerShellBudget.Acquire(new TenantBudgetKey(this.OrgId, budgetType)));
                }
                SecurityIdentifier securityIdentifier = (SecurityIdentifier)this.UserEntry[IADSecurityPrincipalSchema.Sid];
                if (securityIdentifier != null)
                {
                    ADObjectId rootOrgId;
                    if (this.OrgId == null || this.OrgId.Equals(OrganizationId.ForestWideOrgId))
                    {
                        rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
                    }
                    else
                    {
                        rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerId(this.OrgId.PartitionId.ForestFQDN, null, null);
                    }
                    result = PowerShellBudget.Acquire(securityIdentifier, budgetType, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgId, this.OrgId, this.OrgId, true));
                }
                else
                {
                    ExTraceGlobals.PublicPluginAPITracer.TraceDebug <string>(0L, "Sid is null, return null budget for AuthZPluginUserToken {0}.", this.UserName);
                }
            }
            return(result);
        }
Ejemplo n.º 16
0
        private IConfigurationSession GetConfigurationSession()
        {
            ADObjectId     adobjectId;
            OrganizationId organizationId = TaskHelper.ResolveCurrentUserOrganization(out adobjectId);

            if (organizationId == null)
            {
                organizationId = OrganizationId.ForestWideOrgId;
            }
            ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerId(null, null), organizationId, organizationId, false);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 503, "GetConfigurationSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Support\\DiagnosticTasks\\TestMessage.cs"));
        }
Ejemplo n.º 17
0
 private void ValidateAndSetServerContext()
 {
     if (this.Server == null)
     {
         return;
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteExchangeVersionNotSupported), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 283, "ValidateAndSetServerContext", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OAuth\\SetAuthConfig.cs"), this.serverObject, false, new DataAccessTask <AuthConfig> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
 }
Ejemplo n.º 18
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.Server == null)
     {
         this.Server = new ServerIdParameter();
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 325, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\NewExchangeCertificate.cs"), this.serverObject, true, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     this.ValidateParameters();
     this.inputParams = new ExchangeCertificateRpc();
     this.inputParams.CreateExportable        = this.PrivateKeyExportable;
     this.inputParams.CreateIncAccepted       = this.IncludeAcceptedDomains;
     this.inputParams.CreateIncFqdn           = this.IncludeServerFQDN;
     this.inputParams.CreateIncNetBios        = this.IncludeServerNetBIOSName;
     this.inputParams.CreateIncAutoDisc       = this.IncludeAutoDiscover;
     this.inputParams.CreateBinary            = this.BinaryEncoded;
     this.inputParams.CreateRequest           = this.GenerateRequest;
     this.inputParams.CreateKeySize           = this.KeySize;
     this.inputParams.CreateServices          = this.Services;
     this.inputParams.CreateAllowConfirmation = !this.Force;
     if (this.FriendlyName != null)
     {
         this.inputParams.CreateFriendlyName = this.FriendlyName;
     }
     if (this.SubjectName != null)
     {
         this.inputParams.CreateSubjectName = this.SubjectName.Name;
     }
     if (this.SubjectKeyIdentifier != null)
     {
         this.inputParams.CreateSubjectKeyIdentifier = this.SubjectKeyIdentifier;
     }
     if (this.DomainName != null)
     {
         this.inputParams.CreateDomains = this.DomainName;
     }
     if (this.Instance != null)
     {
         this.inputParams.CreateCloneCert = this.Instance.Export(X509ContentType.SerializedCert);
     }
 }
Ejemplo n.º 19
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.Server == null)
     {
         this.Server = new ServerIdParameter();
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 207, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ImportExchangeCertificate.cs"), this.serverObject, true, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     if (this.Instance == null && this.FileData == null && string.IsNullOrEmpty(this.FileName))
     {
         base.WriteError(new ArgumentException(Strings.ImportCertificateDataIsNull(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
 }
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     GetExchangeCertificate.PrepareParameters(this);
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ExportExchangeCertificate.cs"), this.serverObject, false, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     if (string.IsNullOrEmpty(this.Thumbprint))
     {
         base.WriteError(new ArgumentException(Strings.ExceptionEmptyStringNotAllowed, "Thumbprint"), ErrorCategory.InvalidArgument, null);
     }
     this.Thumbprint = ManageExchangeCertificate.UnifyThumbprintFormat(this.Thumbprint);
     if (!string.IsNullOrEmpty(this.FileName) && (File.Exists(this.FileName) || File.Exists(this.FileName + ".pfx")))
     {
         base.WriteError(new ArgumentException(Strings.CertificateInvalidFileName(this.serverObject.Name), "FileName"), ErrorCategory.InvalidArgument, null);
     }
 }
Ejemplo n.º 21
0
        private void PrepareSessionsForTenant()
        {
            this.rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            if (this.Organization != null)
            {
                this.ResolveOrganization();
                this.LogReadObject(this.organization);
                this.orgDomainRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.organization.OriginatingServer, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsObjectId(this.organization.Id), 479, "PrepareSessionsForTenant", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\SetupTaskBase.cs");
            }
            if (this.organization != null)
            {
                this.rootOrgId = ((null != this.organization.Id.GetPartitionId() && this.organization.Id.GetPartitionId().ForestFQDN != null) ? ADSystemConfigurationSession.GetRootOrgContainerId(this.organization.Id.GetPartitionId().ForestFQDN, null, null) : ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest());
            }
            ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(this.rootOrgId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, false);

            this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 503, "PrepareSessionsForTenant", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\SetupTaskBase.cs");
            this.recipientSession.UseGlobalCatalog = false;
            this.configurationSession                   = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 514, "PrepareSessionsForTenant", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\SetupTaskBase.cs");
            this.domainConfigurationSession             = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 521, "PrepareSessionsForTenant", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\SetupTaskBase.cs");
            this.domainConfigurationSession.UseConfigNC = false;
            this.ReadRootDomainFromDc(base.CurrentOrganizationId);
            this.rootDomainRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.rootDomain.OriginatingServer, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAccountPartitionRootOrgScopeSet(base.CurrentOrganizationId.PartitionId), 533, "PrepareSessionsForTenant", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\SetupTaskBase.cs");
        }
        internal override IConfigurationSession CreateSession()
        {
            PartitionId       partitionIdByAcceptedDomainName = ADAccountPartitionLocator.GetPartitionIdByAcceptedDomainName(this.Organization.RawIdentity);
            ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerId(partitionIdByAcceptedDomainName.ForestFQDN, null, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, false);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.RescopeToSubtree(sessionSettings), 480, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\AddSecondaryDomainTask.cs"));
        }