Ejemplo n.º 1
0
        // 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);
        }
 private static string BuildEASProvisionDoc(IPolicyData mailboxPolicy, int deviceVersion, out bool policyIsCompatibleWithDevice)
 {
     policyIsCompatibleWithDevice = true;
     if (mailboxPolicy == null)
     {
         return(null);
     }
     return(ProvisionCommandPhaseOne.BuildEASProvisionDoc(deviceVersion, out policyIsCompatibleWithDevice, mailboxPolicy));
 }
        private bool ProcessPolicy(XmlNode response)
        {
            uint?headerPolicyKey = this.owningCommand.HeaderPolicyKey;

            base.GlobalInfo.ProvisionSupported = true;
            bool flag;

            Command.DetectPolicyChange(this.owningCommand.PolicyData, base.GlobalInfo, this.owningCommand.ProtocolVersion, out flag);
            if (!flag)
            {
                this.owningCommand.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeviceNotFullyProvisionable");
                this.owningCommand.SetErrorResponse(HttpStatusCode.Forbidden, StatusCode.DeviceNotFullyProvisionable);
                base.GlobalInfo.DevicePolicyApplicationStatus = DevicePolicyApplicationStatus.NotApplied;
                return(false);
            }
            if (this.requestPolicyType != null)
            {
                if (this.deviceInformationNode == null && this.owningCommand.ProtocolVersion >= 141)
                {
                    throw new AirSyncPermanentException(StatusCode.DeviceInformationRequired, false)
                          {
                              ErrorStringForProtocolLogger = "DeviceInfoRequiredInProvision"
                          };
                }
                if (string.Equals(this.requestPolicyType, "MS-WAP-Provisioning-XML", StringComparison.OrdinalIgnoreCase))
                {
                    if (this.owningCommand.ProtocolVersion > 25)
                    {
                        this.owningCommand.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "CannotUseWAP");
                        this.responseProvisionStatus = ProvisionCommand.ProvisionStatusCode.ProtocolError;
                        base.GlobalInfo.DevicePolicyApplicationStatus = DevicePolicyApplicationStatus.NotApplied;
                        return(true);
                    }
                    if (base.GlobalInfo.PolicyKeyNeeded != 0U || (string.Equals(this.requestPolicyType, "MS-WAP-Provisioning-XML", StringComparison.OrdinalIgnoreCase) && headerPolicyKey != null && headerPolicyKey != 0U))
                    {
                        this.responsePolicyType = this.requestPolicyType;
                        IPolicyData policyData = this.owningCommand.PolicyData;
                        this.responsePolicyData   = ProvisionCommandPhaseOne.BuildWAPProvisionDoc(policyData);
                        this.responsePolicyStatus = ProvisionCommand.PolicyStatusCode.Success;
                        this.responsePolicyKey    = new uint?(base.GlobalInfo.PolicyKeyWaitingAck);
                    }
                    else
                    {
                        this.responsePolicyStatus = ProvisionCommand.PolicyStatusCode.NoPolicy;
                        this.responsePolicyType   = this.requestPolicyType;
                    }
                }
                else if (string.Equals(this.requestPolicyType, "MS-EAS-Provisioning-WBXML", StringComparison.OrdinalIgnoreCase))
                {
                    if (base.GlobalInfo.PolicyKeyNeeded != 0U)
                    {
                        this.responsePolicyType = this.requestPolicyType;
                        IPolicyData policyData2 = this.owningCommand.PolicyData;
                        this.responsePolicyData   = ProvisionCommandPhaseOne.BuildEASProvisionDoc(policyData2, this.owningCommand.ProtocolVersion, out flag);
                        this.responsePolicyStatus = ProvisionCommand.PolicyStatusCode.Success;
                        this.responsePolicyKey    = new uint?(base.GlobalInfo.PolicyKeyWaitingAck);
                    }
                    else if (base.GlobalInfo.PolicyKeyOnDevice != 0U || (string.Equals(this.requestPolicyType, "MS-EAS-Provisioning-WBXML", StringComparison.OrdinalIgnoreCase) && headerPolicyKey != null && headerPolicyKey != 0U))
                    {
                        this.responsePolicyType   = this.requestPolicyType;
                        this.responsePolicyData   = "<eas-provisioningdoc xmlns=\"Provision:\"><DevicePasswordEnabled>0</DevicePasswordEnabled></eas-provisioningdoc>";
                        this.responsePolicyStatus = ProvisionCommand.PolicyStatusCode.Success;
                        this.responsePolicyKey    = new uint?(base.GlobalInfo.PolicyKeyWaitingAck);
                    }
                    else
                    {
                        this.responsePolicyStatus = ProvisionCommand.PolicyStatusCode.NoPolicy;
                        this.responsePolicyType   = this.requestPolicyType;
                    }
                }
                else
                {
                    if (this.requestPolicyType.Length == 0)
                    {
                        base.GlobalInfo.DevicePolicyApplicationStatus = DevicePolicyApplicationStatus.NotApplied;
                        this.responseProvisionStatus = ProvisionCommand.ProvisionStatusCode.ProtocolError;
                        return(true);
                    }
                    base.GlobalInfo.DevicePolicyApplicationStatus = DevicePolicyApplicationStatus.NotApplied;
                    this.responsePolicyType      = this.requestPolicyType;
                    this.responsePolicyStatus    = ProvisionCommand.PolicyStatusCode.UnknownPolicyType;
                    this.responseProvisionStatus = ProvisionCommand.ProvisionStatusCode.Success;
                    return(true);
                }
            }
            this.responseProvisionStatus = ProvisionCommand.ProvisionStatusCode.Success;
            return(true);
        }