View Issue Details

IDProjectCategoryView StatusLast Update
0005456SOGoActiveSyncpublic2022-01-14 15:19
ReporterMichele Giacomoli Assigned Tofrancis  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionfixed 
Summary0005456: NSInvalidArgumentException when a user from an SQL source tries to FolderSync
Description

Hi, I've set up sogo with Active Sync support and two SOGoUserSources: one type=ldap and one type=sql.

Users from both sources work correctly with sogo web interface. I can log in, see mails, etc. But when configuring ActiveSync, users from sql source fail, while users from ldap work fine.

All I see from sogo logs is this:

2022-01-11 15:27:36.435 sogod[7:7] EXCEPTION: <NSException: 0x55e68f1deb50> NAME:NSInvalidArgumentException REASON:SoHTTPException(instance) does not recognize lookupPersonalFolder:ignoringRights: INFO:(null)                                                             
Jan 11 15:27:36 sogod [7]: 11.22.33.44 "POST /SOGo/Microsoft-Server-ActiveSync?Cmd=FolderSync&User=xxxx@yyyyy&DeviceId=55DC1BD882DF43E0A2B750035AED8CA9&DeviceType=WindowsOutlook15 HTTP/1.1" 501 0/13 0.004 - - 0 - 13

SOGoUserSources is configured as follow:

  SOGoUserSources = (
    {
      type = ldap;
      [ldap configuration]
    },
    {
      canAuthenticate = YES;
      id = users1;
      isAddressBook = NO;
      type = sql;
      userPasswordAlgorithm = sha512-crypt;
      viewURL = "mysql://user:password@dbserver:3306/db/sogo_users";
      ModulesConstraints = {
        Calendar = {
          objectClass = nonExistingClass;
        };
      };
    }
  );

sogo_users table has the following columns:

  • c_uid
  • c_name
  • c_password
  • c_cn
  • mail

I'm trying to setup a debug environment for more details, but, since it's a docker image, and ubuntu 20.04 which is the base for the image seems to miss gnustep debug symbols packages, it takes me a while

Reproduced with Sogo 5.3.0, 5.4.0

Steps To Reproduce
  • Install sogo with activesync support
  • Setup an sql source
  • Try ActiveSync FolderSync command for a user from sql source
TagsNo tags attached.

Activities

francis

francis

2022-01-11 18:44

administrator   ~0015748

Please try the next nightly build (>= 20220112) and let me know if the problem is resolved.

Michele Giacomoli

Michele Giacomoli

2022-01-12 08:42

reporter   ~0015754

Installed version 5.4.0.20220112-1 from your repos (ubuntu 20.04) and nothing changed.

BTW I see your changes "just" return 403 instead of raising an NSException, so I have to ask you: Is sql type source supposed not to work with Active Sync, or am I missing some source configuration required by AS to work?

francis

francis

2022-01-12 13:30

administrator   ~0015758

Just to be sure -- you have the exact same exception in your log file? You don't have any of the new Forbidden access log entry?

Can you use gdb to set a breakpoint on SOGoActiveSyncDispatcher.m:713 and share the result of po appointmentFolders?

Michele Giacomoli

Michele Giacomoli

2022-01-12 15:11

reporter   ~0015759

Yes, I confirm the exception is the same:

2022-01-12 15:38:46.412 sogod[14018] EXCEPTION: <NSException: 0x556033045470> NAME:NSInvalidArgumentException REASON:SoHTTPException(instance) does not recognize lookupPersonalFolder:ignoringRights: INFO:(null)

BTW I managed to have sogo installed with ubuntu 16.04 (the last with gnustep debug symbols). So, here is the backtrace when the exception arises:

(gdb) bt
#0  -[NSException raise] (self=0x555555c92b40, _cmd=0x7ffff5819b60 <_OBJC_SELECTOR_TABLE+384>) at NSException.m:960
0000001  0x00007ffff5333bc3 in +[NSException raise:format:] (self=0x7ffff5819e20 <_OBJC_Class_NSException>, _cmd=<optimized out>, 
    name=0x7ffff581a490 <_OBJC_INSTANCE_4>, format=0x7ffff5849110 <_OBJC_INSTANCE_10>) at NSException.m:840
