Request for Feedback: New CalDAV and CardDAV implementation for Kopano



  • Hello,
    very amazing - the KDav-package is very helpful.

    Unfortunatelly I found an issue, but I am not really sure, whether it is caused by emClient or Kdav or something else:
    My szenario exists of my UCS-Kopano server, two client computers and an Android phone.

    • PC1: Windows 10, Outlook 2007 (IMAP) with CalDAV-Synchronizer as Addin
    • PC2: Windows 10, eClient (IMAP) with builtin CalDAV/CardDAV
    • UCS-Server with Kopmano, Caldav and KDav
    • Huawei P10 with latest Android

    I can create Tasks and Calendar-entries on all devices and they become synchronized without problems.

    I can create contacts on Android and PC1 with Outlook 2007 and they become synchronized to all devices - even to PC2.

    If I create a contact on PC2 it appears for one second and becomes deleted, after synchronizing with KDav-server.
    Strange: Deleting a contact works, so it seems not to be a permission-problem.

    The setting of the contact-access is the same on PC1 and PC2:
    https://dav.meinserver.de:8443/addressbooks/vw/Kontakte

    Enclosure you will find the links to my kdav.log files, because my posting will be too large, if I post the logs.

    PC1 Outlook 2007 with DAV-Synchronizer, where sync works:

    https://www.dropbox.com/s/5ws1sbdjprdulzr/CalDAV-Synchronizer.txt?dl=0

    and now the log of PC2-sync, where the added contact becomes deleted after sync:

    https://www.dropbox.com/s/6fxrf83b478d6vl/CARDDAV-emClient_deletes_Vcards .txt?dl=0

    I found an older thread in emClient-forum, where a similar problem appeared caused by bugs in horde (not on my UCS-server) and sabre:
    https://forum.emclient.com/emclient/topics/carddav_server_contacts_not_showing_in_em_but_when_we_create_contact_on_em_it_is_getting_synced_on_carddav

    I will be very appreciated, if you can help me.





  • Additional Info:
    Contacts with phone numbers only, but without e-mail addresses become synchronized and stored and synchronized with KDav in the contacts folder.
    Just if any email address was typed in, the contact becomes deleted just after sync-attempt.

    If you do any changes in a contact, the changes become rejected (after sync the old state is back again).

    Deleting contacts works.


  • Kopano

    Hi Mornsgrans,

    the emClient uses two different uids when creating a contact:

    11.05.2019 12:47:34 [ 3199] [DEBUG] main PUT /addressbooks/vw/Kontakte/fce26428-fc67-49bf-929b-bc2a4f156af9.vcf
    

    but in the vcard data:

    BEGIN:VCARD
    VERSION:4.0
    PRODID:-//MailClient.VObject/7.2.35128.0
    UID:urn:uuid:e70bbd69-7c81-4be3-8cb8-7bca4a5356fe
    N;SORT-AS="Test, Otto":Test;Otto;;;
    FN:Otto Test
    EMAIL;PREF=1:otto@test.net
    END:VCARD
    

    KDAV uses the one in vcard data (e70bbd69-7c81-4be3-8cb8-7bca4a5356fe) to create a contact, but emClient uses the one from the PUT request (fce26428-fc67-49bf-929b-bc2a4f156af9). I guess that the contact gets deleted because KDAV response is 404 (not found). However the contact should still be in Kopano.

    Manfred



  • Hello Manfred,
    thank you for your reply. Unfortunatelly the contact does not remain in Kopano. But I think, that I now can contact emClient-Support using the hint in your answer.

    Thank you very much.



  • Yesterday in the evening I got answer from emClient-support:


    We have come to the conclusion that the issue is server-side announcing support for vCard 3 and vCard 4 versions (vcardVersion.PNG), but only supporting 3 or not fully supporting v4. We at eM Client try to use the latest possible version the server announced it supports and that seems to be the issue.

    We suggest you either get in touch with Kopano support with this detailed screenshots/information or provide us a direct contact in Kopano to whom we could explain and/or test more. We would also welcome some kind of feedback on the Kopano forum as the analysis done by their team is incorrect, as explained and demonstrated earlier.

    So my question is:
    How can the emClient-support-team contact you?

    P.S.: Changing calendar-entries also sometimes leads to an error.



  • Well, now I have the permission to post the full answer from emClient-support.

    In addition emclient suppert will be very appreciated, if the Kopano team gets in contact with emClient-team to exchange informations to get emClient to sync with Kopano. The Kopano tam can use the case number- but I do not want to publish it in the internet.

    Thank you for the test account. We have tried to simulate the same UID and URL, but as we were afraid of, this did not solve the issue.

    We have come to the conclusion that the issue is server-side announcing support for vCard 3 and vCard 4 versions (vcardVersion.PNG), but only supporting 3 or not fully supporting v4. We at eM Client try to use the latest possible version the server announced it supports and that seems to be the issue.

    Let us explain in more details but please note that if the explanation is too technical, Kopano should be able to fully understand it or if you can provide direct contact at Kopano, we can get in touch with them.

    1, Confirmation that UID and URL can be different:
    We have created very simple basic contact information containing a single word name “TestName” - no space nor any other information. This contact is correctly uploaded to Kopano and stays in server. Please see the screenshot from eM Client,
    raw communication log (TestNameUpload.PNG) and confirmation that the URL is correctly found in SabreDAV/Kopano (SabreDavConfirmation.PNG).

    Creating contact with full name and surname, i.e. “Test Name” will fail here

    2, Creating complex name with same UID and URL
    Like the above case, we have forced eM Client to keep the fields same. This does not help as contact is not created (sameUidURLNotCreated.PNG).

    3, Manually creating a contact in v3 format
    It can be seen from screenshot v3DiffUidURLSaved.PNG that this is correctly processed by Kopano and saved. The URL and UID are different, the version is v3 and name/surname/phone and email are filled in.

    Unfortunately, the vCard version v3 and v4 are not fully backward compatible and there is no configuration option to manually switch the version in eM Client as we fully trust the information server sends us. We try to use the latest supported format to be able to provide our users as much functionality as possible.

    We suggest you either get in touch with Kopano support with this detailed screenshots/information or provide us a direct contact in Kopano to whom we could explain and/or test more. We would also welcome some kind of feedback on the Kopano forum as the analysis done by their team is incorrect, as explained and demonstrated earlier.

    With regards

    Attached I received 5 screenshots:
    vcardVersion.PNG
    vcardVersion.PNG
    v3DiffUidURLSaved.PNG
    v3DiffUidURLSaved.PNG
    TestNameUpload.PNG
    TestNameUpload.PNG
    sameUidURLNotCreated.PNG
    sameUidURLNotCreated.PNG
    SabreDavConfirmation.PNG
    SabreDavConfirmation.PNG


  • Kopano

    Hi Mornsgrans,

    we’ll investigate why it works with vCard version 3., but not with version 4.

    Regarding the vCard 3 and vCard 4 - it’s coming from sabredav which KDAV uses. The current quick workaround this issue would be to edit /usr/share/kdav/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php around line 39, so that it looks like this:

            if (is_null($supportedData)) {
                $supportedData = [
                    ['contentType' => 'text/vcard', 'version' => '3.0'],
                    //['contentType' => 'text/vcard', 'version' => '4.0'],
                    //['contentType' => 'application/vcard+json', 'version' => '4.0'],
                ];
            }
    

    This will force using vCard version 3.

    Manfred



  • Hello Manfred,
    thank you for your answer. I changed the file as you recommended and now it nearly works properly.
    If I want to delete a calendar-entry, I get the message, that it could not be deleted (Precondition failed).
    Creating, modifying and deleting Contacts works.

    If you are interested to exchange with emClient, I can give you needed information to contact them.



  • A few more tests:
    Creating a task or calendar-entry leads to a duplication of each entry after sync.
    If I delete one entry, the other remains in Kopano and needs to be removed manually. This leads to an error that it could not be found on server and I get the offer, to delete locally.
    Attached the logfile in my dropbox (115KB) from creation to deletion.
    https://www.dropbox.com/s/jmp3ja5bc5e2ktj/kdav.log.txt?dl=0

    Next issue:
    The German “Umlauts” are transformed into a wrong charset after creating or modifying in emClient or Outlook 2007 with CalDAVSynchronizer.
    “Rüdiger” becomes transformed to “Rüdiger”, if data are manipulated in Windows client (except Kopano Webapp).
    After correcting the Umlauts in Kopano Webapp the become displayed corretly on mobile device, Kopano and emClient/Outlook.
    It seems, that Umlauts become transformed on upload to UCS via Kdav, but they become trasferred in the right way from UCS to clients.



  • @Fux said in Request for Feedback: New CalDAV and CardDAV implementation for Kopano:

    When I try to access contacts via kdav I get the following error at a few contacts - the others work:

    <?xml version="1.0" encoding="utf-8"?>
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
      <s:sabredav-version>3.2.2</s:sabredav-version>
      <s:exception>Sabre\VObject\ParseException</s:exception>
      <s:message>Invalid Mimedir file. Line starting at 19 did not follow iCalendar/vCard conventions</s:message>
    </d:error>
    
    22.02.2019 14:50:13 [29577] [DEBUG] main httpcode='500' memory='1.25 MiB/2.00 MiB' time='0.06s'
    22.02.2019 14:50:13 [29577] [DEBUG] main ------------------ End
    

    Does anyone know where to search for a solution?

    I have this issue. Has anyone submitted example contacts to demonstrate the problem? It currently means I can’t sync with Apple Contacts. The line where the problem is seems to be the UID line.


  • Kopano

    @amaccuish said in Request for Feedback: New CalDAV and CardDAV implementation for Kopano:

    Has anyone submitted example contacts to demonstrate the problem?

    I have not received any.



  • @fbartels I have just sent an email now!



  • Hi all
    im stuck by a depreaching warning…using Ubuntu 18.04.3

    i do the following:

    Install sabre-dav:

    sudo apt-get install php-sabre-dav
    

    create working kdav folder:

    mkdir /var/www/kdav
    cd /var/www/kdav
    
    wget https://github.com/Kopano-dev/kdav/archive/v0.9.0.tar.gz
    tar xfvz v0.9.0.tar.gz
    mv kdav-0.9.0/* /var/www/kdav
    rm -r kdav-0.9.0
    rm v0.9.0.tar.gz
    
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
    

    setup the config php:

    define('MAPI_SERVER', 'file:///var/run/kopano/server.sock');
    
    // Authentication realm
    define('SABRE_AUTH_REALM', 'Kopano DAV');
    
    // Location of the SabreDAV server.
    define('DAV_ROOT_URI', '/var/www/kdav/');
    

    set rights:

    chown -R root:www-data /var/www/kdav
    chmod 664 /var/www/kdav/config.php
    

    Composer Install:

    noise:/var/www/kdav$ sudo ./composer.phar install
    [sudo] password for noise: 
    Deprecation warning: Your package name KopanoDAV is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.0 will error.
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 34 installs, 0 updates, 0 removals
      - Installing apache/log4php (2.3.0): Downloading (100%)         
      - Installing psr/log (1.1.0): Downloading (100%)         
      - Installing sabre/uri (1.2.1): Downloading (100%)         
      - Installing sabre/event (3.0.0): Downloading (100%)         
      - Installing sabre/http (v4.2.4): Downloading (100%)         
      - Installing sabre/xml (1.5.1): Downloading (100%)         
      - Installing sabre/vobject (4.2.0): Downloading (100%)         
      - Installing sabre/dav (3.2.3): Downloading (100%)         
      - Installing myclabs/deep-copy (1.9.3): Downloading (100%)         
      - Installing sebastian/version (2.0.1): Downloading (100%)         
      - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
      - Installing sebastian/recursion-context (2.0.0): Downloading (100%)         
      - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)         
      - Installing sebastian/global-state (1.1.1): Downloading (100%)         
      - Installing sebastian/exporter (2.0.0): Downloading (100%)         
      - Installing sebastian/environment (2.0.0): Downloading (100%)         
      - Installing sebastian/diff (1.4.3): Downloading (100%)         
      - Installing sebastian/comparator (1.2.4): Downloading (100%)         
      - Installing symfony/polyfill-ctype (v1.12.0): Downloading (100%)         
      - Installing symfony/yaml (v4.3.4): Downloading (100%)         
      - Installing doctrine/instantiator (1.2.0): Downloading (100%)         
      - Installing webmozart/assert (1.5.0): Downloading (100%)         
      - Installing phpdocumentor/reflection-common (2.0.0): Downloading (100%)         
      - Installing phpdocumentor/type-resolver (1.0.1): Downloading (100%)         
      - Installing phpdocumentor/reflection-docblock (4.3.2): Downloading (100%)         
      - Installing phpspec/prophecy (1.8.1): Downloading (100%)         
      - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
      - Installing phpunit/phpunit-mock-objects (3.4.4): Downloading (100%)         
      - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
      - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
      - Installing phpunit/php-token-stream (2.0.2): Downloading (100%)         
      - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)         
      - Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)         
      - Installing phpunit/phpunit (5.7.27): Downloading (100%)         
    sabre/vobject suggests installing hoa/bench (If you would like to run the benchmark scripts)
    sebastian/global-state suggests installing ext-uopz (*)
    symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command)
    phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
    phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
    phpunit/phpunit suggests installing ext-xdebug (*)
    Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
    Writing lock file
    Generating autoload files
    
    /var/www/kdav# php composer.phar
    Deprecation warning: Your package name KopanoDAV is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.0 will error.
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
       ______
      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                        /_/
    Composer version 1.9.0 2019-08-02 20:55:32
    
    ./phpunit tests
    PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
    
    .EEEEE                                                              6 / 6 (100%)
    
    Time: 112 ms, Memory: 6.00MB
    
    There were 5 errors:
    
    1) Kopano\DAV\KopanoDavBackendTest::testConstruct
    PDOException: SQLSTATE[HY000] [14] unable to open database file
    
    /var/www/kdav/lib/KopanoSyncState.php:45
    /var/www/kdav/lib/KopanoDavBackend.php:48
    /var/www/kdav/tests/kdav/KopanoDavBackendTest.php:44
    
    2) Kopano\DAV\KopanoDavBackendTest::testGetObjectIdFromObjectUri with data set #0 ('1234.ics', '.ics', '1234')
    PDOException: SQLSTATE[HY000] [14] unable to open database file
    
    /var/www/kdav/lib/KopanoSyncState.php:45
    /var/www/kdav/lib/KopanoDavBackend.php:48
    /var/www/kdav/tests/kdav/KopanoDavBackendTest.php:44
    
    3) Kopano\DAV\KopanoDavBackendTest::testGetObjectIdFromObjectUri with data set #1 ('5678AF.vcf', '.vcf', '5678AF')
    PDOException: SQLSTATE[HY000] [14] unable to open database file
    
    /var/www/kdav/lib/KopanoSyncState.php:45
    /var/www/kdav/lib/KopanoDavBackend.php:48
    /var/www/kdav/tests/kdav/KopanoDavBackendTest.php:44
    
    4) Kopano\DAV\KopanoDavBackendTest::testGetObjectIdFromObjectUri with data set #2 ('123400.vcf', '.ics', '123400.vcf')
    PDOException: SQLSTATE[HY000] [14] unable to open database file
    
    /var/www/kdav/lib/KopanoSyncState.php:45
    /var/www/kdav/lib/KopanoDavBackend.php:48
    /var/www/kdav/tests/kdav/KopanoDavBackendTest.php:44
    
    5) Kopano\DAV\KopanoDavBackendTest::testGetObjectIdFromObjectUri with data set #3 ('1234.ics', '.vcf', '1234.ics')
    PDOException: SQLSTATE[HY000] [14] unable to open database file
    
    /var/www/kdav/lib/KopanoSyncState.php:45
    /var/www/kdav/lib/KopanoDavBackend.php:48
    /var/www/kdav/tests/kdav/KopanoDavBackendTest.php:44
    
    ERRORS!
    Tests: 6, Assertions: 1, Errors: 5.
    

    The other thing are the nginx directive (not shure if this are correct and can be working)
    i want to implement it to the z-push directive like: https://smtp.domain.com/kdav

    i have a few uncommented… but can’t test because composer not running.

    Edit: found a simpler install:

    curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
    mkdir /var/www/kdav
    cd /var/www/kdav
    composer require sabre/dav ~3.2.0
    
    nano /etc/nginx/sites-available/z-push.conf
    
    location /kdav {
        root /var/www;
        index server.php;
    #    rewrite ^(.*)$ /server.php;
    #    rewrite ^ /kdav/server.php$uri;
    #    rewrite ^/.well-known/caldav /cal.php redirect;
    #    rewrite ^/.well-known/carddav /card.php redirect;
    #    rewrite ^/server.php$uri break;
    #    rewrite .*/server.php$uri break;
    #    rewrite .*/.well-known/carddav$ / redirect;
    #    rewrite .*/.well-known/caldav$ / redirect;
    #    rewrite ^/.well-known/carddav$ / redirect;
    #    rewrite ^/.well-known/caldav$ / redirect;
    #    rewrite ^(.*)$ /server.php break;
        charset utf-8;
    
    location ~ ^/kdav/(.+\.php)(.*)$ {
        root /var/www/kdav;
        index server.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_index server.php;
        include fastcgi_params;
        }
    }
    }
    
    wget https://github.com/Kopano-dev/kdav/archive/v0.9.0.tar.gz
    tar xfvz v0.9.0.tar.gz
    mv kdav-0.9.0/* /var/www/kdav
    rm -r kdav-0.9.0
    rm v0.9.0.tar.gz
    

    edit config.php

    composer install 
    

    but run in the same:

    Deprecation warning: Your package name KopanoDAV is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.0 will error.
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
    Nothing to install or update
    Generating autoload files
    

    any hints are welcome ;-) thx



  • @noise
    I think you might have a few things backwards here. First of all the depreciation warning itself is harmless, as it is a warning, not an error. So whilst it would be nice for a developer at Kopano to look at this, it won’t stop kdav from working.

    A few other observations:

    • You are running composer install as root, which, as the console output tells you, you shouldn’t be doing. Instead, change to your webserver user and run composer with that.
    su nginx -s /bin/bash
    cd /var/www/kdav
    ./composer update
    ./composer install
    

    I am adding the composer update command because of the output you see in the terminal. I personally have never used that.

    • The php dav extension you are installing in the beginning is unnecessary as composer downloads all dependencies to the kdav folder. You can hence skip that.

    I myself am still struggling to get kdav working (again), so I’ll post back in case I succeed.


Log in to reply