protected override void ConvertSyncIdsToXsoIds(FolderCommand.FolderRequest folderRequest) { SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(folderRequest.SyncServerId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteOfVFolder"); AirSyncPermanentException ex = new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, base.ConstructErrorXml(StatusCode.Sync_InvalidSyncKey), null, false); throw ex; } SyncPermissions syncPermissions; folderRequest.ServerId = base.GetXsoFolderId(folderRequest.SyncServerId, out syncPermissions); if (folderRequest.ServerId == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteOfInvalidId"); AirSyncPermanentException ex2 = new AirSyncPermanentException(StatusCode.Sync_ProtocolError, base.ConstructErrorXml(StatusCode.Sync_ProtocolError), null, false); throw ex2; } if (syncPermissions == SyncPermissions.FullAccess) { return; } if (base.Version < 140) { throw new InvalidOperationException("Pre-Version 14 device should not see a non-FullAccess folder! Folder Access Level: " + syncPermissions); } base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DeleteOfNonFullAccessFolder"); AirSyncPermanentException ex3 = new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, base.ConstructErrorXml(StatusCode.Sync_InvalidSyncKey), null, false); throw ex3; }
private StoreObjectId GetStoreObjectId(string folderId) { SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(folderId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { throw new AirSyncPermanentException(StatusCode.InvalidCombinationOfIDs, false) { ErrorStringForProtocolLogger = "BadIdComboInConversationMove" }; } if (this.folderIdMapping == null) { using (CustomSyncState customSyncState = this.syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0])) { if (customSyncState == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoSyncStateInConversationMove" }; } if (customSyncState[CustomStateDatumType.IdMapping] == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoIdMappingInConversationMove" }; } this.folderIdMapping = (FolderIdMapping)customSyncState[CustomStateDatumType.IdMapping]; this.fullFolderTree = (FolderTree)customSyncState[CustomStateDatumType.FullFolderTree]; } } ISyncItemId syncItemId = this.folderIdMapping[folderId]; if (syncItemId == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoFldrIdInMappingInConversationMove" }; } MailboxSyncItemId mailboxSyncItemId = syncItemId as MailboxSyncItemId; if (mailboxSyncItemId == null) { throw new AirSyncPermanentException(StatusCode.InvalidIDs, false) { ErrorStringForProtocolLogger = "BadIdInConversationMove" }; } if (this.fullFolderTree.IsSharedFolder(mailboxSyncItemId) || this.fullFolderTree.GetPermissions(mailboxSyncItemId) != SyncPermissions.FullAccess) { throw new AirSyncPermanentException(StatusCode.Sync_Retry, false) { ErrorStringForProtocolLogger = "DeniedInConversationMove" }; } return((StoreObjectId)mailboxSyncItemId.NativeId); }
// Token: 0x06000C3C RID: 3132 RVA: 0x00040194 File Offset: 0x0003E394 protected override int InternalExecute(int count) { FolderSyncState folderSyncState = null; int result; try { string text = HttpUtility.UrlDecode(base.FileReference); int num = text.IndexOf(':'); ItemIdMapping itemIdMapping = null; if (num != -1 && num != text.LastIndexOf(':')) { string text2 = text.Substring(0, num); SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(text2); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NoAttachmentsOnVItem"); AirSyncPermanentException ex = new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidCombinationOfIDs, null, false); throw ex; } folderSyncState = base.SyncStateStorage.GetFolderSyncState(new MailboxSyncProviderFactory(base.Session), text2); if (folderSyncState == null) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(text)); } itemIdMapping = (ItemIdMapping)folderSyncState[CustomStateDatumType.IdMapping]; if (itemIdMapping == null) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(text)); } } int num2; base.ContentType = AttachmentHelper.GetAttachment(base.Session, text, base.OutStream, base.MinRange, count, base.MaxAttachmentSize, itemIdMapping, base.RightsManagementSupport, out num2); result = num2; } finally { if (folderSyncState != null) { folderSyncState.Dispose(); folderSyncState = null; } } return(result); }
// Token: 0x06000763 RID: 1891 RVA: 0x000291AC File Offset: 0x000273AC private StoreObjectId GetStoreObjectId(string folderId) { if (this.folderIdMapping == null) { using (CustomSyncState customSyncState = this.syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0])) { if (customSyncState == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoSyncStateInEmptyFolder" }; } if (customSyncState[CustomStateDatumType.IdMapping] == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoIdMappingInEmptyFolder" }; } this.folderIdMapping = (FolderIdMapping)customSyncState[CustomStateDatumType.IdMapping]; } } SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(folderId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { throw new AirSyncPermanentException(StatusCode.Sync_Retry, false) { ErrorStringForProtocolLogger = "SpecialFolderInEmptyFolder" }; } MailboxSyncItemId mailboxSyncItemId = this.folderIdMapping[folderId] as MailboxSyncItemId; if (mailboxSyncItemId == null) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, false) { ErrorStringForProtocolLogger = "NoIdMappingInEmptyFolder2" }; } return((StoreObjectId)mailboxSyncItemId.NativeId); }
// Token: 0x06000C42 RID: 3138 RVA: 0x00040AC0 File Offset: 0x0003ECC0 public void ParseRequest(XmlNode fetchNode) { foreach (object obj in fetchNode.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; string name; switch (name = xmlNode.Name) { case "LongId": this.longId = xmlNode.InnerText; continue; case "ServerId": this.serverId = xmlNode.InnerText; continue; case "CollectionId": this.collectionId = xmlNode.InnerText; continue; case "Options": this.ParseOptions(xmlNode); continue; case "RemoveRightsManagementProtection": if (string.IsNullOrEmpty(xmlNode.InnerText)) { this.removeRightsManagementProtection = true; continue; } if (xmlNode.InnerText.Equals("1")) { this.removeRightsManagementProtection = true; continue; } if (xmlNode.InnerText.Equals("0")) { this.removeRightsManagementProtection = false; continue; } throw new AirSyncPermanentException(false) { ErrorStringForProtocolLogger = "InvalidRemoveRightsManagementProtection(" + xmlNode.InnerText + ")" }; case "Store": continue; } throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "BadRequestNode(" + xmlNode.Name + ")InMbxFetch" }; } if (this.longId != null) { if (this.serverId != null || this.collectionId != null) { throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "IdCollisionInMbxFetch" }; } } else { if (string.IsNullOrEmpty(this.serverId) || string.IsNullOrEmpty(this.collectionId)) { throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "NoIdInMbxFetch" }; } SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(this.collectionId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { throw new AirSyncPermanentException(StatusCode.InvalidCombinationOfIDs, false) { ErrorStringForProtocolLogger = "BadCollectionIdInMbxFetch" }; } } if (this.removeRightsManagementProtection && !this.rightsManagementSupport) { throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "RemoveRestrictionWithoutRightsManagementSupport" }; } }
// Token: 0x06001561 RID: 5473 RVA: 0x0007D91C File Offset: 0x0007BB1C protected StoreObjectId GetSmartItemId() { this.ParseXmlRequest(); string collectionId = this.CollectionId; string itemId = this.ItemId; string longId = this.LongId; StoreObjectId storeObjectId = null; FolderSyncState folderSyncState = null; StoreObjectId result; try { if (longId != null) { if (base.Version < 120) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LongIdSupportedinV12Only"); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidCombinationOfIDs, null, false); } try { storeObjectId = StoreObjectId.Deserialize(longId); goto IL_1F1; } catch (ArgumentException innerException) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException, false); } catch (FormatException innerException2) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId2"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException2, false); } catch (CorruptDataException innerException3) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidLongId3"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.InvalidIDs, innerException3, false); } } if (collectionId == null) { StoreObjectId defaultFolderId = base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); MailboxSyncProviderFactory syncProviderFactory = new MailboxSyncProviderFactory(base.MailboxSession, defaultFolderId); folderSyncState = base.SyncStateStorage.GetFolderSyncState(syncProviderFactory); } else { SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(collectionId); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SendFromVirtualFolder"); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidCombinationOfIDs, null, false); } folderSyncState = base.SyncStateStorage.GetFolderSyncState(collectionId); } if (folderSyncState == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "SyncStateNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateNotFound, null, false); } ItemIdMapping itemIdMapping = (ItemIdMapping)folderSyncState[CustomStateDatumType.IdMapping]; if (itemIdMapping == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemIdMappingNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemNotFound, null, false); } MailboxSyncItemId mailboxSyncItemId = itemIdMapping[itemId] as MailboxSyncItemId; storeObjectId = ((mailboxSyncItemId == null) ? null : ((StoreObjectId)mailboxSyncItemId.NativeId)); if (storeObjectId == null) { base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ItemIdMappingNotFound"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ItemNotFound, null, false); } folderSyncState.Dispose(); folderSyncState = null; IL_1F1: result = storeObjectId; } finally { if (folderSyncState != null) { folderSyncState.Dispose(); } } return(result); }
public void ParseQueryNode(XmlElement queryNode) { this.searchCriteriaBuilder = new MailboxSearchCriteriaBuilder(this.context.Request.Culture); if (!this.mailboxSession.Mailbox.IsContentIndexingEnabled) { AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_ContentIndexingNotEnabled, "ContentIndexingNotEnabled", new string[] { this.mailboxSession.MailboxOwner.MailboxInfo.Location.ServerFqdn }); } this.queryFilter = this.searchCriteriaBuilder.ParseTopLevelClassAndFolders(queryNode, this.mailboxSession.Mailbox.IsContentIndexingEnabled, this.versionFactory, this.context); this.schemaCache = this.searchCriteriaBuilder.SchemaCache; if (this.FolderIdMappingSyncState == null || !this.FolderIdMappingSyncState.Contains(CustomStateDatumType.FullFolderTree)) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.AlgorithmTracer, this, "FolderIdMappingSyncState error: {0}", (this.FolderIdMappingSyncState != null) ? "no FullFolderTree" : "FolderIdMappingSyncState is null"); throw new SearchNeedToFolderSyncException(); } List <string> list = this.searchCriteriaBuilder.FolderScope; FolderIdMapping folderIdMapping = (FolderIdMapping)this.FolderIdMappingSyncState[CustomStateDatumType.IdMapping]; FolderTree folderTree = (FolderTree)this.FolderIdMappingSyncState[CustomStateDatumType.FullFolderTree]; if (list.Count == 0) { this.folderScope = new StoreId[] { this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Root) }; } else { int num = 0; this.folderScope = new StoreId[list.Count]; foreach (string text in list) { StoreObjectId storeObjectId = null; if (text == "0") { storeObjectId = this.mailboxSession.GetDefaultFolderId(DefaultFolderType.Root); } else { SyncCollection.CollectionTypes collectionType = AirSyncUtility.GetCollectionType(text); if (collectionType != SyncCollection.CollectionTypes.Mailbox && collectionType != SyncCollection.CollectionTypes.Unknown) { throw new AirSyncPermanentException(StatusCode.InvalidCombinationOfIDs, false) { ErrorStringForProtocolLogger = "BadIdComboInMbxSearch" }; } MailboxSyncItemId mailboxSyncItemId = folderIdMapping[text] as MailboxSyncItemId; if (mailboxSyncItemId != null) { if (folderTree.IsSharedFolder(mailboxSyncItemId)) { throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false) { ErrorStringForProtocolLogger = "AccessDeniedInMbxSearch" }; } storeObjectId = (StoreObjectId)mailboxSyncItemId.NativeId; } } if (storeObjectId == null) { throw new SearchNeedToFolderSyncException(); } try { using (Folder.Bind(this.mailboxSession, storeObjectId)) { } } catch (ObjectNotFoundException) { throw new SearchNeedToFolderSyncException(); } this.folderScope[num++] = storeObjectId; } } foreach (object obj in folderTree) { ISyncItemId syncItemId = (ISyncItemId)obj; MailboxSyncItemId mailboxSyncItemId2 = syncItemId as MailboxSyncItemId; if (mailboxSyncItemId2 != null && (folderTree.IsHidden(syncItemId) || folderTree.IsSharedFolder(syncItemId))) { this.searchCriteriaBuilder.ExcludedFolders.Add((StoreObjectId)mailboxSyncItemId2.NativeId); } } if (this.mailboxSchemaOptions.HasBodyPartPreferences) { if (this.searchCriteriaBuilder.Conversation == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.AlgorithmTracer, this, "<BodyPartPreference> is only supported when search for ConversationId"); throw new AirSyncPermanentException(StatusCode.Sync_ObjectNotFound, false) { ErrorStringForProtocolLogger = "BodyPartNotSupported" }; } this.searchCriteriaBuilder.Conversation.LoadBodySummaries(); } }