0000002  0x00007ffff5386c16 in -[NSObject doesNotRecognizeSelector:] (self=0x555555c85a90, _cmd=<optimized out>, aSelector=<optimized out>)
    at NSObject.m:1765
0000003  0x00007ffff5444edb in GSFFIInvocationCallback (cif=0x555555c86380, retp=0x7fffffffbaa0, args=<optimized out>, user=0x555555c88200)
    at GSFFIInvocation.m:629
0000004  0x00007ffff10b8c2f in ffi_closure_unix64_inner () from /usr/lib/x86_64-linux-gnu/libffi.so.6
0000005  0x00007ffff10b8fa8 in ffi_closure_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
0000006  0x00007ffff7b55685 in -[SOGoUser personalCalendarFolderInContext:] (self=0x555555cf9100, 
    _cmd=0x7fffe7adc1d0 <_OBJC_SELECTOR_TABLE+1328>, context=0x555555e53910) at SOGoUser.m:1060
0000007  0x00007fffe788ff56 in -[SOGoActiveSyncDispatcher processFolderSync:inResponse:] (self=0x555555c75e10, _cmd=0x555555d79910, 
    theDocumentElement=0x5555558d7d60, theResponse=0x555555ab9fd0) at SOGoActiveSyncDispatcher.m:840
0000008  0x00007fffe78a72f9 in -[SOGoActiveSyncDispatcher dispatchRequest:inResponse:context:] (self=0x555555c75e10, 
    _cmd=0x7fffe7f2f380 <_OBJC_SELECTOR_TABLE+128>, theRequest=0x555555da1d10, theResponse=0x555555ab9fd0, theContext=0x555555e53910)
    at SOGoActiveSyncDispatcher.m:4421
0000009  0x00007fffe7d26df9 in -[SOGoMicrosoftActiveSyncActions microsoftServerActiveSyncAction] (self=0x555555b13400, _cmd=0x555555d79920)
    at SOGoMicrosoftActiveSyncActions.m:59
0000010 0x00007ffff6be768f in -[WODirectAction performActionNamed:] (self=0x555555b13400, _cmd=0x7ffff6fb8f00 <_OBJC_SELECTOR_TABLE+928>, 
    _actionName=0x555555e87020) at WODirectAction.m:97
0000011 0x00007ffff6c78bfc in -[SoActionInvocation callOnObject:withPositionalParametersWhenNotNil:inContext:] (self=0x5555558ebae0, 
    _cmd=0x7ffff6fb8f30 <_OBJC_SELECTOR_TABLE+976>, _client=0x555555bf3ca0, _positionalArgs=0x0, _ctx=0x555555e53910)
    at SoActionInvocation.m:300
0000012 0x00007ffff6c78d28 in -[SoActionInvocation callOnObject:inContext:] (self=0x5555558ebae0, 
    _cmd=0x7ffff6fb54a0 <_OBJC_SELECTOR_TABLE+672>, _client=0x555555bf3ca0, _ctx=0x555555e53910) at SoActionInvocation.m:316
0000013 0x00007ffff6c73229 in -[SoObjectMethodDispatcher dispatchInContext:] (self=0x555555c81080, 
    _cmd=0x7ffff6fb6b80 <_OBJC_SELECTOR_TABLE+1536>, _ctx=0x555555e53910) at SoObjectMethodDispatcher.m:191
0000014 0x00007ffff6c756ea in -[SoObjectRequestHandler handleRequest:inContext:session:application:] (self=0x555555b49960, 
    _cmd=0x7ffff6f37c90 <_OBJC_SELECTOR_TABLE+848>, _rq=0x555555da1d10, _ctx=0x555555e53910, _sn=0x0, app=0x555555bf3ca0)
    at SoObjectRequestHandler.m:584
0000015 0x00007ffff6bf93f6 in -[WORequestHandler handleRequest:] (self=0x555555b49960, _cmd=0x7ffff6f001d0 <_OBJC_SELECTOR_TABLE+1616>, 
    _request=0x555555da1d10) at WORequestHandler.m:237
