PHP-Push-2
PHP-Push-2 copied to clipboard
BackendCombined: Logon failed on BackendCalDAV
I've been using BackendIMAP with Dovecot for some time and am very happy with it, now i wanted to also add CalDAV and CardDAV via Baikal Server. The username and password are identical for both Backends, but for some reason the authentication fails to the CalDAV backend:
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] -------- Start
06/03/2013 22:11:52 [ 4330] [ INFO] [[email protected]] Version='SVN-trunk-r1685' method='POST' from='192.168.0.41' cmd='Sync' getUser='[email protected]' devId='androidc1198121097' devType='Android'
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Used timezone 'Europe/Berlin'
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Including backend file: '/srv/www/php-push-2/backend/combined/combined.php'
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Including backend file: '/srv/www/php-push-2/backend/imap/imap.php'
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:49 Constant IMAP_SERVER already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:52 Constant IMAP_PORT already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:55 Constant IMAP_OPTIONS already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:61 Constant IMAP_DEFAULTFROM already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:64 Constant IMAP_SENTFOLDER already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:67 Constant IMAP_INLINE_FORWARD already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:70 Constant IMAP_USE_IMAPMAIL already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/imap/config.php:75 Constant IMAP_EXCLUDED_FOLDERS already defined (8)
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Including backend file: '/srv/www/php-push-2/backend/caldav/caldav.php'
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/caldav/config.php:48 Constant CALDAV_SERVER already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/caldav/config.php:51 Constant CALDAV_PORT already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/caldav/config.php:54 Constant CALDAV_PATH already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/caldav/config.php:57 Constant CALDAV_PERSONAL already defined (8)
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Including backend file: '/srv/www/php-push-2/backend/carddav/carddav.php'
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/carddav/config.php:48 Constant CARDDAV_SERVER already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/carddav/config.php:51 Constant CARDDAV_PORT already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/carddav/config.php:54 Constant CARDDAV_PATH already defined (8)
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/backend/carddav/config.php:57 Constant CARDDAV_PRINCIPAL already defined (8)
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Combined 3 backends loaded.
06/03/2013 22:11:52 [ 4330] [ WARN] [[email protected]] /srv/www/php-push-2/lib/default/filestatemachine.php:346 Illegal string offset 'version' (2)
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Request::ProcessHeaders() ASVersion: 14.0
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] ZPush::CommandNeedsProvisioning(0): true
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] FileStateMachine->GetState() on file: '/var/lib/z-push/7/9/androidc1198121097-devicedata'
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] ASDevice data loaded for user: '[email protected]'
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] TopCollector(): Initialized mutexid Resource id #156 and memid Resource id #157.
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] LoopDetection(): Initialized mutexid Resource id #159 and memid Resource id #160.
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] ZPush::HierarchyCommand(0): false
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] DeviceManager->ProvisioningRequired('395192331') saved device key '395192331': false
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] ZPush::CommandNeedsAuthentication(0): true
06/03/2013 22:11:52 [ 4330] [DEBUG] [[email protected]] Combined->Logon('[email protected]', '',***))
06/03/2013 22:11:55 [ 4330] [DEBUG] [[email protected]] BackendIMAP->Logon(): User '[email protected]' is authenticated on IMAP
06/03/2013 22:11:55 [ 4330] [ WARN] [[email protected]] BackendCalDAV->Logon(): User '[email protected]' is not authenticated on CalDAV
06/03/2013 22:11:55 [ 4330] [DEBUG] [[email protected]] Combined->Logon() failed on BackendCalDAV
06/03/2013 22:11:55 [ 4330] [ INFO] [[email protected]] AuthenticationRequiredException: Access denied. Username or password incorrect - code: 0
06/03/2013 22:11:55 [ 4330] [ INFO] [[email protected]] User-agent: 'Android/4.2.2-EAS-1.3'
06/03/2013 22:11:55 [ 4330] [DEBUG] [[email protected]] ZPush::PrintZPushLegal()
06/03/2013 22:11:55 [ 4330] [ WARN] [[email protected]] IP: 192.168.0.41 failed to authenticate user '[email protected]'
06/03/2013 22:11:55 [ 4330] [DEBUG] [[email protected]] LoopDetection->ProcessLoopDetectionTerminate()
06/03/2013 22:11:55 [ 4330] [DEBUG] [[email protected]] -------- End
The CalDAV and CardDAV backends work fine with Thunderbird/Lightning and the right extensions.
I was having this issue connecting to SabreDAV, it seems it was an issue with the digest authentication. I fixed this in caldav-client-v2.php in the DoRequest function where it said "TODO: add support for qop and related options" add the following after $A2:
$qop = $digest_data['qop'];
$nc = '00000001';
$opaque = $digest_data['opaque'];
$cnonce = substr('6346'.md5(time()),4,16); // This is just a random sort of thing, I made it up, not from anywhere.
$authdig = 'Authorization: Digest username="' . $this->user . '", realm="' . $digest_data['realm'] . '", nonce="' . $digest_data['nonce'] . '", uri="' . $url . '", response="' . md5($A1 . ":" . $digest_data['nonce'] . ':'.$nc.':'.$cnonce.':'.$qop. ":" . $A2) . '"';
$authdig .= ', opaque="'.$opaque.'"';
$authdig .= ', qop='.$qop.', nc='.$nc;
$authdig .= ', cnonce="'.$cnonce.'"';
$headers[] = $authdig;
This is based off this wikipedia article: http://en.wikipedia.org/wiki/Digest_access_authentication
Hope this helps