// 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);
        }
        // Token: 0x06000DF7 RID: 3575 RVA: 0x0004DFAC File Offset: 0x0004C1AC
        public PolicyData(MobileMailboxPolicy policy, bool useIrmEnabledPolicySetting)
        {
            this.identity = policy.OriginalId;
            this.allowNonProvisionableDevices       = policy.AllowNonProvisionableDevices;
            this.alphanumericDevicePasswordRequired = policy.AlphanumericPasswordRequired;
            this.attachmentsEnabled              = policy.AttachmentsEnabled;
            this.requireStorageCardEncryption    = policy.RequireStorageCardEncryption;
            this.devicePasswordEnabled           = policy.PasswordEnabled;
            this.passwordRecoveryEnabled         = policy.PasswordRecoveryEnabled;
            this.devicePolicyRefreshInterval     = policy.DevicePolicyRefreshInterval;
            this.allowSimpleDevicePassword       = policy.AllowSimplePassword;
            this.maxAttachmentSize               = policy.MaxAttachmentSize;
            this.wssAccessEnabled                = policy.WSSAccessEnabled;
            this.uncAccessEnabled                = policy.UNCAccessEnabled;
            this.minDevicePasswordLength         = policy.MinPasswordLength;
            this.maxInactivityTimeDeviceLock     = policy.MaxInactivityTimeLock;
            this.maxDevicePasswordFailedAttempts = policy.MaxPasswordFailedAttempts;
            this.devicePasswordExpiration        = policy.PasswordExpiration;
            this.devicePasswordHistory           = policy.PasswordHistory;
            this.isDefault                                = policy.IsDefault;
            this.allowStorageCard                         = policy.AllowStorageCard;
            this.allowCamera                              = policy.AllowCamera;
            this.requireDeviceEncryption                  = policy.RequireDeviceEncryption;
            this.allowUnsignedApplications                = policy.AllowUnsignedApplications;
            this.allowUnsignedInstallationPackages        = policy.AllowUnsignedInstallationPackages;
            this.allowWiFi                                = policy.AllowWiFi;
            this.allowTextMessaging                       = policy.AllowTextMessaging;
            this.allowPOPIMAPEmail                        = policy.AllowPOPIMAPEmail;
            this.allowIrDA                                = policy.AllowIrDA;
            this.requireManualSyncWhenRoaming             = policy.RequireManualSyncWhenRoaming;
            this.allowDesktopSync                         = policy.AllowDesktopSync;
            this.allowHTMLEmail                           = policy.AllowHTMLEmail;
            this.requireSignedSMIMEMessages               = policy.RequireSignedSMIMEMessages;
            this.requireEncryptedSMIMEMessages            = policy.RequireEncryptedSMIMEMessages;
            this.allowSMIMESoftCerts                      = policy.AllowSMIMESoftCerts;
            this.allowBrowser                             = policy.AllowBrowser;
            this.allowConsumerEmail                       = policy.AllowConsumerEmail;
            this.allowRemoteDesktop                       = policy.AllowRemoteDesktop;
            this.allowInternetSharing                     = policy.AllowInternetSharing;
            this.allowBluetooth                           = policy.AllowBluetooth;
            this.maxCalendarAgeFilter                     = policy.MaxCalendarAgeFilter;
            this.maxEmailAgeFilter                        = policy.MaxEmailAgeFilter;
            this.requireSignedSMIMEAlgorithm              = policy.RequireSignedSMIMEAlgorithm;
            this.requireEncryptionSMIMEAlgorithm          = policy.RequireEncryptionSMIMEAlgorithm;
            this.allowSMIMEEncryptionAlgorithmNegotiation = policy.AllowSMIMEEncryptionAlgorithmNegotiation;
            this.minDevicePasswordComplexCharacters       = policy.MinPasswordComplexCharacters;
            this.maxEmailBodyTruncationSize               = policy.MaxEmailBodyTruncationSize;
            this.maxEmailHTMLBodyTruncationSize           = policy.MaxEmailHTMLBodyTruncationSize;
            this.unapprovedInROMApplicationList           = policy.UnapprovedInROMApplicationList;
            this.approvedApplicationList                  = policy.ApprovedApplicationList;
            this.allowExternalDeviceManagement            = policy.AllowExternalDeviceManagement;
            this.MobileOTAUpdateMode                      = policy.MobileOTAUpdateMode;
            this.AllowMobileOTAUpdate                     = policy.AllowMobileOTAUpdate;
            this.isIrmEnabled                             = (useIrmEnabledPolicySetting && policy.IrmEnabled);
            string policyXml = ProvisionCommandPhaseOne.BuildEASProvisionDoc(20, out this.preversion121DeviceCompatibility, this) + policy.AllowNonProvisionableDevices;

            this.preversion121HashCode = PolicyData.GetPolicyHashCode(policyXml);
            policyXml = ProvisionCommandPhaseOne.BuildEASProvisionDoc(121, out this.version121DeviceCompatibility, this) + policy.AllowNonProvisionableDevices;
            this.version121HashCode = PolicyData.GetPolicyHashCode(policyXml);
        }
        // Token: 0x06000D92 RID: 3474 RVA: 0x0004AE00 File Offset: 0x00049000
        internal static bool NeedToSendBootstrapMailForWM61(IAirSyncContext airSyncContext, GlobalInfo globalInfo)
        {
            if (airSyncContext == null)
            {
                throw new ArgumentNullException("airSyncContext");
            }
            if (globalInfo == null)
            {
                throw new ArgumentNullException("globalInfo");
            }
            PolicyData policyData = ADNotificationManager.GetPolicyData(airSyncContext.User);

            if (policyData == null || !policyData.AllowMobileOTAUpdate)
            {
                return(false);
            }
            if (airSyncContext.Request.Version != 121)
            {
                return(false);
            }
            if (globalInfo.HaveSentBoostrapMailForWM61)
            {
                return(false);
            }
            if (globalInfo.BootstrapMailForWM61TriggeredTime != null)
            {
                return(false);
            }
            string deviceOS = globalInfo.DeviceOS;

            if (deviceOS == null || !deviceOS.StartsWith("Windows CE", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            try
            {
                Version v = new Version(deviceOS.Substring("Windows CE".Length).Trim());
                if (v < OTABootstrapMail.WM61VersionStartRange || v > OTABootstrapMail.WM61VersionEndRange)
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                if (ex is ArgumentException || ex is ArgumentOutOfRangeException || ex is FormatException || ex is OverflowException)
                {
                    return(false);
                }
                throw ex;
            }
            return(GlobalSettings.BootstrapCABForWM61HostingURL != null && GlobalSettings.MobileUpdateInformationURL != null);
        }
        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);
        }