0000016 0x00007ffff6bb94ce in -[WOCoreApplication dispatchRequest:usingHandler:] (self=0x555555bf3ca0, 
    _cmd=0x7ffff6f00220 <_OBJC_SELECTOR_TABLE+1696>, _request=0x555555da1d10, handler=0x555555b49960) at WOCoreApplication.m:712
0000017 0x00007ffff6bb97ed in -[WOCoreApplication dispatchRequest:] (self=0x555555bf3ca0, _cmd=0x5555557645c0 <_OBJC_SELECTOR_TABLE+1664>, 
    _request=0x555555da1d10) at WOCoreApplication.m:752
0000018 0x000055555555ce5b in -[SOGo dispatchRequest:] (self=0x555555bf3ca0, _cmd=0x7ffff6f9e180 <_OBJC_SELECTOR_TABLE+1760>, 
    _request=0x555555da1d10) at SOGo.m:584
0000019 0x00007ffff6c63a3a in -[WOHttpTransaction _run] (self=0x555555e67310, _cmd=0x7ffff6f9e1b0 <_OBJC_SELECTOR_TABLE+1808>)
    at WOHttpTransaction.m:566
0000020 0x00007ffff6c63db0 in -[WOHttpTransaction run] (self=0x555555e67310, _cmd=0x7ffff6f9bed0 <_OBJC_SELECTOR_TABLE+1168>)
    at WOHttpTransaction.m:619
0000021 0x00007ffff6c5fa25 in -[WOHttpAdaptor runConnection:] (self=0x555555e26fc0, _cmd=0x7ffff6f9bf70 <_OBJC_SELECTOR_TABLE+1328>, 
    _socket=0x555555e37910) at WOHttpAdaptor.m:373
0000022 0x00007ffff6c5fc45 in -[WOHttpAdaptor _handleAcceptedConnection:] (self=0x555555e26fc0, _cmd=0x7ffff6f9bf80 <_OBJC_SELECTOR_TABLE+1344>, 
    _connection=0x555555e37910) at WOHttpAdaptor.m:407
0000023 0x00007ffff6c6004e in -[WOHttpAdaptor _handleConnection:] (self=0x555555e26fc0, _cmd=0x7ffff6f9c020 <_OBJC_SELECTOR_TABLE+1504>, 
    connection=0x555555e37910) at WOHttpAdaptor.m:466
0000024 0x00007ffff6c604ed in -[WOHttpAdaptor acceptConnection:] (self=0x555555e26fc0, _cmd=0x7ffff6f9be90 <_OBJC_SELECTOR_TABLE+1104>, 
    _notification=0x555555e67440) at WOHttpAdaptor.m:527
0000025 0x00007ffff53770d7 in -[NSNotificationCenter _postAndRelease:] (self=0x5555558cf670, _cmd=<optimized out>, notification=0x555555e67440)
    at NSNotificationCenter.m:1307
0000026 0x00007ffff6015f7e in -[NSObject(FileObjectWatcher) receivedEvent:type:extra:forMode:] (self=0x555555e313f0, 
    _cmd=0x7ffff58d5490 <_OBJC_SELECTOR_TABLE+304>, _fdData=0x7, _type=ET_RDESC, _extra=0x7, _mode=0x7ffff58641f0 <_OBJC_INSTANCE_2>)
    at NSRunLoop+FileObjects.m:58
0000027 0x00007ffff547ed2b in -[GSRunLoopCtxt pollUntil:within:] (self=<optimized out>, _cmd=0x7ffff58633e0 <_OBJC_SELECTOR_TABLE+1216>, 
    milliseconds=<optimized out>, contexts=<optimized out>) at GSRunLoopCtxt.m:642
0000028 0x00007ffff53bd500 in -[NSRunLoop acceptInputForMode:beforeDate:] (self=0x555555bf4820, _cmd=0x7ffff5863420 <_OBJC_SELECTOR_TABLE+1280>, 
    mode=0x7ffff58641f0 <_OBJC_INSTANCE_2>, limit_date=<optimized out>) at NSRunLoop.m:1217
