// Token: 0x0600173C RID: 5948 RVA: 0x0008A8F8 File Offset: 0x00088AF8 public EntitySyncProvider(Folder folder, bool trackReadFlagChanges, bool trackAssociatedMessageChanges, bool returnNewestFirst, bool trackConversations, bool allowTableRestrict, bool disposeFolder) : base(folder, trackReadFlagChanges, trackAssociatedMessageChanges, returnNewestFirst, trackConversations, allowTableRestrict, disposeFolder, AirSyncDiagnostics.GetSyncLogger()) { }
// Token: 0x0600037C RID: 892 RVA: 0x00014BD0 File Offset: 0x00012DD0 private static string GetAttachmentByUrlCompName(MailboxSession mailboxSession, string attachmentId, Stream outStream, int offset, int count, Unlimited <ByteQuantifiedSize> maxAttachmentSize, out int total) { attachmentId = "/" + attachmentId; int andCheckLastSlashLocation = AttachmentHelper.GetAndCheckLastSlashLocation(attachmentId, attachmentId); string text = attachmentId.Substring(0, andCheckLastSlashLocation); string text2 = attachmentId.Substring(andCheckLastSlashLocation + 1); andCheckLastSlashLocation = AttachmentHelper.GetAndCheckLastSlashLocation(text, attachmentId); string propertyValue = text.Substring(0, andCheckLastSlashLocation); StoreId storeId = null; QueryFilter seekFilter = new ComparisonFilter(ComparisonOperator.Equal, FolderSchema.UrlName, propertyValue); using (Folder folder = Folder.Bind(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Root))) { using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.DeepTraversal, AirSyncUtility.XsoFilters.GetHierarchyFilter, null, AttachmentHelper.folderPropertyIds)) { if (queryResult.SeekToCondition(SeekReference.OriginBeginning, seekFilter)) { object[][] rows = queryResult.GetRows(1); storeId = (rows[0][0] as StoreId); } } } if (storeId == null) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId)); } AirSyncDiagnostics.TraceDebug <StoreId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with parentStoreId {0}.", storeId); StoreId storeId2 = null; seekFilter = new ComparisonFilter(ComparisonOperator.Equal, FolderSchema.UrlName, text); using (Folder folder2 = Folder.Bind(mailboxSession, storeId)) { using (QueryResult queryResult2 = folder2.ItemQuery(ItemQueryType.None, null, null, AttachmentHelper.itemPropertyIds)) { if (queryResult2.SeekToCondition(SeekReference.OriginBeginning, seekFilter)) { object[][] rows2 = queryResult2.GetRows(1); storeId2 = (rows2[0][0] as StoreId); } } } if (storeId2 == null) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId)); } AirSyncDiagnostics.TraceDebug <StoreId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with itemStoreId {0}.", storeId2); PropertyTagPropertyDefinition propertyTagPropertyDefinition = PropertyTagPropertyDefinition.CreateCustom("UrlCompName", 284360734U); string attachmentItself; using (Item item = Item.Bind(mailboxSession, storeId2)) { AttachmentCollection attachmentCollection = item.AttachmentCollection; attachmentCollection.Load(new PropertyDefinition[] { propertyTagPropertyDefinition }); AttachmentId attachmentId2 = null; foreach (AttachmentHandle handle in attachmentCollection) { using (Attachment attachment = attachmentCollection.Open(handle)) { if (text2.Equals((string)attachment[propertyTagPropertyDefinition], StringComparison.Ordinal)) { attachmentId2 = attachment.Id; break; } } } if (attachmentId2 == null) { foreach (AttachmentHandle handle2 in attachmentCollection) { using (Attachment attachment2 = attachmentCollection.Open(handle2)) { string str = (string)attachment2[propertyTagPropertyDefinition]; if (text2.EndsWith("_" + str, StringComparison.Ordinal)) { attachmentId2 = attachment2.Id; break; } } } } if (attachmentId2 == null) { throw new ObjectNotFoundException(ServerStrings.MapiCannotOpenAttachmentId(attachmentId)); } AirSyncDiagnostics.TraceDebug <AttachmentId>(ExTraceGlobals.RequestsTracer, null, "Getting attachment with attachment ID {0}.", attachmentId2); using (Attachment attachment3 = attachmentCollection.Open(attachmentId2)) { if (!maxAttachmentSize.IsUnlimited && attachment3.Size > (long)maxAttachmentSize.Value.ToBytes()) { throw new DataTooLargeException(StatusCode.AttachmentIsTooLarge); } attachmentItself = AttachmentHelper.GetAttachmentItself(attachment3, outStream, offset, count, out total); } } return(attachmentItself); }
// Token: 0x060009E6 RID: 2534 RVA: 0x0003A5BC File Offset: 0x000387BC private void ReadXmlRequest() { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "GIE.ReadXmlRequest"); XmlNode xmlRequest = base.XmlRequest; XmlNode xmlNode = xmlRequest["Collections", "GetItemEstimate:"]; if (xmlNode.ChildNodes.Count >= GlobalSettings.MaxNumOfFolders) { AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, this, "GIE: client specified too many folders: {0}", GlobalSettings.MaxNumOfFolders); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidXML, null, false) { ErrorStringForProtocolLogger = "GIE.TooManyFolders" }; } foreach (object obj in xmlNode.ChildNodes) { XmlNode xmlNode2 = (XmlNode)obj; SyncCollection syncCollection = null; bool flag = false; try { if (base.Version >= 140) { syncCollection = SyncCollection.ParseCollection(null, xmlNode2, base.Version, base.MailboxSession); } else { XmlNode xmlNode3 = xmlNode2["CollectionId"]; string collectionId = (xmlNode3 == null) ? null : xmlNode3.InnerText; syncCollection = SyncCollection.CreateSyncCollection(base.MailboxSession, base.Version, collectionId); foreach (object obj2 in xmlNode2.ChildNodes) { XmlNode xmlNode4 = (XmlNode)obj2; string localName; if ((localName = xmlNode4.LocalName) != null) { if (!(localName == "Class")) { if (localName == "SyncKey") { syncCollection.SyncKeyString = xmlNode4.InnerText; continue; } if (localName == "CollectionId") { syncCollection.CollectionId = xmlNode4.InnerText; continue; } if (localName == "FilterType") { int num; if (!int.TryParse(xmlNode4.InnerText, out num) || num > 8 || num < 0) { base.GlobalStatus = SyncBase.ErrorCodeStatus.ProtocolError; base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidFilterValue"); throw new AirSyncPermanentException(false); } syncCollection.FilterType = (AirSyncV25FilterTypes)num; syncCollection.HasFilterNode = true; continue; } } else { string innerText = xmlNode4.InnerText; string a; if ((a = innerText) != null && (a == "Email" || a == "Calendar" || a == "Contacts" || a == "Tasks" || a == "Notes")) { syncCollection.ClassType = innerText; continue; } base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "InvalidClassType"); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.UnexpectedItemClass, null, false); } } base.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadNodeInRequest"); throw new AirSyncPermanentException(HttpStatusCode.BadRequest, StatusCode.InvalidXML, null, false); } } base.Collections[syncCollection.InternalName] = syncCollection; flag = true; } finally { if (syncCollection != null && !flag) { syncCollection.Dispose(); syncCollection = null; } } } }
// Token: 0x060000B8 RID: 184 RVA: 0x00007D00 File Offset: 0x00005F00 private MobileDevice CreateMobileDevice(GlobalInfo globalInfo, ExDateTime syncStorageCreationTime, bool checkForMaxDevices, bool retryIfFailed, MailboxSession mailboxSession) { ActiveSyncDevices activeSyncDevices = this.GetActiveSyncDeviceContainer(); if (activeSyncDevices == null) { activeSyncDevices = this.CreateActiveSyncDeviceContainer(true); } AirSyncDiagnostics.TraceInfo <MobileClientType, DeviceIdentity, string>(ExTraceGlobals.RequestsTracer, null, "ADDeviceManager::CreateMobileDevice - ClientType: {0}, DeviceIdentity: {1}, mailboxSession from: {2}", this.clientType, this.deviceIdentity, (mailboxSession == null) ? "CurrentCommand" : "parameter"); this.CleanUpOldDevices(mailboxSession ?? Command.CurrentCommand.MailboxSession); MobileDevice mobileDevice = this.InternalCreateDevice(globalInfo, syncStorageCreationTime); IThrottlingPolicy throttlingPolicy = (this.budget != null) ? this.budget.ThrottlingPolicy : null; if (checkForMaxDevices && throttlingPolicy != null) { if (!throttlingPolicy.EasMaxDevices.IsUnlimited) { MobileDevice[] easDevices = null; ADNotificationAdapter.RunADOperation(delegate() { easDevices = this.session.Find <MobileDevice>(MobileDevice.GetRootId(this.userId), QueryScope.OneLevel, new ComparisonFilter(ComparisonOperator.LessThanOrEqual, ADObjectSchema.ExchangeVersion, ExchangeObjectVersion.Exchange2012), null, 0); }); if (this.protocolLogger != null) { this.protocolLogger.SetValue(ProtocolLoggerData.DomainController, this.session.LastUsedDc); } if (easDevices != null && (long)easDevices.Length >= (long)((ulong)throttlingPolicy.EasMaxDevices.Value)) { this.SendMaxDevicesExceededMailIfNeeded(easDevices.Length, throttlingPolicy.EasMaxDevices.Value); throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.MaximumDevicesReached, null, false) { ErrorStringForProtocolLogger = "MaxDevicesExceeded" }; } } else { AirSyncDiagnostics.TraceDebug(this.tracer, this, "throttlingPolicy.EasMaxDevices is unlimited. Skipping max devices check."); } } else { AirSyncDiagnostics.TraceDebug(this.tracer, this, "No throttling policy is found. Skipping max devices check."); } switch (mobileDevice.ClientType) { case MobileClientType.EAS: mobileDevice.SetId(activeSyncDevices.Id.GetChildId(ADDeviceManager.EasDeviceCnString(mobileDevice))); break; case MobileClientType.MOWA: mobileDevice.SetId(activeSyncDevices.Id.GetChildId(ADDeviceManager.MowaDeviceCnString(mobileDevice))); break; default: throw new PlatformNotSupportedException("New MobileClientType is not supported."); } try { ADNotificationAdapter.RunADOperation(delegate() { this.session.Save(mobileDevice); }); } catch (ADObjectAlreadyExistsException) { mobileDevice = this.GetMobileDevice(); if (mobileDevice == null) { throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, EASServerStrings.FailedToCreateNewActiveDevice(this.deviceIdentity.DeviceId, this.deviceIdentity.DeviceType, this.userName), true) { ErrorStringForProtocolLogger = "CreateActiveSyncDevice:ADObjectAlreadyExistsException" }; } if (globalInfo != null) { this.UpdateMobileDevice(mobileDevice, globalInfo); } } catch (ADOperationException ex) { DirectoryOperationException ex2 = ex.InnerException as DirectoryOperationException; if (retryIfFailed) { if (ex.ErrorCode != 5) { if (ex2 == null || ex2.Response == null || ex2.Response.ResultCode != ResultCode.InsufficientAccessRights) { goto IL_308; } } try { this.SetActiveSyncDeviceContainerPermissions(activeSyncDevices); } catch (ADOperationException ex3) { throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, EASServerStrings.FailedToApplySecurityToContainer(activeSyncDevices.DistinguishedName), ex3, true) { ErrorStringForProtocolLogger = "SetEASDevContainerPerms:ADOperationException:" + ex3.Message }; } return(this.CreateMobileDevice(globalInfo, syncStorageCreationTime, checkForMaxDevices, false, mailboxSession)); } IL_308: AirSyncDiagnostics.LogEvent(this.unableToCreateADDeviceEventTuple, new string[] { mobileDevice.DeviceType, mobileDevice.DeviceId, activeSyncDevices.Id.ToDNString(), ex.Message }); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, ex, false) { ErrorStringForProtocolLogger = "CreateActiveSyncDevice:ADOperationException" + ex.Message }; } return(mobileDevice); }
internal override Command.ExecutionState ExecuteCommand() { MessageItem messageItem = null; bool flag = false; DeleteItemFlags deletedItemFlag = DeleteItemFlags.HardDelete; try { base.ValidateBody(); StoreObjectId defaultFolderId = base.MailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts); messageItem = MessageItem.Create(base.MailboxSession, defaultFolderId); base.ParseMimeToMessage(messageItem); Guid guid; if (base.IsIrmOperation(out guid)) { RmsTemplate rmsTemplate = RmsTemplateReaderCache.LookupRmsTemplate(base.User.OrganizationId, guid); if (rmsTemplate == null) { AirSyncDiagnostics.TraceError <Guid>(ExTraceGlobals.RequestsTracer, this, "Template {0} not found in cache", guid); throw new AirSyncPermanentException(StatusCode.IRM_InvalidTemplateID, false) { ErrorStringForProtocolLogger = "smcEInvalidTemplateID" }; } messageItem = RightsManagedMessageItem.Create(messageItem, AirSyncUtility.GetOutboundConversionOptions()); RightsManagedMessageItem rightsManagedMessageItem = messageItem as RightsManagedMessageItem; rightsManagedMessageItem.SetRestriction(rmsTemplate); rightsManagedMessageItem.Sender = new Participant(base.MailboxSession.MailboxOwner); } Command.CurrentCommand.ProtocolLogger.SetValue(ProtocolLoggerData.ClassName, messageItem.ClassName); if (!GlobalSettings.OnlyOrganizersCanSendMeetingChanges || !this.IsMeetingRelatedMessage(messageItem)) { base.SendMessage(messageItem); flag = true; } else { bool flag2 = this.CanSendMessage(messageItem); if (GlobalSettings.GetGoidFromCalendarItemForMeetingResponse && base.Version < 160 && this.IsResponseMessageToSingleMeeting(messageItem)) { GlobalObjectId goidFromItem = this.GetGoidFromItem(messageItem); try { ResponseType valueOrDefault = messageItem.GetValueOrDefault <ResponseType>(MeetingResponseSchema.ResponseType); DefaultFolderType defaultFolderType = (valueOrDefault == ResponseType.Decline) ? DefaultFolderType.DeletedItems : DefaultFolderType.Calendar; List <PropertyBag> list = this.QueryRelatedCalendarItems(defaultFolderType, goidFromItem); if (list.Count == 0 && valueOrDefault == ResponseType.Decline) { list = this.QueryRelatedCalendarItems(DefaultFolderType.Calendar, goidFromItem); if (list.Count == 0) { list = this.QueryRelatedCalendarItems(DefaultFolderType.DeletedItems, goidFromItem); } } this.FindAndSetMessageGoid(list, messageItem, goidFromItem); } catch (Exception ex) { AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, this, "GetRelatedCalendarItemGoid threw exception {0}", ex); AirSyncDiagnostics.SendInMemoryTraceWatson(ex); } } if (flag2) { base.SendMessage(messageItem); flag = true; } else { AirSyncDiagnostics.TraceDebug <Participant>(ExTraceGlobals.RequestsTracer, this, "Attempt to send meeting cancellation by attendee. Sender {0}", messageItem.Sender); messageItem.ClassName = "IPM.Note"; messageItem.Save(SaveMode.NoConflictResolution); deletedItemFlag = DeleteItemFlags.MoveToDeletedItems; Command.CurrentCommand.ProtocolLogger.SetValue(ProtocolLoggerData.SkipSend, true.ToString()); } } } finally { if (messageItem != null) { if (!flag) { base.DeleteMessage(messageItem, deletedItemFlag); } messageItem.Dispose(); } } return(Command.ExecutionState.Complete); }
// Token: 0x06000AAA RID: 2730 RVA: 0x0003B168 File Offset: 0x00039368 public static GlobalInfo LoadFromMailbox(MailboxSession mailboxSession, SyncStateStorage syncStateStorage, ProtocolLogger protocolLogger, out bool updateUserHasPartnership) { if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } if (syncStateStorage == null) { throw new ArgumentNullException("syncStateStorage"); } updateUserHasPartnership = false; CustomSyncState customSyncState = null; GlobalInfo globalInfo = null; bool isDirty = false; bool hasNewSyncData = false; bool hasNewAutdData = false; bool isSyncStateJustUpgraded = false; bool flag = false; GlobalInfo result; try { GlobalSyncStateInfo syncStateInfo = new GlobalSyncStateInfo(); customSyncState = syncStateStorage.GetCustomSyncState(syncStateInfo, GlobalInfo.ExtraGlobalInfoPropertiesToFetch); if (customSyncState == null) { isDirty = true; using (CustomSyncState customSyncState2 = syncStateStorage.GetCustomSyncState(new FolderIdMappingSyncStateInfo(), new PropertyDefinition[0])) { if (customSyncState2 == null) { updateUserHasPartnership = true; syncStateStorage.DeleteAllSyncStates(); } } customSyncState = syncStateStorage.CreateCustomSyncState(syncStateInfo); isDirty = true; } else { try { object obj = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastSyncAttemptTime); hasNewSyncData = (obj != null && !(obj is PropertyError)); } catch (Exception arg) { AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties. Exception: {0}", arg); } try { object obj2 = customSyncState.StoreObject.TryGetProperty(AirSyncStateSchema.LastPingHeartbeatInterval); hasNewAutdData = (obj2 != null && !(obj2 is PropertyError)); } catch (Exception arg2) { AirSyncDiagnostics.TraceError <Exception>(ExTraceGlobals.RequestsTracer, null, "[GlobalInfo.LoadFromMailbox] Encountered exception when checking for new syncStatus properties. Exception: {0}", arg2); } if (customSyncState.BackendVersion != null && customSyncState.BackendVersion.Value != customSyncState.Version) { isDirty = true; isSyncStateJustUpgraded = true; if (protocolLogger != null) { protocolLogger.SetValue(ProtocolLoggerData.Ssu, "2007"); } } } globalInfo = new GlobalInfo(customSyncState); globalInfo.IsDirty = isDirty; globalInfo.HasNewSyncData = hasNewSyncData; globalInfo.HasNewAutdData = hasNewAutdData; globalInfo.IsSyncStateJustUpgraded = isSyncStateJustUpgraded; if (Command.CurrentCommand != null) { globalInfo.WriteNewSyncData = Command.CurrentCommand.User.Features.IsEnabled(EasFeature.SyncStatusOnGlobalInfo); } flag = true; result = globalInfo; } finally { if (!flag) { if (globalInfo != null) { globalInfo.Dispose(); } else if (customSyncState != null) { customSyncState.Dispose(); } } } return(result); }
// Token: 0x060000B5 RID: 181 RVA: 0x000074E8 File Offset: 0x000056E8 internal ActiveSyncDevices GetActiveSyncDeviceContainer() { ADDeviceManager.< > c__DisplayClassf CS$ < > 8__locals1 = new ADDeviceManager.< > c__DisplayClassf(); CS$ < > 8__locals1.< > 4__this = this; CS$ < > 8__locals1.filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "ExchangeActiveSyncDevices"); CS$ < > 8__locals1.containers = null; ADNotificationAdapter.RunADOperation(delegate() { CS$ < > 8__locals1.containers = CS$ < > 8__locals1.< > 4__this.session.Find <ActiveSyncDevices>(CS$ < > 8__locals1.< > 4__this.userId, QueryScope.OneLevel, CS$ < > 8__locals1.filter, ADDeviceManager.defaultSortOrder, 50); }); if (this.protocolLogger != null) { this.protocolLogger.SetValue(ProtocolLoggerData.DomainController, this.session.LastUsedDc); } if (CS$ < > 8__locals1.containers.Length == 1) { return(CS$ < > 8__locals1.containers[0]); } if (CS$ < > 8__locals1.containers.Length == 0) { return(null); } AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "User \"{0}\" has more than one device container.", this.userName); if (this.protocolLogger != null) { this.protocolLogger.SetValue(ProtocolLoggerData.Error, "TooManyDeviceContainers"); } int num = -1; int i = 0; while (i < CS$ < > 8__locals1.containers.Length) { if (!CS$ < > 8__locals1.containers[i].Id.Rdn.EscapedName.Equals("ExchangeActiveSyncDevices") || num != -1) { ActiveSyncDevice[] devices = null; ADNotificationAdapter.RunADOperation(delegate() { devices = CS$ < > 8__locals1.< > 4__this.session.Find <ActiveSyncDevice>(CS$ < > 8__locals1.containers[i].Id, QueryScope.OneLevel, null, ADDeviceManager.defaultSortOrder, 50); }); if (devices != null) { ActiveSyncDevice[] devices2 = devices; for (int j = 0; j < devices2.Length; j++) { ActiveSyncDevice device = devices2[j]; try { ADNotificationAdapter.RunADOperation(delegate() { CS$ < > 8__locals1.< > 4__this.session.Delete(device); }); } catch (LocalizedException ex) { AirSyncDiagnostics.TraceError <string, string, string>(ExTraceGlobals.RequestsTracer, this, "Failed to delete device object {0} under CNF-mangled container {1} because: {2}", device.Id.DistinguishedName, CS$ < > 8__locals1.containers[i].Id.DistinguishedName, ex.Message); } } } try { ADNotificationAdapter.RunADOperation(delegate() { CS$ < > 8__locals1.< > 4__this.session.Delete(CS$ < > 8__locals1.containers[i]); }); goto IL_244; } catch (LocalizedException ex2) { AirSyncDiagnostics.TraceError <string, string>(ExTraceGlobals.RequestsTracer, this, "Failed to delete CNF-mangled container {0} because: {0}", CS$ < > 8__locals1.containers[i].Id.DistinguishedName, ex2.Message); goto IL_244; } goto IL_23C; } goto IL_23C; IL_244: i++; continue; IL_23C: num = i; goto IL_244; } if (num == -1) { return(this.CreateActiveSyncDeviceContainer(true)); } return(CS$ < > 8__locals1.containers[num]); }
// Token: 0x06000B97 RID: 2967 RVA: 0x0003ED44 File Offset: 0x0003CF44 internal static bool GetDeviceStatus(OrganizationId orgId, string deviceID, string externalUserObjectId, bool isSupportedDevice, out DeviceAccessState accessState, out DeviceAccessStateReason accessReason) { bool flag = false; bool flag2 = true; accessState = DeviceAccessState.Unknown; accessReason = DeviceAccessStateReason.Unknown; string text = string.Empty; try { if (!GlobalSettings.DisableDeviceHealthStatusCache && GraphApiHelper.deviceComplianceStatusCache.Value.TryGetValue(GraphApiHelper.GetCacheKey(externalUserObjectId, deviceID), out text)) { flag = true; flag2 = GraphApiHelper.ParsePolicyEvaluationStatusToAccessState(text, out accessState, out accessReason); AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, 0, "Retrieved device status from Cache. AccessState:{1}, AccessReason:{2}, IsEnabled:{3}, DeviceStatus:{0}, ", new object[] { accessState, accessReason, flag2, text }); return flag2; } IAadClient aadClient = null; if (!GraphApiHelper.aadClients.ContainsKey(orgId)) { lock (GraphApiHelper.lockObject) { if (!GraphApiHelper.aadClients.ContainsKey(orgId)) { aadClient = GraphApiHelper.CreateAadClient(orgId, GraphProxyVersions.Version142); if (!GlobalSettings.DisableAadClientCache && aadClient != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, 0, "Added AADClient to cache."); GraphApiHelper.aadClients.Add(orgId, aadClient); } } } } if (aadClient == null) { if (!GraphApiHelper.aadClients.ContainsKey(orgId)) { throw new InvalidOperationException(string.Format("Failed to create AAD client for Org {0}", orgId)); } aadClient = GraphApiHelper.aadClients[orgId]; } text = aadClient.EvaluateAuthPolicy(deviceID, externalUserObjectId, isSupportedDevice); flag2 = GraphApiHelper.ParsePolicyEvaluationStatusToAccessState(text, out accessState, out accessReason); TimeSpan expiration = (accessState == DeviceAccessState.Allowed) ? GlobalSettings.DeviceStatusCacheExpirationInterval : GlobalSettings.NegativeDeviceStatusCacheExpirationInterval; if (!GlobalSettings.DisableDeviceHealthStatusCache && !GraphApiHelper.deviceComplianceStatusCache.Value.TryAddAbsolute(GraphApiHelper.GetCacheKey(externalUserObjectId, deviceID), text, expiration)) { AirSyncDiagnostics.TraceDebug<OrganizationId, string, string>(ExTraceGlobals.RequestsTracer, 0, "Failed to Add deviceStatus {1} to Device Status Cache for user {2}. UserId:{0} ", orgId, text, externalUserObjectId); } if (Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("msg:{0}", text)); } } catch (AADException ex) { AADDataException ex2 = ex as AADDataException; string text2 = (ex2 != null) ? ex2.Code.ToString() : "n/a"; AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, "0", "Exception retrieving deviceStatus for device:{0}, user:{1},OrgId:{2},ErrorCode:{3},Message:{4} ", new object[] { deviceID, externalUserObjectId, orgId, text2, ex.Message }); if (Command.CurrentCommand != null) { if (ex2 != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.Error, text2); } AirSyncUtility.LogCompressedStackTrace(ex, Command.CurrentCommand.Context); } throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, ex, false); } finally { if (Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("cu:{0}", flag ? "F" : "T")); Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("deviceStatus", text)); } } return flag2; }
// Token: 0x06000B96 RID: 2966 RVA: 0x0003E8D8 File Offset: 0x0003CAD8 internal static bool GetDeviceStatus(OrganizationId orgId, string deviceID, string externalUserObjectId, out bool isManaged, out bool isCompliant) { bool flag = false; bool flag2 = true; isManaged = false; isCompliant = false; try { AadDevice aadDevice; if (GraphApiHelper.deviceStatusCache.Value.TryGetValue(GraphApiHelper.GetCacheKey(externalUserObjectId, deviceID), out aadDevice)) { flag = true; isManaged = (aadDevice.IsManaged != null && aadDevice.IsManaged.Value); isCompliant = (aadDevice.IsCompliant != null && aadDevice.IsCompliant.Value); flag2 = (aadDevice.AccountEnabled == null || aadDevice.AccountEnabled.Value); AirSyncDiagnostics.TraceDebug<bool, bool, bool>(ExTraceGlobals.RequestsTracer, 0, "Retrieved device status from Cache. IsManaged:{0}, IsCompliant:{1}, IsEnabled:{2}", isManaged, isCompliant, flag2); return flag2; } if (!GraphApiHelper.aadClients.ContainsKey(orgId)) { lock (GraphApiHelper.lockObject) { if (!GraphApiHelper.aadClients.ContainsKey(orgId)) { IAadClient aadClient = GraphApiHelper.CreateAadClient(orgId, GraphProxyVersions.Version122); if (!GlobalSettings.DisableAadClientCache && aadClient != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, 0, "Added AADClient to cache."); GraphApiHelper.aadClients.Add(orgId, aadClient); } } } } IAadClient aadClient2 = GraphApiHelper.aadClients.ContainsKey(orgId) ? GraphApiHelper.aadClients[orgId] : null; if (aadClient2 == null) { throw new InvalidOperationException(string.Format("Failed to create AAD client for Org {0}", orgId)); } List<AadDevice> userDevicesWithEasID = aadClient2.GetUserDevicesWithEasID(deviceID, externalUserObjectId); if (userDevicesWithEasID != null && userDevicesWithEasID.Count > 0) { AirSyncDiagnostics.TraceDebug<int>(ExTraceGlobals.RequestsTracer, 0, "Retrieved {0} devices from AAD ", userDevicesWithEasID.Count); userDevicesWithEasID.Sort((AadDevice device1, AadDevice device2) => device1.LastUpdated.CompareTo(device2.LastUpdated)); aadDevice = userDevicesWithEasID[0]; isManaged = (aadDevice.IsManaged != null && aadDevice.IsManaged.Value); isCompliant = (aadDevice.IsCompliant != null && aadDevice.IsCompliant.Value); TimeSpan expiration = (isManaged && isCompliant) ? GlobalSettings.DeviceStatusCacheExpirationInterval : GlobalSettings.NegativeDeviceStatusCacheExpirationInterval; if (!GlobalSettings.DisableDeviceHealthStatusCache && !GraphApiHelper.deviceStatusCache.Value.TryAddAbsolute(GraphApiHelper.GetCacheKey(externalUserObjectId, deviceID), aadDevice, expiration)) { AirSyncDiagnostics.TraceDebug<OrganizationId, string, string>(ExTraceGlobals.RequestsTracer, 0, "Failed to Add device {1} to Device Status Cache for user {2}. OrganizationId:{0} ", orgId, deviceID, externalUserObjectId); } if (Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("num:{0},id:{1}", userDevicesWithEasID.Count, aadDevice.DeviceId)); } return aadDevice.AccountEnabled == null || aadDevice.AccountEnabled.Value; } AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, 0, "Device not found in AAD "); if (Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("msg:{0}", "DeviceNotFoundInAAD")); } } catch (AADException ex) { AADDataException ex2 = ex as AADDataException; string text = (ex2 != null) ? ex2.Code.ToString() : "n/a"; AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, "0", "Exception retrieving deviceStatus for device:{0}, user:{1},OrgId:{2},ErrorCode:{3},Message:{4} ", new object[] { deviceID, externalUserObjectId, orgId, text, ex.Message }); if (Command.CurrentCommand != null) { if (ex2 != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.Error, text); } AirSyncUtility.LogCompressedStackTrace(ex, Command.CurrentCommand.Context); } throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, ex, false); } finally { if (Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("cu:{0}", flag ? "F" : "T")); Command.CurrentCommand.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("Mngd:{0},Cmpl:{1},Enbld:{2}", isManaged, isCompliant, flag2)); } } return flag2; }
public void Execute() { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DocumentLibrary Fetch command received. Processing request..."); Uri uri = null; try { uri = new Uri(this.linkId); } catch (UriFormatException innerException) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: Bad document Uri {0} was specified!", new object[] { this.linkId })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, innerException, false); } AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Processing Fetch command with Uri {0}.", uri.AbsoluteUri); if (!DocumentLibraryUtility.IsTrustedProtocol(uri.Scheme)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: untrusted protocol: {0}!", new object[] { uri.Scheme })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadProtocolInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } if (!DocumentLibraryUtility.IsInternalUri(uri)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: Uri must be internal: {0}!", new object[] { uri.Host })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ExternalProtocolInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } AuthenticationContext authenticationContext = new AuthenticationContext(); try { IPrincipal principal; if (this.userPassword == null) { principal = this.user.WindowsPrincipal; if (principal == null) { if (GlobalSettings.EnableCredentialRequest && this.user.Context.Request.Version >= 121) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedPromptForCredsToProxy2"); throw new AirSyncPermanentException(StatusCode.ItemOperations_CredentialsRequired, false); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedCredsToProxy2"); throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false); } } else { SecurityStatus securityStatus = authenticationContext.LogonUser(this.userName, this.userPassword); this.userPassword.Dispose(); this.userPassword = null; if (securityStatus != SecurityStatus.OK) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: Authentication failed with status {0}.", new object[] { securityStatus })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, string.Format(CultureInfo.InvariantCulture, "AuthenticationErrorStatus{0}", new object[] { securityStatus })); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false); } principal = new WindowsPrincipal(authenticationContext.Identity); } ClassifyResult classifyResult = LinkClassifier.ClassifyLinks(principal, new Uri[] { uri })[0]; if (classifyResult.Error != ClassificationError.None) { AirSyncDiagnostics.TraceDebug <string, ClassificationError>(ExTraceGlobals.RequestsTracer, this, "The LinkClassifier failed to classify the link {0}, returned {1}", this.linkId, classifyResult.Error); switch (classifyResult.Error) { case ClassificationError.ConnectionFailed: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassConnFailedInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_Conflict, null, false); case ClassificationError.AccessDenied: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassDeniedInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false); case ClassificationError.ObjectNotFound: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassNotFoundInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ClientServerConversion, null, false); case ClassificationError.UriTypeNotSupported: case ClassificationError.InvalidUri: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassBadUriInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ProtocolError, null, false); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassFailureInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false); } IDocument document = null; UncSession uncSession = null; SharepointSession sharepointSession = null; if ((classifyResult.UriFlags & UriFlags.UncDocument) == UriFlags.UncDocument) { if (!DocumentLibraryUtility.IsUncAccessEnabled(this.user)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } if (DocumentLibraryUtility.IsBlockedHostName(uri.Host)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } uncSession = UncSession.Open(classifyResult.ObjectId, principal); } else { if ((classifyResult.UriFlags & UriFlags.SharepointDocument) != UriFlags.SharepointDocument) { AirSyncDiagnostics.TraceDebug <string, UriFlags>(ExTraceGlobals.RequestsTracer, this, "The Uri {0} of type {1} is not supported for Fetch", this.linkId, classifyResult.UriFlags); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, false); } if (!DocumentLibraryUtility.IsWssAccessEnabled(this.user)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "WssDeniedInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } if (DocumentLibraryUtility.IsBlockedHostName(uri.Host)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_Retry, false); } this.user.Context.ProtocolLogger.IncrementValue(ProtocolLoggerData.SharePointDocs); sharepointSession = SharepointSession.Open(classifyResult.ObjectId, principal); } try { if (uncSession != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Reading UNC document..."); document = UncDocument.Read(uncSession, classifyResult.ObjectId); } else { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Reading Sharepoint document..."); AirSyncDiagnostics.Assert(sharepointSession != null); document = SharepointDocument.Read(sharepointSession, classifyResult.ObjectId); } } catch (ObjectNotFoundException innerException2) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NotFoundInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException2, false); } catch (AccessDeniedException innerException3) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_ServerError, innerException3, false); } this.documentSize = (int)document.Size; if (this.documentSize == 0) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "The file {0} was found to be empty!", this.linkId); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "EmptyDocInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_NotificationGUID, null, false); } object obj = document.TryGetProperty(DocumentLibraryItemSchema.LastModifiedDate); if (obj is PropertyError) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "GeneralErrorInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false); } ExDateTime exDateTime; if (obj is DateTime) { exDateTime = new ExDateTime(ExTimeZone.UtcTimeZone, (DateTime)obj); } else { exDateTime = (ExDateTime)obj; } this.version = exDateTime.ToString("yyyy-MM-dd\\THH:mm:ss.fff\\Z", CultureInfo.InvariantCulture); if (this.rangeSpecified && this.minRange >= this.documentSize) { AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, this, "The minimum range specified {0} is greater than the document size {1}", this.minRange, this.documentSize); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadMinSizeInDocFetch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ObjectNotFound, null, false); } using (Stream document2 = document.GetDocument()) { int num; if (this.rangeSpecified) { num = this.maxRange - this.minRange + 1; } else { num = this.documentSize; } if (uncSession != null) { this.user.Context.ProtocolLogger.IncrementValue(ProtocolLoggerData.UNCFiles); this.user.Context.ProtocolLogger.IncrementValueBy(ProtocolLoggerData.UNCBytes, num); } if (sharepointSession != null) { this.user.Context.ProtocolLogger.IncrementValue(ProtocolLoggerData.SharePointDocs); this.user.Context.ProtocolLogger.IncrementValueBy(ProtocolLoggerData.SharePointBytes, num); } this.outStream = new MemoryStream(num); if (num > GlobalSettings.MaxDocumentDataSize) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "DocTooBigInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_NotificationsNotProvisioned, false); } try { StreamHelper.CopyStream(document2, this.outStream, this.minRange, num); } catch (IOException innerException4) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "IOErrorInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_FolderHierarchyRequired, innerException4, false); } } } catch (UnknownErrorException innerException5) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "IOErrorInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_FolderHierarchyRequired, innerException5, false); } catch (DocumentModifiedException innerException6) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "IOErrorInDocFetch3"); throw new AirSyncPermanentException(StatusCode.Sync_FolderHierarchyRequired, innerException6, false); } catch (DocumentStreamAccessDeniedException innerException7) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocFetch3"); throw new AirSyncPermanentException(StatusCode.Sync_ServerError, innerException7, false); } catch (ObjectMovedOrDeletedException innerException8) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NotFoundInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException8, false); } catch (DocumentLibraryException innerException9) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "GeneralErrorInDocFetch2"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, innerException9, false); } finally { if (authenticationContext != null) { authenticationContext.Dispose(); authenticationContext = null; } } }
public void ParseRequest(XmlNode fetchNode) { XmlNode xmlNode = fetchNode["LinkId", "DocumentLibrary:"]; if (xmlNode == null) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NoLinkIdInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false); } this.linkId = xmlNode.InnerText; AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Fetch request linkId is {0}.", this.linkId); XmlNode xmlNode2 = fetchNode["Options", "ItemOperations:"]; if (xmlNode2 != null) { int num = 0; XmlNode xmlNode3 = xmlNode2["Range", "ItemOperations:"]; if (xmlNode3 != null) { string[] array = xmlNode3.InnerText.Split(new char[] { '-' }); AirSyncDiagnostics.Assert(array.Length == 2); this.minRange = int.Parse(array[0], CultureInfo.InvariantCulture); this.maxRange = int.Parse(array[1], CultureInfo.InvariantCulture); AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, this, "Fetch command minRange is {0} and maxRange is {1}.", this.minRange, this.maxRange); if (this.minRange > this.maxRange) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "MinMoreThanMaxOnDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false); } this.rangeSpecified = true; num++; } XmlNode xmlNode4 = xmlNode2["UserName", "ItemOperations:"]; if (xmlNode4 != null) { AirSyncSecureStringXmlNode airSyncSecureStringXmlNode = xmlNode2["Password", "ItemOperations:"] as AirSyncSecureStringXmlNode; if (airSyncSecureStringXmlNode == null) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadCredsOnDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false); } this.userName = xmlNode4.InnerText; this.userPassword = airSyncSecureStringXmlNode.DetachSecureData(); AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Fetch command userName is {0}.", this.userName); num += 2; } if (num != xmlNode2.ChildNodes.Count) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadOptionsInDocFetch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false); } if (!string.Equals(this.user.Identity.AuthenticationType, "Basic", StringComparison.OrdinalIgnoreCase) && this.userPassword == null) { if (GlobalSettings.EnableCredentialRequest && this.user.Context.Request.Version >= 121) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedPromptForCredsToProxy"); throw new AirSyncPermanentException(StatusCode.ItemOperations_CredentialsRequired, false); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedCredsToProxy"); throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false); } } }
public void Execute() { Uri uri = null; try { uri = new Uri(this.linkId); } catch (UriFormatException innerException) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "DocumentLibrarySearchProvider: Bad Uri {0} was specified!", new object[] { this.linkId })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, innerException, false); } AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Processing Search command with Uri {0}.", uri.AbsoluteUri); if (!DocumentLibraryUtility.IsTrustedProtocol(uri.Scheme)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: untrusted protocol: {0}!", new object[] { uri.Scheme })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadProtocolInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } if (!DocumentLibraryUtility.IsInternalUri(uri)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "ItemOperationsFetchProvider: Uri must be internal: {0}!", new object[] { uri.Host })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ExternalProtocolInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } AuthenticationContext authenticationContext = new AuthenticationContext(); try { IPrincipal principal; if (this.userPassword == null) { principal = this.user.WindowsPrincipal; AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DocumentLibrarySearchProvider: Created IPrincipal object from IAirSyncUser ."); if (principal == null) { if (GlobalSettings.EnableCredentialRequest && this.user.Context.Request.Version >= 121) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedPromptForCredsToProxy2"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidWaitTime, false); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NeedCredsToProxy2"); throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.AccessDenied, null, false); } } else { SecurityStatus securityStatus = authenticationContext.LogonUser(this.userName, this.userPassword); this.userPassword.Dispose(); this.userPassword = null; if (securityStatus != SecurityStatus.OK) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, string.Format(CultureInfo.InvariantCulture, "DocumentLibrarySearchProvider: Authentication failed with status {0}.", new object[] { securityStatus })); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, string.Format(CultureInfo.InvariantCulture, "AuthenticationErrorStatus{0}", new object[] { securityStatus })); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false); } principal = new WindowsPrincipal(authenticationContext.Identity); AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "DocumentLibrarySearchProvider: Created IPrincipal using AuthenticationContext LogonUser method."); } ClassifyResult classifyResult = LinkClassifier.ClassifyLinks(principal, new Uri[] { uri })[0]; if (classifyResult.Error != ClassificationError.None) { AirSyncDiagnostics.TraceDebug <string, ClassificationError>(ExTraceGlobals.RequestsTracer, this, "The LinkClassifier failed to classify the link {0}, returned {1}", this.linkId, classifyResult.Error); switch (classifyResult.Error) { case ClassificationError.ConnectionFailed: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassConnFailedInDocSearch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_Conflict, null, false); case ClassificationError.AccessDenied: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassDeniedInDocSearch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ServerError, null, false); case ClassificationError.ObjectNotFound: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassNotFoundInDocSearch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ClientServerConversion, null, false); case ClassificationError.UriTypeNotSupported: case ClassificationError.InvalidUri: this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassBadUriInDocSearch"); throw new AirSyncPermanentException(HttpStatusCode.OK, StatusCode.Sync_ProtocolError, null, false); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "LinkClassFailureInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, false); } AirSyncDiagnostics.TraceDebug <UriFlags>(ExTraceGlobals.RequestsTracer, this, "Search command document type is {0}.", classifyResult.UriFlags); SharepointSession sharepointSession = null; UncSession uncSession = null; IDocumentLibraryItem documentLibraryItem = null; IDocumentLibrary documentLibrary = null; IDocumentLibraryFolder documentLibraryFolder = null; if ((classifyResult.UriFlags & UriFlags.Unc) == UriFlags.Unc) { if (!DocumentLibraryUtility.IsUncAccessEnabled(this.user)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } if (DocumentLibraryUtility.IsBlockedHostName(uri.Host)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } uncSession = UncSession.Open(classifyResult.ObjectId, principal); } else { if ((classifyResult.UriFlags & UriFlags.Sharepoint) != UriFlags.Sharepoint) { AirSyncDiagnostics.TraceDebug <string, UriFlags>(ExTraceGlobals.RequestsTracer, this, "The Uri {0} of type {1} is not supported for Search", this.linkId, classifyResult.UriFlags); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch2"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, false); } if (!DocumentLibraryUtility.IsWssAccessEnabled(this.user)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "WssDeniedInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } if (DocumentLibraryUtility.IsBlockedHostName(uri.Host)) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "HostBlockedInDocSearch2"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidParameters, false); } sharepointSession = SharepointSession.Open(classifyResult.ObjectId, principal); } UriFlags uriFlags = classifyResult.UriFlags; switch (uriFlags) { case UriFlags.Sharepoint: case UriFlags.Unc: goto IL_645; case UriFlags.Sharepoint | UriFlags.Unc: case UriFlags.DocumentLibrary: break; case UriFlags.SharepointDocumentLibrary: documentLibrary = SharepointDocumentLibrary.Read(sharepointSession, classifyResult.ObjectId); goto IL_645; case UriFlags.UncDocumentLibrary: documentLibrary = UncDocumentLibrary.Read(uncSession, classifyResult.ObjectId); goto IL_645; default: switch (uriFlags) { case UriFlags.SharepointDocument: documentLibraryItem = SharepointDocument.Read(sharepointSession, classifyResult.ObjectId); goto IL_645; case UriFlags.UncDocument: documentLibraryItem = UncDocument.Read(uncSession, classifyResult.ObjectId); goto IL_645; default: switch (uriFlags) { case UriFlags.SharepointFolder: documentLibraryFolder = SharepointDocumentLibraryFolder.Read(sharepointSession, classifyResult.ObjectId); goto IL_645; case UriFlags.UncFolder: documentLibraryFolder = UncDocumentLibraryFolder.Read(uncSession, classifyResult.ObjectId); goto IL_645; } break; } break; } AirSyncDiagnostics.TraceDebug <string, UriFlags>(ExTraceGlobals.RequestsTracer, this, "The Uri {0} of type {1} is not supported for Search", this.linkId, classifyResult.UriFlags); this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch3"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, false); IL_645: if (documentLibrary != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() for document library..."); this.tableView = documentLibrary.GetView(null, DocumentLibrarySearchProvider.sortBy, DocumentLibraryQueryOptions.FoldersAndFiles, DocumentLibrarySearchProvider.documentLibraryProps); this.rootProps = documentLibrary.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps); } else if (documentLibraryFolder != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() for document folder..."); this.tableView = documentLibraryFolder.GetView(null, DocumentLibrarySearchProvider.sortBy, DocumentLibraryQueryOptions.FoldersAndFiles, DocumentLibrarySearchProvider.documentLibraryProps); this.rootProps = documentLibraryFolder.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps); } else if (documentLibraryItem != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Getting properties for the document item..."); this.rootProps = documentLibraryItem.GetProperties(DocumentLibrarySearchProvider.documentLibraryProps); } else if (sharepointSession != null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() on Sharepoint session..."); this.tableView = sharepointSession.GetView(ListBaseType.DocumentLibrary, DocumentLibrarySearchProvider.documentLibraryProps); this.rootProps = new object[DocumentLibrarySearchProvider.airSyncProps.GetLength(0)]; this.rootProps[0] = sharepointSession.Uri; this.rootProps[1] = sharepointSession.DisplayName; this.rootProps[2] = true; } else { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Calling GetView() on UNC session..."); this.tableView = uncSession.GetView(null, null, DocumentLibrarySearchProvider.documentLibraryProps); this.rootProps = new object[DocumentLibrarySearchProvider.airSyncProps.GetLength(0)]; this.rootProps[0] = uncSession.Uri; this.rootProps[1] = uncSession.Title; this.rootProps[2] = true; } } catch (UnknownErrorException innerException2) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "BadLinkInDocSearch4"); throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, innerException2, false); } catch (AccessDeniedException innerException3) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "AccessDeniedInDocSearch2"); throw new AirSyncPermanentException(StatusCode.Sync_ServerError, innerException3, false); } catch (ConnectionException innerException4) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "ConnFailedInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_Conflict, innerException4, false); } catch (ObjectNotFoundException innerException5) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "NotFoundInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, innerException5, false); } catch (DocumentLibraryException innerException6) { this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "FailureInDocSearch"); throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, innerException6, false); } finally { if (authenticationContext != null) { authenticationContext.Dispose(); authenticationContext = null; } } }
// Token: 0x06000E7F RID: 3711 RVA: 0x00051610 File Offset: 0x0004F810 private ProvisionCommandPhaseTwo.AcknowledgementType ParseProvisionRequest() { ProvisionCommandPhaseTwo.AcknowledgementType acknowledgementType = ProvisionCommandPhaseTwo.AcknowledgementType.None; XmlNode xmlRequest = base.XmlRequest; uint num = 0U; XmlNode xmlNode = xmlRequest["RemoteWipe", "Provision:"]; if (xmlNode != null) { if (!base.RemoteWipeRequired) { throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "RemoteWipeWasNotRequested" }; } XmlNode xmlNode2 = xmlNode["Status", "Provision:"]; if (xmlNode2 != null) { if (!uint.TryParse(xmlNode2.InnerText, out num) || num < 1U || num > 2U) { this.requestRemoteWipeStatus = ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient.Invalid; } else { this.requestRemoteWipeStatus = (ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient)num; } } acknowledgementType = ProvisionCommandPhaseTwo.AcknowledgementType.RemoteWipe; } if (base.RemoteWipeRequired && this.requestRemoteWipeStatus == ProvisionCommandPhaseTwo.RemoteWipeStatusCodeFromClient.NotPresent) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "[ProvisionCommandPhaseTwo.ParseProvisionRequest] Client responded to policy ack, but there is a remoteWipe request pending."); return(ProvisionCommandPhaseTwo.AcknowledgementType.ForceRemoteWipe); } XmlNode xmlNode3 = xmlRequest["Policies", "Provision:"]; if (xmlNode3 != null) { XmlNode xmlNode4 = xmlNode3["Policy", "Provision:"]; XmlNode xmlNode5 = xmlNode4["PolicyKey", "Provision:"]; XmlNode xmlNode6 = xmlNode4["Status", "Provision:"]; if (xmlNode5 != null && uint.TryParse(xmlNode5.InnerText, out num)) { this.requestPolicyKey = new uint?(num); } XmlNode xmlNode7 = xmlNode4["PolicyType", "Provision:"]; this.requestPolicyType = xmlNode7.InnerText; if (xmlNode6 != null) { if (!uint.TryParse(xmlNode6.InnerText, out num) || num < 1U || num > 4U) { this.requestPolicyStatus = ProvisionCommandPhaseTwo.PolicyStatusCodeFromClient.Invalid; } else { this.requestPolicyStatus = (ProvisionCommandPhaseTwo.PolicyStatusCodeFromClient)num; } this.owningCommand.ProtocolLogger.SetValue(ProtocolLoggerData.PolicyAckStatus, (int)this.requestPolicyStatus); } acknowledgementType |= ProvisionCommandPhaseTwo.AcknowledgementType.Policy; } return(acknowledgementType); }
// Token: 0x060009B7 RID: 2487 RVA: 0x00039054 File Offset: 0x00037254 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); }
// Token: 0x060001CA RID: 458 RVA: 0x0000C8C0 File Offset: 0x0000AAC0 public static void TraceWarning <T0, T1, T2>(Trace tracer, int lid, object objectToHash, string formatString, T0 arg0, T1 arg1, T2 arg2) { AirSyncDiagnostics.GetSyncLogger().TraceWarning <T0, T1, T2>(tracer, lid, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), formatString, arg0, arg1, arg2); }
// Token: 0x0600018F RID: 399 RVA: 0x0000C071 File Offset: 0x0000A271 public static void SendWatson(Exception exception) { AirSyncDiagnostics.SendWatson(exception, true); }
private RecipientAddress ConstructStoreRecipientAddress(Participant participant, string displayName, StoreObjectId storeId) { RecipientAddress recipientAddress = new RecipientAddress(); recipientAddress.DisplayName = displayName; recipientAddress.AddressOrigin = AddressOrigin.Store; recipientAddress.RoutingType = participant.RoutingType; if (!string.IsNullOrEmpty(participant.EmailAddress)) { recipientAddress.RoutingAddress = participant.EmailAddress; if (string.Equals(recipientAddress.RoutingType, "EX", StringComparison.OrdinalIgnoreCase)) { string text = participant.TryGetProperty(ParticipantSchema.SmtpAddress) as string; if (string.IsNullOrEmpty(text)) { ABObject recipient = null; OperationRetryManagerResult operationRetryManagerResult = AnrManager.retryManager.TryRun(delegate { recipient = this.GetAddressBookSession().FindByLegacyExchangeDN(recipientAddress.RoutingAddress); }); if (!operationRetryManagerResult.Succeeded) { if (operationRetryManagerResult.Exception is ABProviderLoadException) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, EASServerStrings.UnableToLoadAddressBookProvider, operationRetryManagerResult.Exception, true) { ErrorStringForProtocolLogger = "ABProviderNotFound" }; } if (operationRetryManagerResult.Exception is ABSubscriptionDisabledException) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "ABSubscriptionDisabled" }; } if (operationRetryManagerResult.Exception is DataValidationException) { throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "AnrError:ADDataInvalid" }; } if (operationRetryManagerResult.Exception is ABOperationException) { ABOperationException ex = (ABOperationException)operationRetryManagerResult.Exception; throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "AnrError:ABOperationException" }; } if (operationRetryManagerResult.Exception is ABTransientException) { AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestTracer, null, "AnrManager.ConstructStoreRecipientAddress(): ABTransientException was thrown by FindByLegacyExchangeDN: {0}", operationRetryManagerResult.Exception.Message); } } if (recipient == null) { return(null); } recipientAddress.SmtpAddress = recipient.EmailAddress; } else { recipientAddress.SmtpAddress = text; } } else { if (!string.Equals(recipientAddress.RoutingType, "SMTP", StringComparison.OrdinalIgnoreCase)) { return(null); } recipientAddress.SmtpAddress = recipientAddress.RoutingAddress; } } recipientAddress.StoreObjectId = storeId; return(recipientAddress); }
// Token: 0x06000195 RID: 405 RVA: 0x0000C295 File Offset: 0x0000A495 public static void TraceInfo(Trace tracer, object objectToHash, string formatString, params object[] args) { AirSyncDiagnostics.GetSyncLogger().Information(tracer, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), formatString, args); }
private void ProcessSet(XmlNode setNode) { using (this.command.Context.Tracker.Start(TimeId.DeviceInfoProcessSet)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing DeviceInformation - Set"); foreach (object obj in setNode.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; string innerText = xmlNode.InnerText; string localName; switch (localName = xmlNode.LocalName) { case "Model": this.deviceModel = DeviceClassCache.NormalizeDeviceClass(innerText); break; case "IMEI": this.deviceImei = innerText; break; case "FriendlyName": this.deviceFriendlyName = innerText; break; case "OS": this.deviceOS = innerText; break; case "OSLanguage": this.deviceOSLanguage = innerText; break; case "PhoneNumber": this.devicePhoneNumber = innerText; break; case "UserAgent": this.deviceUserAgent = innerText; break; case "EnableOutboundSMS": { string a; if (this.command.User.IsConsumerOrganizationUser) { this.deviceEnableOutboundSMS = false; } else if ((a = innerText) != null) { if (!(a == "0")) { if (a == "1") { this.deviceEnableOutboundSMS = true; } } else { this.deviceEnableOutboundSMS = false; } } break; } case "MobileOperator": this.deviceMobileOperator = innerText; break; case "Annotations": this.command.RequestAnnotations.ParseWLAnnotations(xmlNode, "DeviceInformation"); break; } } if (this.command.RequestAnnotations.ContainsAnnotation("CreateChatsFolder", "DeviceInformation")) { this.CreateSmsAndChatsSyncFolder(); } bool flag = false; GlobalInfo globalInfo = this.command.GlobalInfo; globalInfo.DeviceModel = this.deviceModel; globalInfo.DeviceImei = this.deviceImei; globalInfo.DeviceFriendlyName = this.deviceFriendlyName; globalInfo.UserAgent = this.deviceUserAgent; string text; if (this.command.Context.Request.DeviceIdentity.DeviceType.ToUpper().Contains("SAMSUNG") && this.command.TryParseDeviceOSFromUserAgent(out text)) { this.deviceOS = text; } globalInfo.DeviceOS = this.deviceOS; globalInfo.DeviceOSLanguage = this.deviceOSLanguage; globalInfo.DevicePhoneNumber = this.devicePhoneNumber; string text2 = string.IsNullOrEmpty(this.devicePhoneNumber) ? globalInfo.DevicePhoneNumberForSms : this.devicePhoneNumber; if (string.IsNullOrEmpty(text2)) { text2 = Guid.NewGuid().GetHashCode().ToString("D3", CultureInfo.InvariantCulture); globalInfo.DevicePhoneNumberForSms = text2; } else { flag |= (string.Compare(text2, globalInfo.DevicePhoneNumberForSms, StringComparison.Ordinal) != 0); } flag |= (this.deviceEnableOutboundSMS != globalInfo.DeviceEnableOutboundSMS); globalInfo.DeviceMobileOperator = this.deviceMobileOperator; globalInfo.DeviceInformationReceived = true; SmsSqmDataPointHelper.AddDeviceInfoReceivedDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, this.command.Request.VersionString); if (flag) { try { using (VersionedXmlDataProvider versionedXmlDataProvider = new VersionedXmlDataProvider(this.mailboxSession)) { TextMessagingAccount textMessagingAccount = (TextMessagingAccount)versionedXmlDataProvider.Read <TextMessagingAccount>(this.mailboxSession.MailboxOwner.ObjectId); IRecipientSession adrecipientSession = this.mailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent); ADRecipient adrecipient = adrecipientSession.Read(this.mailboxSession.MailboxOwner.ObjectId); this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc); if (adrecipient == null) { throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, new LocalizedString("Cannot find AD Recipient correlated to the text messaging account"), false) { ErrorStringForProtocolLogger = "NoUserAccountForSms" }; } E164Number e164Number = null; E164Number.TryParse(text2, out e164Number); if (this.deviceEnableOutboundSMS) { if (e164Number == null) { throw new AirSyncPermanentException(StatusCode.Sync_ServerError, new LocalizedString(string.Format("Cannot parse phone number {0} into a E164 number.", text2)), false) { ErrorStringForProtocolLogger = "BadSmsPhoneNum" }; } bool notificationEnabled = textMessagingAccount.NotificationPhoneNumber != null && textMessagingAccount.NotificationPhoneNumberVerified; textMessagingAccount.SetEasEnabled(e164Number, this.syncStateStorage.DeviceIdentity.Protocol, this.syncStateStorage.DeviceIdentity.DeviceType, this.syncStateStorage.DeviceIdentity.DeviceId, this.deviceFriendlyName); TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession); this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc); SmsSqmDataPointHelper.AddEasConfigurationDataPoint(SmsSqmSession.Instance, this.mailboxSession.MailboxOwner.ObjectId, this.mailboxSession.MailboxOwner.LegacyDn, this.command.Request.DeviceIdentity.DeviceType, notificationEnabled, this.command.Request.VersionString); } else if (textMessagingAccount.EasEnabled && textMessagingAccount.EasPhoneNumber == e164Number) { textMessagingAccount.SetEasDisabled(); TextMessagingHelper.SaveTextMessagingAccount(textMessagingAccount, versionedXmlDataProvider, adrecipient, adrecipientSession); this.command.Context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, adrecipientSession.LastUsedDc); } } globalInfo.DevicePhoneNumberForSms = text2; globalInfo.DeviceEnableOutboundSMS = this.deviceEnableOutboundSMS; } catch (StoragePermanentException innerException) { throw new AirSyncPermanentException(StatusCode.ServerError, new LocalizedString("Server Error when trying to update SMS settings."), innerException, false) { ErrorStringForProtocolLogger = "SmsSettingsSaveError" }; } } this.OutputToIISLog(); } }
// Token: 0x060001AD RID: 429 RVA: 0x0000C561 File Offset: 0x0000A761 public static void TraceFunction(Trace tracer, object objectToHash, string message) { AirSyncDiagnostics.GetSyncLogger().TraceFunction(tracer, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), message); }
// Token: 0x060000B7 RID: 183 RVA: 0x00007A20 File Offset: 0x00005C20 private ActiveSyncDevices CreateActiveSyncDeviceContainer(bool retryIfFailed) { ActiveSyncDevices container = new ActiveSyncDevices(); try { container.Name = "ExchangeActiveSyncDevices"; container.SetId(this.userId.GetChildId(container.Name)); container.OrganizationId = this.organizationId; ADNotificationAdapter.RunADOperation(delegate() { this.session.Save(container); this.session.DomainController = container.OriginatingServer; }); } catch (ADObjectAlreadyExistsException innerException) { container = this.GetActiveSyncDeviceContainer(); if (container == null) { throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, innerException, false) { ErrorStringForProtocolLogger = "ADObjectAlreadyExistsException:ButDevicesContainerDoesNotExist" }; } } catch (ADOperationException ex) { AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_UnableToCreateADDevicesContainer, container.Name, new string[] { this.userId.ToDNString(), ex.Message }); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, ex, false) { ErrorStringForProtocolLogger = "ADOperationException1:" + ex.Message }; } bool flag = false; try { this.SetActiveSyncDeviceContainerPermissions(container); flag = true; } catch (ADNoSuchObjectException innerException2) { if (retryIfFailed) { return(this.CreateActiveSyncDeviceContainer(false)); } throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, innerException2, false) { ErrorStringForProtocolLogger = "ADNoSuchObjectException:OnDevicesContainerPermsSet" }; } catch (ADOperationException ex2) { AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_UnableToCreateADDevicesContainer, "ExchangeActiveSyncDevices", new string[] { this.userId.ToDNString(), ex2.Message }); throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerErrorRetryLater, ex2, false) { ErrorStringForProtocolLogger = "ADOperationException2:" + ex2.Message }; } finally { if (!flag) { try { ADNotificationAdapter.RunADOperation(delegate() { this.session.Delete(container); }); } catch (LocalizedException arg) { AirSyncDiagnostics.TraceError <LocalizedException>(this.tracer, this, "Failed to delete user container {0}", arg); } } } return(container); }
// Token: 0x060001B3 RID: 435 RVA: 0x0000C60C File Offset: 0x0000A80C public static void TraceFunction <T0, T1>(Trace tracer, object objectToHash, string formatString, T0 arg0, T1 arg1) { AirSyncDiagnostics.GetSyncLogger().TraceFunction <T0, T1>(tracer, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), formatString, arg0, arg1); }
// Token: 0x060000B9 RID: 185 RVA: 0x00008144 File Offset: 0x00006344 private void CleanUpOldDevices(MailboxSession mailboxSession) { int num = 0; try { IThrottlingPolicy throttlingPolicy = (this.budget != null) ? this.budget.ThrottlingPolicy : null; if (throttlingPolicy == null || throttlingPolicy.EasMaxInactivityForDeviceCleanup.IsUnlimited || GlobalSettings.MaxNoOfPartnershipToAutoClean == 0) { AirSyncDiagnostics.TraceInfo <string, int>(ExTraceGlobals.RequestsTracer, null, "No cleanUp required for stale devices. Reason:{0}, MaxNoOfPartnershipsToAutoClean:{1}", (throttlingPolicy == null) ? "No throttling policy set." : "EasMaxInactivityForDeviceCleanup set to Unlimited.", GlobalSettings.MaxNoOfPartnershipToAutoClean); } else { TimeSpan timeSpan = TimeSpan.FromDays(throttlingPolicy.EasMaxInactivityForDeviceCleanup.Value); ExDateTime utcNow = ExDateTime.UtcNow; MobileDevice[] easDevices = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { easDevices = this.session.Find <MobileDevice>(MobileDevice.GetRootId(this.userId), QueryScope.OneLevel, null, null, 0); }); if (!adoperationResult.Succeeded) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Exception occurred during AD Operation during . Message:{0}", adoperationResult.Exception.Message); } else { if (easDevices != null) { List <MobileDevice> list = new List <MobileDevice>(easDevices); if (!this.CleanUpMangledDevices(list, out num)) { goto IL_271; } using (List <MobileDevice> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { MobileDevice device = enumerator.Current; if (device.WhenChangedUTC == null || !(ExDateTime.UtcNow.Subtract(new ExDateTime(ExTimeZone.UtcTimeZone, device.WhenChangedUTC.Value)) < timeSpan)) { if (DeviceInfo.CleanUpMobileDevice(mailboxSession, DeviceIdentity.FromMobileDevice(device), timeSpan)) { AirSyncDiagnostics.TraceDebug <MobileClientType, string, string>(ExTraceGlobals.RequestsTracer, null, "Delete device from AD as it doesn't exist in sync state. ClientType :{0} , DeviceType:{1}, DeviceId:{2}", device.ClientType, device.DeviceType, device.DeviceId); adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { this.session.Delete(device); }); if (!adoperationResult.Succeeded) { AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, null, "Exception occurred during AD Operation during . Message:{0}", adoperationResult.Exception.Message); } num++; } TimeSpan t = ExDateTime.UtcNow.Subtract(utcNow); if (num >= GlobalSettings.MaxNoOfPartnershipToAutoClean || t >= GlobalSettings.MaxCleanUpExecutionTime) { AirSyncDiagnostics.TraceDebug <int, double>(ExTraceGlobals.RequestsTracer, null, "Done Cleaning up stale devices. DevicesCleaned:{0}, ExecutionTime(in ms):{1}", num, t.TotalMilliseconds); break; } } } goto IL_271; } } AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, null, "No devices in AD for current user."); IL_271 :; } } } finally { if (this.clientType != MobileClientType.MOWA && Command.CurrentCommand != null) { Command.CurrentCommand.ProtocolLogger.SetValue(ProtocolLoggerData.NoOfDevicesRemoved, num); } } }
// Token: 0x060001C2 RID: 450 RVA: 0x0000C7D2 File Offset: 0x0000A9D2 public static void TraceWarning(Trace tracer, int lid, object objectToHash, string message) { AirSyncDiagnostics.GetSyncLogger().TraceWarning(tracer, lid, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), message); }
// Token: 0x06000557 RID: 1367 RVA: 0x0001EEDC File Offset: 0x0001D0DC public bool Validate() { lock (this.instanceLock) { if (!Enum.IsDefined(typeof(DeviceAccessStateReason), this.autoBlockReason)) { AirSyncDiagnostics.TraceInfo <DeviceAccessStateReason>(ExTraceGlobals.RequestsTracer, this, "Invalid AutoBlockReason {0}", this.autoBlockReason); return(false); } if (this.userAgentTimes == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No UserAgentTimes list"); return(false); } if (this.userAgentStrings == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No UserAgentStrings list"); return(false); } if (this.userAgentTimes.Count != this.userAgentStrings.Count) { AirSyncDiagnostics.TraceInfo <int, int>(ExTraceGlobals.RequestsTracer, this, "Lengths of UserAgentTimes ({0}) and UserAgentStrings ({1}) don't match", this.userAgentTimes.Count, this.userAgentStrings.Count); return(false); } if (this.recentCommandTimes == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No RecentCommandTimes list"); return(false); } if (this.recentCommandHashCodes == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No RecentCommandHashcodes list"); return(false); } if (this.recentCommandTimes.Count != this.recentCommandHashCodes.Count) { AirSyncDiagnostics.TraceInfo <int, int>(ExTraceGlobals.RequestsTracer, this, "Lengths of RecentCommandTimes ({0}) and RecentCommandHashcodes ({1}) don't match", this.recentCommandTimes.Count, this.recentCommandHashCodes.Count); return(false); } if (this.syncTimes == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No SyncTimes list"); return(false); } if (this.syncKeys == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No SyncKeys list"); return(false); } if (this.syncTimes.Count != this.syncKeys.Count) { AirSyncDiagnostics.TraceInfo <int, int>(ExTraceGlobals.RequestsTracer, this, "Lengths of SyncTimes ({0}) and SyncKeys ({1}) don't match", this.syncTimes.Count, this.syncKeys.Count); return(false); } if (this.watsons == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No Watsons list"); return(false); } if (this.outOfBudgets == null) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "No OutOfBudgets list"); return(false); } } return(true); }
// Token: 0x060001C4 RID: 452 RVA: 0x0000C80A File Offset: 0x0000AA0A public static void TraceWarning <T0>(Trace tracer, object objectToHash, string formatString, T0 arg0) { AirSyncDiagnostics.GetSyncLogger().TraceWarning <T0>(tracer, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), formatString, arg0); }
// Token: 0x060009E5 RID: 2533 RVA: 0x0003A2B0 File Offset: 0x000384B0 private void OnExecute() { try { this.ReadXmlRequest(); this.InitializeResponseXmlDocument(); foreach (SyncCollection syncCollection in base.Collections.Values) { AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "GIE.OnExecute CollectionId:{0}", syncCollection.CollectionId); syncCollection.WindowSize = 10000; try { GetItemEstimateCommand.ParseSyncKey(syncCollection); syncCollection.CreateSyncProvider(); this.GetChanges(syncCollection, false, true, false, false); this.FinalizeResponseNode(syncCollection); } catch (AirSyncPermanentException ex) { if (syncCollection.Status == SyncBase.ErrorCodeStatus.Success) { throw; } AirSyncDiagnostics.TraceInfo <AirSyncPermanentException>(ExTraceGlobals.RequestsTracer, this, "GIE.OnExecute exception caught, skipping collection\n\r{0}", ex); if (base.MailboxLogger != null) { base.MailboxLogger.SetData(MailboxLogDataName.GetItemEstimateCommand_OnExecute_Exception, ex); } if (syncCollection.Status == SyncBase.ErrorCodeStatus.ObjectNotFound && syncCollection is RecipientInfoCacheSyncCollection) { syncCollection.Status = SyncBase.ErrorCodeStatus.Success; syncCollection.HasBeenSaved = true; syncCollection.SetEmptyServerChanges(); } this.FinalizeResponseNode(syncCollection); base.ProtocolLogger.AppendValue(ProtocolLoggerData.Error, string.Format("FId:{0}:{1}", syncCollection.CollectionId, ex.ErrorStringForProtocolLogger)); base.ProtocolLogger.IncrementValue(ProtocolLoggerData.NumErrors); base.PartialFailure = true; } finally { if (syncCollection.SyncState != null) { if (!syncCollection.SyncState.IsColdStateDeserialized()) { base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.SyncStateKbLeftCompressed, (int)syncCollection.SyncState.GetColdStateCompressedSize() >> 10); AirSyncCounters.SyncStateKbLeftCompressed.IncrementBy(syncCollection.SyncState.GetColdStateCompressedSize() >> 10); } base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.SyncStateKb, (int)syncCollection.SyncState.GetTotalCompressedSize() >> 10); AirSyncCounters.SyncStateKbTotal.IncrementBy(syncCollection.SyncState.GetTotalCompressedSize() >> 10); base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.TotalSaveCount, syncCollection.SyncState.TotalSaveCount); base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.ColdSaveCount, syncCollection.SyncState.ColdSaveCount); base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.ColdCopyCount, syncCollection.SyncState.ColdCopyCount); base.ProtocolLogger.IncrementValueBy(syncCollection.InternalName, PerFolderProtocolLoggerData.TotalLoadCount, syncCollection.SyncState.TotalLoadCount); } syncCollection.Dispose(); } } } catch (Exception lastException) { base.LastException = lastException; if (base.Collections != null) { foreach (SyncCollection syncCollection2 in base.Collections.Values) { syncCollection2.Dispose(); } } throw; } }
// Token: 0x060001C5 RID: 453 RVA: 0x0000C826 File Offset: 0x0000AA26 public static void TraceWarning(Trace tracer, int lid, object objectToHash, string formatString, params object[] args) { AirSyncDiagnostics.GetSyncLogger().TraceWarning(tracer, lid, (long)((objectToHash == null) ? 0 : objectToHash.GetHashCode()), formatString, args); }
// Token: 0x060009DC RID: 2524 RVA: 0x00039C40 File Offset: 0x00037E40 public void GetChanges(SyncCollection collection, bool autoLoadFilterAndSyncKey, bool tryNullSync, bool commitSyncState, bool enumerateAllchanges) { AirSyncDiagnostics.TraceInfo <bool, bool, bool>(ExTraceGlobals.RequestsTracer, this, "GIE:GetChanges autoLoadFilterAndSyncKey:{0} tryNullSync:{1} commitSyncState:{2}", autoLoadFilterAndSyncKey, tryNullSync, commitSyncState); base.InitializeVersionFactory(base.Version); collection.SetDeviceSettings(this); long utcTicks = ExDateTime.Now.Date.UtcTicks; bool nullSyncAllowed = !base.IsInQuarantinedState || base.IsQuarantineMailAvailable; if (tryNullSync && !collection.CollectionRequiresSync(autoLoadFilterAndSyncKey, nullSyncAllowed)) { base.ProtocolLogger.SetProviderSyncType(collection.CollectionId, ProviderSyncType.N); collection.SetEmptyServerChanges(); return; } collection.OpenSyncState(autoLoadFilterAndSyncKey, base.SyncStateStorage); if (base.Context.Request.Version < 160 && collection.FolderType == DefaultFolderType.Drafts) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "[GIE.GetChanges] Ignoring request to sync drafts."); collection.SetEmptyServerChanges(); return; } try { if (collection.HasOptionsNodes) { collection.ParseSyncOptions(); } else if (collection.HasFilterNode) { collection.ParseFilterType(null); } else { collection.ParseStickyOptions(); } } catch (AirSyncPermanentException ex) { base.ProtocolLogger.AppendValue(ProtocolLoggerData.Error, string.Format("ParsingError:{0}", ex.ErrorStringForProtocolLogger)); base.GlobalStatus = SyncBase.ErrorCodeStatus.ProtocolError; throw; } collection.AddDefaultOptions(); collection.InitializeSchemaConverter(base.VersionFactory, base.GlobalInfo); bool syncProviderOptions = base.IsQuarantineMailAvailable && (base.GlobalInfo.DeviceAccessStateReason == DeviceAccessStateReason.ExternalCompliance || base.GlobalInfo.DeviceAccessStateReason == DeviceAccessStateReason.ExternalEnrollment); collection.SetSyncProviderOptions(syncProviderOptions); collection.OpenFolderSync(); collection.VerifySyncKey(false, base.GlobalInfo); if (collection.CollectionId != null) { base.ProtocolLogger.SetValue(collection.InternalName, PerFolderProtocolLoggerData.FolderId, collection.CollectionId); } base.ProtocolLogger.SetValue(collection.InternalName, PerFolderProtocolLoggerData.ClientSyncKey, collection.SyncKey.ToString(CultureInfo.InvariantCulture)); if (!base.IsInQuarantinedState || base.IsQuarantineMailAvailable) { collection.SetFolderSyncOptions(base.VersionFactory, base.IsQuarantineMailAvailable, base.GlobalInfo); base.GlobalWindowSize -= collection.GetServerChanges(base.GlobalWindowSize, enumerateAllchanges); } else { collection.SetEmptyServerChanges(); AirSyncDiagnostics.TraceInfo <DeviceAccessState>(ExTraceGlobals.RequestsTracer, this, "Setting empty server changes for quarantined state. Current AccessState = {0}", base.CurrentAccessState); } if (!base.IsInQuarantinedState && tryNullSync && collection.ServerChanges.Count == 0 && commitSyncState) { collection.SyncState.CustomVersion = new int?(9); object[] nullSyncPropertiesToSave = collection.GetNullSyncPropertiesToSave(); try { if (nullSyncPropertiesToSave != null) { collection.SyncState.CommitState(collection.PropertiesToSaveForNullSync, nullSyncPropertiesToSave); } else { collection.SyncState.CommitState(null, null); } collection.UpdateSavedNullSyncPropertiesInCache(nullSyncPropertiesToSave); base.ProtocolLogger.IncrementValueBy(collection.InternalName, PerFolderProtocolLoggerData.SyncStateKbCommitted, (int)collection.SyncState.GetLastCommittedSize() >> 10); } catch (StorageTransientException) { AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, this, "Transient exception thrown while saving syncstate in GIE\r\nSkipping exception due to only being for the null sync optimization."); } } }
// Token: 0x060016C0 RID: 5824 RVA: 0x00089688 File Offset: 0x00087888 public override ISyncProvider CreateSyncProvider(Folder folder, ISyncLogger syncLogger = null) { if (this.UseNewProvider) { return(new FirstTimeSyncProvider(folder, this.trackReadFlagChanges, this.trackAssociatedMessageChanges, this.trackConversations, this.allowTableRestrict, false)); } return(new MailboxSyncProvider(folder, this.trackReadFlagChanges, this.trackAssociatedMessageChanges, false, this.trackConversations, this.allowTableRestrict, false, AirSyncDiagnostics.GetSyncLogger())); }