示例#1
0
 // Token: 0x06000368 RID: 872 RVA: 0x00013A3C File Offset: 0x00011C3C
 public AnrManager(IAirSyncUser user, MailboxSession mailboxSession, int lcid, int nameLimit)
 {
     this.user           = user;
     this.mailboxSession = mailboxSession;
     this.lcid           = lcid;
     this.nameLimit      = nameLimit;
 }
        // Token: 0x06000759 RID: 1881 RVA: 0x00028D5C File Offset: 0x00026F5C
        public static bool IsWssAccessEnabled(IAirSyncUser user)
        {
            AirSyncDiagnostics.Assert(user != null);
            PolicyData policyData = ADNotificationManager.GetPolicyData(user);

            return(policyData == null || policyData.WSSAccessEnabled);
        }
        private static PolicyData GetDefaultPolicySetting(IAirSyncUser user)
        {
            ADObjectId configurationUnit = user.ADUser.ConfigurationUnit;

            if (configurationUnit == null)
            {
                if (ADNotificationManager.enterpriseConfigurationID == null)
                {
                    IConfigurationSession configurationSession = ADNotificationManager.CreateScopedADSession(user);
                    ADNotificationManager.enterpriseConfigurationID = configurationSession.GetOrgContainerId();
                    user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, configurationSession.LastUsedDc);
                }
                configurationUnit = ADNotificationManager.enterpriseConfigurationID;
            }
            Func <PolicyData> loadDataAction = () => ADNotificationManager.LoadDefaultPolicySetting(ADNotificationManager.CreateScopedADSession(user), user.Context.ProtocolLogger);

            ADNotificationManager.ADSettingsInfo <PolicyData> adsettingsInfo;
            bool flag = ADNotificationManager.LoadADSettingsData <PolicyData>(ADNotificationManager.policies, configurationUnit.DistinguishedName, loadDataAction, user.OrganizationId.PartitionId, out adsettingsInfo);

            if (flag && adsettingsInfo.ADSettingsData == null)
            {
                AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Default PolicySettings not found. Save null in cache.Policy DN {0}", configurationUnit.DistinguishedName);
                ADNotificationManager.policies.Add(configurationUnit.DistinguishedName, new ADNotificationManager.ADSettingsInfo <PolicyData>(user.OrganizationId.PartitionId, null, ExDateTime.UtcNow));
            }
            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Returning Default PolicySettings data. DN {0}", configurationUnit.DistinguishedName);
            return(adsettingsInfo.ADSettingsData);
        }
示例#4
0
 internal ProxiedRequestInfo(IAirSyncUser user, Uri remoteUri) : this(remoteUri)
 {
     this.user = user.Name;
     this.requiresImpersonation = true;
     this.attemptProxyLogin     = true;
     this.cscbuf = Encoding.ASCII.GetBytes(user.ClientSecurityContextWrapper.SerializedSecurityContext.Serialize());
 }
 internal GalSearchProvider(IAirSyncUser user, int lcid, int protocolVersion)
 {
     this.lcid            = lcid;
     this.protocolVersion = protocolVersion;
     this.user            = user;
     AirSyncCounters.NumberOfGALSearches.Increment();
 }
 public static IOrganizationSettingsData GetOrganizationSettingsData(IAirSyncUser user)
 {
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     return(ADNotificationManager.GetOrganizationSettingsData(user.OrganizationId, user.Context));
 }
 // Token: 0x06000747 RID: 1863 RVA: 0x00027BA4 File Offset: 0x00025DA4
 internal DocumentLibraryFetchProvider(IAirSyncUser user)
 {
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     this.user = user;
     AirSyncCounters.NumberOfDocumentLibraryFetches.Increment();
 }
示例#8
0
 internal DevicePasswordSetting(XmlNode request, XmlNode response, IAirSyncUser user, GlobalInfo globalInfo, ProtocolLogger protocolLogger) : base(request, response, protocolLogger)
 {
     this.user = user;
     if (globalInfo == null)
     {
         throw new ArgumentNullException("globalInfo should not be null here!");
     }
     this.globalInfo = globalInfo;
 }
        private static PolicyData GetPolicySetting(IAirSyncUser user)
        {
            ADObjectId policyId = user.ADUser.ActiveSyncMailboxPolicy;

            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Loading user PolicySettings data.Policy DN {0}", policyId.DistinguishedName);
            Func <PolicyData> loadDataAction = () => ADNotificationManager.LoadPolicySetting(ADNotificationManager.CreateScopedADSession(user), user, policyId, true);

            ADNotificationManager.ADSettingsInfo <PolicyData> adsettingsInfo;
            ADNotificationManager.LoadADSettingsData <PolicyData>(ADNotificationManager.policies, policyId.DistinguishedName, loadDataAction, user.OrganizationId.PartitionId, out adsettingsInfo);
            return(adsettingsInfo.ADSettingsData);
        }