0000029 0x00007ffff53bd9b2 in -[NSRunLoop runMode:beforeDate:] (self=0x555555bf4820, _cmd=<optimized out>, 
    mode=0x7ffff58641f0 <_OBJC_INSTANCE_2>, date=0x555555b65a60) at NSRunLoop.m:1288
0000030 0x00007ffff6bb8cf9 in -[WOCoreApplication run] (self=0x555555bf3ca0, _cmd=0x555555764320 <_OBJC_SELECTOR_TABLE+992>)
    at WOCoreApplication.m:584
0000031 0x000055555555bfa2 in -[SOGo run] (self=0x555555bf3ca0, _cmd=0x7ffff6f22ed0 <_OBJC_SELECTOR_TABLE+208>) at SOGo.m:337
0000032 0x00007ffff6be380a in WOApplicationMain (_appClassName=0x555555762160 <_OBJC_INSTANCE_0>, argc=13, argv=0x7fffffffebc8)
    at WOApplicationMain.m:42
0000033 0x00007ffff6c04dfd in WOWatchDogApplicationMain (appName=0x555555762160 <_OBJC_INSTANCE_0>, argc=13, argv=0x7fffffffebc8)
    at WOWatchDogApplicationMain.m:1049
0000034 0x000055555555ab39 in main (argc=13, argv=0x7fffffffebc8, env=0x7fffffffec38) at sogod.m:51

About your request, I set a breakpoint with the command

(gdb) b  SOGoActiveSyncDispatcher.m:713
(gdb) c

but the breakpoint never gets triggered.

Michele Giacomoli

Michele Giacomoli

2022-01-12 19:04

reporter   ~0015760

Ok, this afternoon I studied a bit of Objective C language and tried to follow the backtrace.

The problem is caused by a piece of source configuration I copied from another sogo instance, that hides/disables calendars. In particular ModulesConstraints variable was set to

      {
        Calendar = {
          objectClass = nonExistingClass;
        };
      };

Removing this configuration ActiveSync with sql source works, even if this (wrong?) configuration should be handled/logged in a better way IMHO.

francis

francis

2022-01-12 21:03

administrator   ~0015761

I've pushed another fix, but you'll likely get another exception. Can you test again the next nightly build? Thanks!

Michele Giacomoli

Michele Giacomoli

2022-01-13 09:58

reporter   ~0015763

I confirm the exception has changed now:

2022-01-13 10:49:49.592 sogod[3653] EXCEPTION: <NSException: 0x55e3c67d3320> NAME:NSInvalidArgumentException REASON:SoHTTPException(instance) does not recognize subFolders INFO:(null)

Here is the backtrace:

(gdb) bt
#0  -[NSException raise] (self=0x555556013150, _cmd=0x7ffff5819b60 <_OBJC_SELECTOR_TABLE+384>) at NSException.m:960
0000001  0x00007ffff5333bc3 in +[NSException raise:format:] (self=0x7ffff5819e20 <_OBJC_Class_NSException>, _cmd=<optimized out>, 
    name=0x7ffff581a490 <_OBJC_INSTANCE_4>, format=0x7ffff5849110 <_OBJC_INSTANCE_10>) at NSException.m:840
0000002  0x00007ffff5386c16 in -[NSObject doesNotRecognizeSelector:] (self=0x55555600ecc0, _cmd=<optimized out>, 
    aSelector=<optimized out>) at NSObject.m:1765
0000003  0x00007ffff5444edb in GSFFIInvocationCallback (cif=0x5555560114a0, retp=0x7fffffffbae0, args=<optimized out>, 
    user=0x555556011460) at GSFFIInvocation.m:629
0000004  0x00007ffff10b8c2f in ffi_closure_unix64_inner () from /usr/lib/x86_64-linux-gnu/libffi.so.6
0000005  0x00007ffff10b8fa8 in ffi_closure_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
0000006  0x00007fffe78927d7 in -[SOGoActiveSyncDispatcher processFolderSync:inResponse:] (self=0x555555af8e30, _cmd=0x555555ba0f50, 
    theDocumentElement=0x555555c42430, theResponse=0x555555e71950) at SOGoActiveSyncDispatcher.m:1132
