diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 65d76a390..5166a7cad 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -113,6 +113,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #import #import +#import #include "iCalEvent+ActiveSync.h" #include "iCalToDo+ActiveSync.h" @@ -138,10 +139,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @implementation SOGoActiveSyncDispatcher +static BOOL debugOn = NO; + - (id) init { [super init]; + debugOn = [[SOGoSystemDefaults sharedSystemDefaults] easDebugEnabled]; folderTableURL = nil; return self; } @@ -2607,7 +2611,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pool = [[NSAutoreleasePool alloc] init]; ASSIGN(context, theContext); - + // Get the device ID, device type and "stash" them deviceId = [[theRequest uri] deviceId]; [context setObject: deviceId forKey: @"DeviceId"]; @@ -2670,6 +2674,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if (d) { + if (debugOn) + [self logWithFormat: @"EAS - request for device %@: %@", [context objectForKey: @"DeviceId"], [[[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding] autorelease]]; + builder = [[[NSClassFromString(@"DOMSaxBuilder") alloc] init] autorelease]; dom = [builder buildFromData: d]; documentElement = [dom documentElement]; @@ -2699,6 +2706,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [theResponse setHeader: @"Sync,SendMail,SmartForward,SmartReply,GetAttachment,GetHierarchy,CreateCollection,DeleteCollection,MoveCollection,FolderSync,FolderCreate,FolderDelete,FolderUpdate,MoveItems,GetItemEstimate,MeetingResponse,Search,Settings,Ping,ItemOperations,ResolveRecipients,ValidateCert" forKey: @"MS-ASProtocolCommands"]; [theResponse setHeader: @"2.5,12.0,12.1,14.0,14.1" forKey: @"MS-ASProtocolVersions"]; + if (debugOn && [[theResponse content] length]) + [self logWithFormat: @"EAS - response for device %@: %@", [context objectForKey: @"DeviceId"], [[[NSString alloc] initWithData: [[theResponse content] wbxml2xml] encoding: NSUTF8StringEncoding] autorelease]]; + RELEASE(context); RELEASE(pool); diff --git a/Documentation/SOGoInstallationGuide.asciidoc b/Documentation/SOGoInstallationGuide.asciidoc index 4f35a7e47..68b8206da 100644 --- a/Documentation/SOGoInstallationGuide.asciidoc +++ b/Documentation/SOGoInstallationGuide.asciidoc @@ -2439,6 +2439,11 @@ Defaults to `0`, which means no overwrite is performed. Setting this parameter to a value greater than `512` will have unexpected behaviour with various ActiveSync clients. +|S |SOGoEASDebugEnabled +|Parameter used to log the complete request and response of every single +EAS command. + +Defaults to `NO`, which means no logging is performed. |======================================================================= Please be aware of the following limitations: diff --git a/NEWS b/NEWS index 0287f5a22..96f96e766 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Enhancements - during login, we now extract the domain from the user to accelerate authentication requests on sources - make sure sure email invitations can always be read by EAS clients - now able to print event/task's description (new components only) in the list view (#2881) + - now possible to log EAS commands using the SOGoEASDebugEnabled system defaults Bug fixes - now keep the BodyPreference for future EAS use and default to MIME if none set (#3146) diff --git a/SoObjects/SOGo/SOGoSystemDefaults.h b/SoObjects/SOGo/SOGoSystemDefaults.h index 7f811f208..50064c0de 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.h +++ b/SoObjects/SOGo/SOGoSystemDefaults.h @@ -1,6 +1,6 @@ /* SOGoSystemDefaults.h - this file is part of SOGo * - * Copyright (C) 2009-2014 Inverse inc. + * Copyright (C) 2009-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +64,8 @@ - (BOOL) uixAdditionalPreferences; - (BOOL) uixDebugEnabled; +- (BOOL) easDebugEnabled; + - (NSString *) pageTitle; - (NSArray *) supportedLanguages; diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m index 9fbb9ef48..8c9181665 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.m +++ b/SoObjects/SOGo/SOGoSystemDefaults.m @@ -1,6 +1,6 @@ /* SOGoSystemDefaults.m - this file is part of SOGo * - * Copyright (C) 2009-2014 Inverse inc. + * Copyright (C) 2009-2015 Inverse inc. * Copyright (C) 2012 Jeroen Dekkers * * This file is free software; you can redistribute it and/or modify @@ -427,6 +427,11 @@ _injectConfigurationFromFile (NSMutableDictionary *defaultsDict, return [self boolForKey: @"SOGoUIxDebugEnabled"]; } +- (BOOL) easDebugEnabled +{ + return [self boolForKey: @"SOGoEASDebugEnabled"]; +} + - (NSString *) pageTitle { return [self stringForKey: @"SOGoPageTitle"];