// 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: 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);
        }
Ejemplo n.º 3
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;
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        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);
        }