0000007  0x00007fffe78a7353 in -[SOGoActiveSyncDispatcher dispatchRequest:inResponse:context:] (self=0x555555af8e30, 
    _cmd=0x7fffe7f2f380 <_OBJC_SELECTOR_TABLE+128>, theRequest=0x555555e556d0, theResponse=0x555555e71950, 
    theContext=0x555555e68030) at SOGoActiveSyncDispatcher.m:4422
0000008  0x00007fffe7d26df9 in -[SOGoMicrosoftActiveSyncActions microsoftServerActiveSyncAction] (self=0x555555c5f230, 
    _cmd=0x555555ba0f70) at SOGoMicrosoftActiveSyncActions.m:59
0000009  0x00007ffff6be768f in -[WODirectAction performActionNamed:] (self=0x555555c5f230, 
    _cmd=0x7ffff6fb8f00 <_OBJC_SELECTOR_TABLE+928>, _actionName=0x555555c82280) at WODirectAction.m:97
0000010 0x00007ffff6c78bfc in -[SoActionInvocation callOnObject:withPositionalParametersWhenNotNil:inContext:] (
    self=0x555555d3d460, _cmd=0x7ffff6fb8f30 <_OBJC_SELECTOR_TABLE+976>, _client=0x555555bf40d0, _positionalArgs=0x0, 
    _ctx=0x555555e68030) at SoActionInvocation.m:300
0000011 0x00007ffff6c78d28 in -[SoActionInvocation callOnObject:inContext:] (self=0x555555d3d460, 
    _cmd=0x7ffff6fb54a0 <_OBJC_SELECTOR_TABLE+672>, _client=0x555555bf40d0, _ctx=0x555555e68030) at SoActionInvocation.m:316
0000012 0x00007ffff6c73229 in -[SoObjectMethodDispatcher dispatchInContext:] (self=0x555555d3d590, 
    _cmd=0x7ffff6fb6b80 <_OBJC_SELECTOR_TABLE+1536>, _ctx=0x555555e68030) at SoObjectMethodDispatcher.m:191
0000013 0x00007ffff6c756ea in -[SoObjectRequestHandler handleRequest:inContext:session:application:] (self=0x555555b46950, 
    _cmd=0x7ffff6f37c90 <_OBJC_SELECTOR_TABLE+848>, _rq=0x555555e556d0, _ctx=0x555555e68030, _sn=0x0, app=0x555555bf40d0)
    at SoObjectRequestHandler.m:584
0000014 0x00007ffff6bf93f6 in -[WORequestHandler handleRequest:] (self=0x555555b46950, 
    _cmd=0x7ffff6f001d0 <_OBJC_SELECTOR_TABLE+1616>, _request=0x555555e556d0) at WORequestHandler.m:237
0000015 0x00007ffff6bb94ce in -[WOCoreApplication dispatchRequest:usingHandler:] (self=0x555555bf40d0, 
    _cmd=0x7ffff6f00220 <_OBJC_SELECTOR_TABLE+1696>, _request=0x555555e556d0, handler=0x555555b46950) at WOCoreApplication.m:712
0000016 0x00007ffff6bb97ed in -[WOCoreApplication dispatchRequest:] (self=0x555555bf40d0, 
    _cmd=0x5555557645c0 <_OBJC_SELECTOR_TABLE+1664>, _request=0x555555e556d0) at WOCoreApplication.m:752
0000017 0x000055555555ce5b in -[SOGo dispatchRequest:] (self=0x555555bf40d0, _cmd=0x7ffff6f9e180 <_OBJC_SELECTOR_TABLE+1760>, 
    _request=0x555555e556d0) at SOGo.m:584
0000018 0x00007ffff6c63a3a in -[WOHttpTransaction _run] (self=0x555555e37a40, _cmd=0x7ffff6f9e1b0 <_OBJC_SELECTOR_TABLE+1808>)
    at WOHttpTransaction.m:566
0000019 0x00007ffff6c63db0 in -[WOHttpTransaction run] (self=0x555555e37a40, _cmd=0x7ffff6f9bed0 <_OBJC_SELECTOR_TABLE+1168>)
    at WOHttpTransaction.m:619