示例#10
0
        internal static ActiveSyncMiniRecipient TryGetADUser(IAirSyncUser user, ProtocolLogger logger)
        {
            ADUserCache.< > c__DisplayClass1 CS$ < > 8__locals1 = new ADUserCache.< > c__DisplayClass1();
            AirSyncDiagnostics.Assert(user != null, "IAirSyncUser cannot be null in GetADUser", new object[0]);
            CS$ < > 8__locals1.sid2 = user.ClientSecurityContextWrapper.UserSid;
            ActiveSyncMiniRecipient activeSyncMiniRecipient = null;

            if (!GlobalSettings.DisableCaching && ADUserCache.TryGetADUser(CS$ < > 8__locals1.sid2.Value, out activeSyncMiniRecipient))
            {
                return(activeSyncMiniRecipient);
            }
            string value = user.Name;

            if (GlobalSettings.IsWindowsLiveIDEnabled)
            {
                value = user.WindowsLiveId;
            }
            if (string.IsNullOrEmpty(value))
            {
                logger.SetValue(ProtocolLoggerData.Error, "BadAuthUsername");
                throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidCombinationOfIDs, null, false);
            }
            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "ADUserCache.TryGetADUser:: user IdentityType {0}", user.Identity.GetType().FullName);
            ADSessionSettings       sessionSettings  = ADUserCache.GetSessionSettings(GlobalSettings.IsMultiTenancyEnabled ? (user.Identity as LiveIDIdentity).UserOrganizationId : OrganizationId.ForestWideOrgId, logger);
            IRecipientSession       recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, null, 0, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings, 124, "TryGetADUser", "f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\ADUserCache.cs");
            ActiveSyncMiniRecipient recipient        = null;

            ADNotificationAdapter.RunADOperation(delegate()
            {
                recipient = recipientSession.FindMiniRecipientBySid <ActiveSyncMiniRecipient>(CS$ < > 8__locals1.sid2, ObjectSchema.GetInstance <ClientAccessRulesRecipientFilterSchema>().AllProperties);
            });
            logger.SetValue(ProtocolLoggerData.DomainController, recipientSession.LastUsedDc);
            if (recipient == null)
            {
                AirSyncDiagnostics.TraceDebug <SecurityIdentifier>(ExTraceGlobals.RequestsTracer, null, "ADUserCache.TryGetADUserFromSid can't find ActiveSyncMiniRecipient for sid {0}", CS$ < > 8__locals1.sid2);
                return(null);
            }
            activeSyncMiniRecipient = ((recipient.RecipientType == RecipientType.UserMailbox || recipient.RecipientType == RecipientType.MailUser) ? recipient : null);
            if (activeSyncMiniRecipient == null)
            {
                AirSyncDiagnostics.TraceDebug <RecipientType>(ExTraceGlobals.RequestsTracer, null, "ADUserCache.TryGetADUserFromSid recipient type is {0} when expected UserMailbox/MailUser", recipient.RecipientType);
                return(null);
            }
            if (!GlobalSettings.DisableCaching)
            {
                ADUserCache.AddADUserToCache(CS$ < > 8__locals1.sid2.Value, activeSyncMiniRecipient);
            }
            return(activeSyncMiniRecipient);
        }
 // Token: 0x06000D93 RID: 3475 RVA: 0x0004AF14 File Offset: 0x00049114
 internal static void SendBootstrapMailForWM61(IAirSyncUser user)
 {
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     if (user.ExchangePrincipal == null)
     {
         throw new ArgumentNullException("user.ExchangePrincipal");
     }
     using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(user.ExchangePrincipal, CultureInfo.InvariantCulture, "Client=ActiveSync"))
     {
         CultureInfo preferedCulture = mailboxSession.PreferedCulture;
         string      subject         = Strings.BootstrapMailForWM61Subject.ToString(preferedCulture);
         string      text            = string.Format("<a href=\"{0}\">{1}</a>", GlobalSettings.MobileUpdateInformationURL, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body7.ToString(preferedCulture), false));
         string      text2           = string.Format("<a href=\"{0}\">{1}</a>", GlobalSettings.BootstrapCABForWM61HostingURL, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body8.ToString(preferedCulture), false));
         string      text3           = string.Empty;
         IOrganizationSettingsData organizationSettingsData = ADNotificationManager.GetOrganizationSettingsData(user);
         if (organizationSettingsData != null && !string.IsNullOrEmpty(organizationSettingsData.OtaNotificationMailInsert))
         {
             text3 = string.Format("<p>{0}</p><hr>", organizationSettingsData.OtaNotificationMailInsert);
         }
         string body = string.Format("<html><head><style>p, li {{font-size:10pt; font-family:Tahoma;}}</style></head><body><p style=\"font-size:12pt; color:darkblue;\"><b>{0}</b></p><p>{1}</p><ul><li>{2}</li><li>{3}</li><li>{4}</li><li>{5}</li><li>{6}</li></ul><p><span style=\"font-size:12pt;\"><b>{7}</b></span><br>{8}</p><hr>{9}<p style=\"font-size:8pt; color:gray;\">{10}</p></body></html>", new object[]
         {
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body1.ToString(preferedCulture), false),
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body2.ToString(preferedCulture), false),
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body3.ToString(preferedCulture), false),
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body4.ToString(preferedCulture), false),
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body5.ToString(preferedCulture), false),
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body6.ToString(preferedCulture), false),
             text,
             text2,
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body9.ToString(preferedCulture), false),
             text3,
             AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body10.ToString(preferedCulture), false)
         });
         SystemMessageHelper.PostMessage(mailboxSession, subject, body, "IPM.Note", Importance.High);
     }
 }
        public static PolicyData GetPolicyData(IAirSyncUser user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (!ADNotificationManager.started)
            {
                throw new InvalidOperationException("ADNotificationManager should be started first!");
            }
            PolicyData policyData = null;

            if (user.ADUser.ActiveSyncMailboxPolicy != null)
            {
                policyData = ADNotificationManager.GetPolicySetting(user);
            }
            if (policyData == null)
            {
                policyData = ADNotificationManager.GetDefaultPolicySetting(user);
            }
            return(policyData);
        }