示例#5
0
 private void ProcessSet(XmlNode setNode)
 {
     using (this.user.Context.Tracker.Start(TimeId.DevicePasswordProcessSet))
     {
         if (setNode.ChildNodes.Count != 1)
         {
             this.status = SettingsBase.ErrorCode.ProtocolError;
         }
         else
         {
             string innerText = setNode.FirstChild.InnerText;
             if (innerText.Length > 255)
             {
                 this.status = SettingsBase.ErrorCode.InvalidArguments;
             }
             else
             {
                 PolicyData policyData = ADNotificationManager.GetPolicyData(this.user);
                 bool       flag       = policyData != null && policyData.PasswordRecoveryEnabled;
                 if (innerText.Length > 0 && flag)
                 {
                     this.globalInfo.RecoveryPassword = innerText;
                 }
                 else
                 {
                     this.globalInfo.RecoveryPassword = null;
                 }
                 if (innerText.Length > 0 && !flag)
                 {
                     this.status = SettingsBase.ErrorCode.DeniedByPolicy;
                 }
                 else
                 {
                     this.status = SettingsBase.ErrorCode.Success;
                 }
             }
         }
     }
 }
        private static PolicyData AddPolicyToCache(MobileMailboxPolicy mobileMaiboxPolicy, PartitionId partitionId)
        {
            PolicyData policyData = null;

            if (mobileMaiboxPolicy != null)
            {
                policyData = new PolicyData(mobileMaiboxPolicy);
                string defaultPolicyKey = ADNotificationManager.GetDefaultPolicyKey(mobileMaiboxPolicy.Id);
                if (policyData.IsDefault)
                {
                    AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Adding policy {0} as default.", mobileMaiboxPolicy.Id.DistinguishedName);
                    ADNotificationManager.policies.Add(defaultPolicyKey, new ADNotificationManager.ADSettingsInfo <PolicyData>(partitionId, policyData, ExDateTime.UtcNow));
                }
                else if (ADNotificationManager.IsOrgDefaultPolicyEquals(mobileMaiboxPolicy.Id, defaultPolicyKey))
                {
                    AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Removing policy {0} as default.", mobileMaiboxPolicy.Id.DistinguishedName);
                    ADNotificationManager.policies.Remove(defaultPolicyKey);
                }
                AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Adding policy to location {0}.", mobileMaiboxPolicy.Id.DistinguishedName);
                ADNotificationManager.policies.Add(mobileMaiboxPolicy.Id.DistinguishedName, new ADNotificationManager.ADSettingsInfo <PolicyData>(partitionId, policyData, ExDateTime.UtcNow));
            }
            return(policyData);
        }