0000020 0x00007ffff6c5fa25 in -[WOHttpAdaptor runConnection:] (self=0x555555e273f0, 
    _cmd=0x7ffff6f9bf70 <_OBJC_SELECTOR_TABLE+1328>, _socket=0x555555e36b60) at WOHttpAdaptor.m:373
0000021 0x00007ffff6c5fc45 in -[WOHttpAdaptor _handleAcceptedConnection:] (self=0x555555e273f0, 
    _cmd=0x7ffff6f9bf80 <_OBJC_SELECTOR_TABLE+1344>, _connection=0x555555e36b60) at WOHttpAdaptor.m:407
0000022 0x00007ffff6c6004e in -[WOHttpAdaptor _handleConnection:] (self=0x555555e273f0,
francis

francis

2022-01-13 13:47

administrator   ~0015765

Thanks. Please try the next nightly build.

Michele Giacomoli

Michele Giacomoli

2022-01-14 10:29

reporter   ~0015770

With last nigthly build I don't see Exceptions anymore, but the behavior on the client (MS Outlook 2016) is weird and not so deterministic.

Sometimes the client seems unable to sync the mail folders, while in the calendar section I see 1 or more empty calendars for the user with disabled calendar. While testing adding and removing user, disabling and enabling calendars in sogo configuration, I managed for a moment to have no calendars created for that user on the client, and in that instance the mail box synced fine. During another test the mail box got synced, the calendar has been created but the status message on the client said "Waiting for the server response..."

It seems like client expects a calendar that it can't sync, and sometimes it tries to sync this before the mailbox, blocking the account synchronization.

francis

francis

2022-01-14 13:54

administrator   ~0015771

Have you tried with a fresh EAS profile?

Michele Giacomoli

Michele Giacomoli

2022-01-14 15:19

reporter   ~0015772

Yes, tried with newly created user, with calendar disabled the first time. The sync didn't work until I reenabled it and recreated the Outlook account.

Then I tried to close Outlook client and remove the account, run command sogo-tool remove <account@domain.tld>, restart sogo with calendar disabled, recreate the account on Outlook, and the mailbox sync still didn't work.

Related Changesets

sogo: master cf341822

2022-01-11 13:41

francis


Details Diff
fix(eas): handle module constraints

Fixes 0005456
Affected Issues
0005456
mod - ActiveSync/SOGoActiveSyncDispatcher.m Diff File

sogo: master 73edd45a

2022-01-12 16:01

francis


Details Diff
fix(eas): handle module constraints

Fixes 0005456
Affected Issues
0005456
mod - ActiveSync/SOGoActiveSyncDispatcher.m Diff File

sogo: master 39e1ef53

2022-01-13 08:42

francis


Details Diff
fix(eas): handle module constraints

Fixes 0005456
Affected Issues
0005456
mod - ActiveSync/SOGoActiveSyncDispatcher.m Diff File

Issue History

Date Modified Username Field Change
2022-01-11 15:55 Michele Giacomoli New Issue
2022-01-11 16:30 francis Description Updated
2022-01-11 18:43 francis Changeset attached => sogo master cf341822
2022-01-11 18:43 francis Assigned To => francis
2022-01-11 18:43 francis Resolution open => fixed
2022-01-11 18:44 francis Note Added: 0015748
2022-01-11 22:06 francis Status new => feedback
2022-01-12 08:42 Michele Giacomoli Note Added: 0015754
2022-01-12 08:42 Michele Giacomoli Status feedback => assigned
2022-01-12 13:30 francis Note Added: 0015758
2022-01-12 15:11 Michele Giacomoli Note Added: 0015759
2022-01-12 19:04 Michele Giacomoli Note Added: 0015760
2022-01-12 21:02 francis Changeset attached => sogo master 73edd45a
2022-01-12 21:03 francis Note Added: 0015761
2022-01-13 09:58 Michele Giacomoli Note Added: 0015763
2022-01-13 13:46 francis Changeset attached => sogo master 39e1ef53
2022-01-13 13:47 francis Note Added: 0015765
2022-01-14 10:29 Michele Giacomoli Note Added: 0015770
2022-01-14 13:54 francis Note Added: 0015771
2022-01-14 15:19 Michele Giacomoli Note Added: 0015772