示例#13
0
 public RightsManagementInformationSetting(XmlNode request, XmlNode response, IAirSyncUser user, CultureInfo cultureInfo, ProtocolLogger protocolLogger, MailboxLogger mailboxLogger) : base(request, response, protocolLogger)
 {
     this.user          = user;
     this.cultureInfo   = cultureInfo;
     this.mailboxLogger = mailboxLogger;
 }
 private static IConfigurationSession CreateScopedADSession(IAirSyncUser user)
 {
     return(ADNotificationManager.CreateScopedADSession(user.ADUser.OrganizationId, ConsistencyMode.IgnoreInvalid));
 }
示例#15
0
 public TimeZoneOffsetSettings(XmlNode request, XmlNode response, IAirSyncUser user, ProtocolLogger protocolLogger) : base(request, response, protocolLogger)
 {
     this.user = user;
 }
        private static PolicyData LoadPolicySetting(IConfigurationSession scopedSession, IAirSyncUser user, ADObjectId policyId, bool forceLoad)
        {
            MobileMailboxPolicy mobileMailboxPolicy = null;
            ADOperationResult   adoperationResult   = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                mobileMailboxPolicy = scopedSession.Read <MobileMailboxPolicy>(policyId);
            });

            if (!adoperationResult.Succeeded)
            {
                AirSyncDiagnostics.TraceDebug <ADObjectId, string>(ExTraceGlobals.RequestsTracer, null, "Exception occurred during AD Operation during LoadPolicySettings {0}. Exception Message - {1}", policyId, adoperationResult.Exception.Message);
                throw adoperationResult.Exception;
            }
            if (user != null)
            {
                user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, scopedSession.LastUsedDc);
            }
            if (mobileMailboxPolicy != null && (forceLoad || mobileMailboxPolicy.IsDefault))
            {
                AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, null, "LoadPolicySetting from AD");
                return(ADNotificationManager.AddPolicyToCache(mobileMailboxPolicy, scopedSession.SessionSettings.CurrentOrganizationId.PartitionId));
            }
            return(null);
        }
 // Token: 0x06001867 RID: 6247 RVA: 0x0008F242 File Offset: 0x0008D442
 public UserInformationSetting(XmlNode request, XmlNode response, IAirSyncUser user, MailboxSession mailboxSession, int version, ProtocolLogger protocolLogger) : base(request, response, protocolLogger)
 {
     this.user           = user;
     this.mailboxSession = mailboxSession;
     this.version        = version;
 }
示例#18
0
 // Token: 0x0600073C RID: 1852 RVA: 0x00026A8A File Offset: 0x00024C8A
 internal DocumentLibrarySearchProvider(IAirSyncUser user)
 {
     this.user = user;
     AirSyncCounters.NumberOfDocumentLibrarySearches.Increment();
 }