示例#7
0
        public override void HandleSyncStateVersioning(SyncState syncState)
        {
            if (syncState == null)
            {
                throw new ArgumentNullException("syncState");
            }
            if (syncState.BackendVersion == null)
            {
                return;
            }
            bool flag = true;

            if (syncState.BackendVersion < 2 || syncState.BackendVersion > this.Version)
            {
                flag = false;
            }
            else if (syncState.BackendVersion.Value != this.Version)
            {
                string text = null;
                switch (syncState.BackendVersion.Value)
                {
                case 2:
                    syncState["WipeConfirmationAddresses"] = null;
                    break;

                case 3:
                    break;

                case 4:
                    goto IL_14F;

                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 16:
                case 17:
                case 18:
                case 19:
                    goto IL_3B6;

                case 20:
                    goto IL_16C;

                case 21:
                    goto IL_184;

                case 22:
                    goto IL_1A6;

                case 23:
                    goto IL_1D2;

                case 24:
                    goto IL_1EF;

                case 25:
                    goto IL_1FA;

                case 26:
                    goto IL_212;

                case 27:
                    goto IL_259;

                case 28:
                    goto IL_2D8;

                case 29:
                    goto IL_2E4;

                case 30:
                    goto IL_2EF;

                case 31:
                    goto IL_2FB;

                case 32:
                    goto IL_306;

                case 33:
                    goto IL_312;

                case 34:
                    goto IL_31E;

                case 35:
                    goto IL_32A;

                case 36:
                    goto IL_358;

                case 37:
                    goto IL_39E;

                default:
                    goto IL_3B6;
                }
                syncState[CustomStateDatumType.UserAgent] = null;
IL_14F:
                syncState["LastAdUpdateTime"] = null;
                syncState["DeviceHealth"]     = new Int32Data(0);
IL_16C:
                text = syncState.GetData <StringData, string>("LastPolicyXML", null);
                syncState.Remove("LastPolicyXML");
IL_184:
                syncState["ProvisionSupported"] = new BooleanData(syncState.GetData <UInt32Data, uint>("PolicyKeyOnDevice", 0U) != 0U);
IL_1A6:
                syncState["LastPolicyXMLHash"] = ((text == null) ? null : new NullableData <Int32Data, int>(new int?(PolicyData.GetPolicyHashCode(text + true))));
IL_1D2:
                syncState["DeviceEnableOutboundSMS"] = new BooleanData(false);
                syncState["DeviceMobileOperator"]    = null;
IL_1EF:
                syncState.Remove("LastAdUpdateTime");
IL_1FA:
                syncState["ClientAlternateMailboxInformationVersion"] = null;
                syncState["DeviceUMRegisteredPhoneNumber"]            = null;
IL_212:
                syncState["HaveSentBoostrapMailForWM61"] = new BooleanData(false);
                if (syncState.BackendVersion.Value < 20)
                {
                    syncState["SSUpgradeDateTime"] = new DateTimeData(ExDateTime.UtcNow);
                }
                else
                {
                    syncState["SSUpgradeDateTime"] = null;
                }
IL_259:
                syncState.Remove("DeviceHealth");
                syncState["DeviceAccessState"]             = new Int32Data(0);
                syncState["DeviceAccessStateReason"]       = new Int32Data(0);
                syncState["DevicePolicyApplied"]           = null;
                syncState["DevicePolicyApplicationStatus"] = new Int32Data(0);
                syncState["LastDeviceWipeRequestor"]       = null;
                syncState["DeviceActiveSyncVersion"]       = null;
                syncState["ADDeviceInfoHash"]          = null;
                syncState["DeviceInformationReceived"] = new BooleanData(false);
IL_2D8:
                syncState["ADCreationTime"] = null;
IL_2E4:
                syncState.Remove("DeviceUMRegisteredPhoneNumber");
IL_2EF:
                syncState["NextTimeToClearMailboxLogs"] = null;
IL_2FB:
                syncState.Remove("ClientAlternateMailboxInformationVersion");
IL_306:
                syncState["DeviceADObjectId"] = null;
IL_312:
                syncState["BootstrapMailForWM61TriggeredTime"] = null;
IL_31E:
                syncState["UserADObjectId"] = null;
IL_32A:
                syncState["ABQMailId"]    = null;
                syncState["ABQMailState"] = new Int32Data(0);
                syncState["DeviceInformationPromoted"] = new BooleanData(false);
IL_358:
                syncState["DevicePhoneNumberForSms"] = ((syncState["DevicePhoneNumber"] != null) ? new StringData(((StringData)syncState["DevicePhoneNumber"]).Data) : null);
                syncState["SmsSearchFolderCreated"]  = new BooleanData(false);
IL_39E:
                syncState["DeviceBehavior"] = new DeviceBehaviorData(new DeviceBehavior(true));
                goto IL_3B8;
IL_3B6:
                flag = false;
            }
IL_3B8:
            if (!flag)
            {
                syncState.HandleCorruptSyncState();
            }
        }
        internal override Command.ExecutionState ExecuteCommand()
        {
            string          attachmentName  = this.AttachmentName;
            string          value           = string.Empty;
            FolderSyncState folderSyncState = null;

            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "GetAttachmentCommand.Execute(). AttachmentName: '{0}'", attachmentName);
            try
            {
                int incBy = 0;
                if (base.Request.ContentType != null && !string.Equals(base.Request.ContentType, "message/rfc822", StringComparison.OrdinalIgnoreCase))
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidContentType");
                    throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.First140Error, null, false);
                }
                int           num           = attachmentName.IndexOf(':');
                ItemIdMapping itemIdMapping = null;
                if (num != -1 && num != attachmentName.LastIndexOf(':'))
                {
                    folderSyncState = base.SyncStateStorage.GetFolderSyncState(new MailboxSyncProviderFactory(base.MailboxSession), attachmentName.Substring(0, num));
                    if (folderSyncState == null)
                    {
                        throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentName));
                    }
                    itemIdMapping = (ItemIdMapping)folderSyncState[CustomStateDatumType.IdMapping];
                    if (itemIdMapping == null)
                    {
                        throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentName));
                    }
                }
                PolicyData policyData = ADNotificationManager.GetPolicyData(base.User);
                if (policyData != null && !policyData.AttachmentsEnabled)
                {
                    base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentsNotEnabledGetAttCmd");
                    throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false);
                }
                Unlimited <ByteQuantifiedSize> maxAttachmentSize = (policyData != null) ? policyData.MaxAttachmentSize : Unlimited <ByteQuantifiedSize> .UnlimitedValue;
                value = AttachmentHelper.GetAttachment(base.MailboxSession, attachmentName, base.OutputStream, maxAttachmentSize, itemIdMapping, out incBy);
                base.ProtocolLogger.IncrementValue(ProtocolLoggerData.Attachments);
                base.ProtocolLogger.IncrementValueBy(ProtocolLoggerData.AttachmentBytes, incBy);
            }
            catch (FormatException innerException)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidAttachmentName");
                AirSyncPermanentException ex = new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException, false);
                throw ex;
            }
            catch (ObjectNotFoundException innerException2)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentNotFound");
                AirSyncPermanentException ex2 = new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.None, innerException2, false);
                throw ex2;
            }
            catch (IOException innerException3)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "IOException");
                throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.None, innerException3, false);
            }
            catch (DataTooLargeException innerException4)
            {
                base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AttachmentIsTooLarge");
                PolicyData policyData2 = ADNotificationManager.GetPolicyData(base.User);
                if (policyData2 != null)
                {
                    policyData2.MaxAttachmentSize.ToString();
                }
                else
                {
                    GlobalSettings.MaxDocumentDataSize.ToString(CultureInfo.InvariantCulture);
                }
                throw new AirSyncPermanentException(HttpStatusCode.RequestEntityTooLarge, StatusCode.AttachmentIsTooLarge, innerException4, false);
            }
            finally
            {
                if (folderSyncState != null)
                {
                    folderSyncState.Dispose();
                    folderSyncState = null;
                }
            }
            base.Context.Response.AppendHeader("Content-Type", value);
            return(Command.ExecutionState.Complete);
        }