owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.39k stars 2.05k forks source link

Adding CardDAV addressbooks to CardDAV clients broken in 5.0.6 #3404

Closed blind-coder closed 11 years ago

blind-coder commented 11 years ago

Expected behaviour

Adding CardDAV addressbooks either via https://fqdn/ or https://fqdn/.well-known/carddav or http://fqdn/remote.php/carddav fails.

Actual behaviour

This may be because a PROPFIND on that URL returns a HTML login page instead of XML information. This confuses some clients.

Steps to reproduce

  1. Try to add an addressbook to roundcube.
  2. Breakage.
  3. Downgrade to 5.0.5
  4. Works.

    Logs

    Logfile with 5.0.6, returning an HTML site on successful PROPFIND on /remote.php/carddav/

[03:58:56][blindcoder@flora:~]$ cat carddav_5.0.6
[17-May-2013 15:00:00 +0200]: DISCOVERY: (retrieve_addressbooks) SEARCHING https://oc.anderdonau.de:443/remote.php/carddav/
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) retrieve_addressbooks requesting https://oc.anderdonau.de:443/remote.php/carddav/ [RL 5]
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) SendRequest: http_class::__set_state(array(
   'host_name' => 'oc.anderdonau.de',
   'host_port' => 443,
   'proxy_host_name' => '',
   'proxy_host_port' => 80,
   'socks_host_name' => '',
   'socks_host_port' => 1080,
   'socks_version' => '5',
   'protocol' => 'https',
   'request_method' => 'PROPFIND',
   'user_agent' => 'RCM CardDAV plugin/TRUNK',
   'accept' => '',
   'authentication_mechanism' => '',
   'user' => NULL,
   'password' => NULL,
   'realm' => NULL,
   'workstation' => NULL,
   'proxy_authentication_mechanism' => '',
   'proxy_user' => NULL,
   'proxy_password' => NULL,
   'proxy_realm' => NULL,
   'proxy_workstation' => NULL,
   'request_uri' => '/remote.php/carddav/',
   'request' => 'PROPFIND /remote.php/carddav/ HTTP/1.1',
   'request_headers' => 
  array (
    'Host' => 'oc.anderdonau.de:443',
    'User-Agent' => 'RCM CardDAV plugin/TRUNK',
    'Depth' => '1',
    'Content-Type' => 'application/xml; charset="utf-8"',
    'Connection' => 'Keep-Alive',
    'Content-Length' => 241,
  ),
   'request_user' => 'b***r@s***r.h***p.n***t',
   'request_password' => '***',
   'request_realm' => NULL,
   'request_workstation' => NULL,
   'proxy_request_user' => NULL,
   'proxy_request_password' => NULL,
   'proxy_request_realm' => NULL,
   'proxy_request_workstation' => NULL,
   'request_body' => '<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop>
    <D:current-user-principal/>
    <D:resourcetype />
    <D:displayname />
    <C:addressbook-home-set/>
</D:prop></D:propfind>
',
   'request_arguments' => 
  array (
    'Protocol' => 'https',
    'HostName' => 'oc.anderdonau.de',
    'Headers' => 
    array (
      'Host' => 'oc.anderdonau.de:443',
      'User-Agent' => 'RCM CardDAV plugin/TRUNK',
      'Depth' => '1',
      'Content-Type' => 'application/xml; charset="utf-8"',
      'Connection' => 'Keep-Alive',
    ),
    'AuthUser' => 'b***r@s***r.h***p.n***t',
    'AuthPassword' => '***',
    'HostPort' => 443,
    'RequestURI' => '/remote.php/carddav/',
    'RequestMethod' => 'PROPFIND',
    'Body' => '<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop>
    <D:current-user-principal/>
    <D:resourcetype />
    <D:displayname />
    <C:addressbook-home-set/>
</D:prop></D:propfind>
',
  ),
   'protocol_version' => '1.1',
   'timeout' => 10,
   'data_timeout' => 0,
   'debug' => 0,
   'log_debug' => 0,
   'debug_response_body' => 1,
   'html_debug' => 0,
   'support_cookies' => 1,
   'cookies' => 
  array (
  ),
   'error' => '',
   'error_code' => 0,
   'exclude_address' => '',
   'follow_redirect' => 0,
   'redirection_limit' => 5,
   'response_status' => '',
   'response_message' => '',
   'file_buffer_length' => 8000,
   'force_multipart_form_post' => 0,
   'prefer_curl' => 1,
   'keep_alive' => 1,
   'sasl_authenticate' => 1,
   'state' => 'RequestSent',
   'use_curl' => true,
   'connection' => NULL,
   'content_length' => 0,
   'response' => 'HTTP/1.1 401 Unauthorized
Date: Fri, 17 May 2013 13:57:21 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze15
Strict-Transport-Security: max-age=31536000
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
WWW-Authenticate: Basic realm="ownCloud"
Set-Cookie: 50d184c54cdc1=nvr1v4sio7kthre7e17nas8ud5; path=/; secure; HttpOnly
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre_DAV_Exception_NotAuthenticated</s:exception>
  <s:message>No basic authentication headers were found</s:message>
  <s:sabredav-version>1.7.6</s:sabredav-version>
</d:error>
',
   'read_response' => 0,
   'read_length' => 0,
   'request_host' => 'oc.anderdonau.de:443',
   'next_token' => '',
   'redirection_level' => 0,
   'chunked' => 0,
   'remaining_chunk' => 0,
   'last_chunk_read' => 0,
   'months' => 
  array (
    'Jan' => '01',
    'Feb' => '02',
    'Mar' => '03',
    'Apr' => '04',
    'May' => '05',
    'Jun' => '06',
    'Jul' => '07',
    'Aug' => '08',
    'Sep' => '09',
    'Oct' => '10',
    'Nov' => '11',
    'Dec' => '12',
  ),
   'session' => 'b488427d3606a7cb830fce4c18aaa3fb',
   'connection_close' => 0,
   'force_close' => 0,
   'connected_host' => 'oc.anderdonau.de',
   'connected_port' => 443,
   'connected_ssl' => 1,
))
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) success: array (
  'status' => '200',
  'headers' => 
  array (
    'http/1.1 200 ok' => '',
    'date' => 'Fri, 17 May 2013 13:57:21 GMT',
    'server' => 'Apache/2.2.16 (Debian)',
    'x-powered-by' => 'PHP/5.3.3-7+squeeze15',
    'strict-transport-security' => 'max-age=31536000',
    'expires' => 'Thu, 19 Nov 1981 08:52:00 GMT',
    'cache-control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
    'pragma' => 'no-cache',
    'x-xss-protection' => '1; mode=block',
    'x-content-type-options' => 'nosniff',
    'x-frame-options' => 'Sameorigin',
    'content-security-policy' => 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *; font-src \'self\' data:; media-src *',
    'set-cookie' => '50d184c54cdc1=f7sl4d8u7f9er2sni6qsf9c585; path=/; secure; HttpOnly',
    'vary' => 'Accept-Encoding',
    'transfer-encoding' => 'chunked',
    'content-type' => 'text/html; charset=utf-8',
  ),
  'body' => '<!DOCTYPE html>
<!--[if lt IE 7]><html class="ng-csp ie ie6 lte9 lte8 lte7"><![endif]-->
<!--[if IE 7]><html class="ng-csp ie ie7 lte9 lte8 lte7"><![endif]-->
<!--[if IE 8]><html class="ng-csp ie ie8 lte9 lte8"><![endif]-->
<!--[if IE 9]><html class="ng-csp ie ie9 lte9"><![endif]-->
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
    <head data-requesttoken="84f010760acb3ec5bbe6">
        <title>ownCloud</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="apple-itunes-app" content="app-id=543672169">
        <link rel="shortcut icon" href="/core/img/favicon.png" />
        <link rel="apple-touch-icon-precomposed" href="/core/img/favicon-touch.png" />
                    <link rel="stylesheet" href="/remote.php/core.css?v=389bc7bb1e1c2a5e7e147703232a88f6" type="text/css" media="screen" />
                            <script type="text/javascript" src="/index.php/core/js/config.js?v=389bc7bb1e1c2a5e7e147703232a88f6"></script>
                    <script type="text/javascript" src="/remote.php/core.js?v=389bc7bb1e1c2a5e7e147703232a88f6"></script>
                    <script type="text/javascript" src="/core/js/visitortimezone.js?v=389bc7bb1e1c2a5e7e147703232a88f6"></script>

            </head>

    <body id="body-login">
        <div id="login">
            <header><div id="header">
                <img src="/core/img/logo.svg" class="svg" alt="ownCloud" />
            </div></header>
            <!--[if IE 8]><style>input[type="checkbox"]{padding:0;}</style><![endif]-->
<form method="post">
    <fieldset>
            <ul>
                                </ul>
        <p class="infield grouptop">
            <input type="text" name="user" id="user" placeholder=""
                   value="" autofocus                  autocomplete="on" required/>
            <label for="user" class="infield">Username</label>
            <img class="svg" src="/core/img/actions/user.svg" alt=""/>
        </p>

        <p class="infield groupbottom">
            <input type="password" name="password" id="password" value="" data-typetoggle="#show" placeholder=""
                   required />
            <label for="password" class="infield">Password</label>
            <img class="svg" id="password-icon" src="/core/img/actions/password.svg" alt=""/>
            <input type="checkbox" id="show" name="show" />
            <label for="show"></label>
        </p>
        <input type="checkbox" name="remember_login" value="1" id="remember_login"/><label
            for="remember_login">remember</label>
        <input type="hidden" name="timezone-offset" id="timezone-offset"/>
        <input type="submit" id="submit" class="login primary" value="Log in"/>
    </fieldset>
</form>

        </div>
        <footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash;
            web services under your control</p></footer>
    </body>
</html>
',
)

Logfile with 5.0.5, returning expected XML on successful PROPFIND

cat ca[04:00:21][blindcoder@flora:~]$ cat carddav_5.0.5 
[17-May-2013 15:00:00 +0200]: DISCOVERY: (retrieve_addressbooks) SEARCHING https://oc.anderdonau.de:443/remote.php/carddav/
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) retrieve_addressbooks requesting https://oc.anderdonau.de:443/remote.php/carddav/ [RL 5]
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) SendRequest: http_class::__set_state(array(
   'host_name' => 'oc.anderdonau.de',
   'host_port' => 443,
   'proxy_host_name' => '',
   'proxy_host_port' => 80,
   'socks_host_name' => '',
   'socks_host_port' => 1080,
   'socks_version' => '5',
   'protocol' => 'https',
   'request_method' => 'PROPFIND',
   'user_agent' => 'RCM CardDAV plugin/TRUNK',
   'accept' => '',
   'authentication_mechanism' => '',
   'user' => NULL,
   'password' => NULL,
   'realm' => NULL,
   'workstation' => NULL,
   'proxy_authentication_mechanism' => '',
   'proxy_user' => NULL,
   'proxy_password' => NULL,
   'proxy_realm' => NULL,
   'proxy_workstation' => NULL,
   'request_uri' => '/remote.php/carddav/',
   'request' => 'PROPFIND /remote.php/carddav/ HTTP/1.1',
   'request_headers' => 
  array (
    'Host' => 'oc.anderdonau.de:443',
    'User-Agent' => 'RCM CardDAV plugin/TRUNK',
    'Depth' => '1',
    'Content-Type' => 'application/xml; charset="utf-8"',
    'Connection' => 'Keep-Alive',
    'Content-Length' => 241,
  ),
   'request_user' => 'b***r@s***r.h***p.n***t',
   'request_password' => '***',
   'request_realm' => NULL,
   'request_workstation' => NULL,
   'proxy_request_user' => NULL,
   'proxy_request_password' => NULL,
   'proxy_request_realm' => NULL,
   'proxy_request_workstation' => NULL,
   'request_body' => '<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop>
    <D:current-user-principal/>
    <D:resourcetype />
    <D:displayname />
    <C:addressbook-home-set/>
</D:prop></D:propfind>
',
   'request_arguments' => 
  array (
    'Protocol' => 'https',
    'HostName' => 'oc.anderdonau.de',
    'Headers' => 
    array (
      'Host' => 'oc.anderdonau.de:443',
      'User-Agent' => 'RCM CardDAV plugin/TRUNK',
      'Depth' => '1',
      'Content-Type' => 'application/xml; charset="utf-8"',
      'Connection' => 'Keep-Alive',
    ),
    'AuthUser' => 'b***r@s***r.h***p.n***t',
    'AuthPassword' => '***',
    'HostPort' => 443,
    'RequestURI' => '/remote.php/carddav/',
    'RequestMethod' => 'PROPFIND',
    'Body' => '<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop>
    <D:current-user-principal/>
    <D:resourcetype />
    <D:displayname />
    <C:addressbook-home-set/>
</D:prop></D:propfind>
',
  ),
   'protocol_version' => '1.1',
   'timeout' => 10,
   'data_timeout' => 0,
   'debug' => 0,
   'log_debug' => 0,
   'debug_response_body' => 1,
   'html_debug' => 0,
   'support_cookies' => 1,
   'cookies' => 
  array (
  ),
   'error' => '',
   'error_code' => 0,
   'exclude_address' => '',
   'follow_redirect' => 0,
   'redirection_limit' => 5,
   'response_status' => '',
   'response_message' => '',
   'file_buffer_length' => 8000,
   'force_multipart_form_post' => 0,
   'prefer_curl' => 1,
   'keep_alive' => 1,
   'sasl_authenticate' => 1,
   'state' => 'RequestSent',
   'use_curl' => true,
   'connection' => NULL,
   'content_length' => 0,
   'response' => 'HTTP/1.1 401 Unauthorized
Date: Fri, 17 May 2013 13:52:44 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze15
Strict-Transport-Security: max-age=31536000
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
WWW-Authenticate: Basic realm="ownCloud"
Set-Cookie: 50d184c54cdc1=njc5nfm4unnbnf24jfloobs5v4; path=/; secure; HttpOnly
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre_DAV_Exception_NotAuthenticated</s:exception>
  <s:message>No basic authentication headers were found</s:message>
  <s:sabredav-version>1.7.6</s:sabredav-version>
</d:error>
',
   'read_response' => 0,
   'read_length' => 0,
   'request_host' => 'oc.anderdonau.de:443',
   'next_token' => '',
   'redirection_level' => 0,
   'chunked' => 0,
   'remaining_chunk' => 0,
   'last_chunk_read' => 0,
   'months' => 
  array (
    'Jan' => '01',
    'Feb' => '02',
    'Mar' => '03',
    'Apr' => '04',
    'May' => '05',
    'Jun' => '06',
    'Jul' => '07',
    'Aug' => '08',
    'Sep' => '09',
    'Oct' => '10',
    'Nov' => '11',
    'Dec' => '12',
  ),
   'session' => 'd49cec30c791a3fc86129f3300ded615',
   'connection_close' => 0,
   'force_close' => 0,
   'connected_host' => 'oc.anderdonau.de',
   'connected_port' => 443,
   'connected_ssl' => 1,
))
[17-May-2013 15:00:00 +0200]: DISCOVERY: (cdfopen) success: array (
  'status' => '207',
  'headers' => 
  array (
    'http/1.1 207 multi-status' => '',
    'date' => 'Fri, 17 May 2013 13:52:44 GMT',
    'server' => 'Apache/2.2.16 (Debian)',
    'x-powered-by' => 'PHP/5.3.3-7+squeeze15',
    'strict-transport-security' => 'max-age=31536000',
    'expires' => 'Thu, 19 Nov 1981 08:52:00 GMT',
    'cache-control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
    'pragma' => 'no-cache',
    'vary' => 'Brief,Prefer',
    'dav' => '1, 3, extended-mkcol, addressbook, access-control, calendarserver-principal-property-search',
    'set-cookie' => '50d184c54cdc1=shkfrnkj9elc177t7j9rtjns80; path=/; secure; HttpOnly',
    'keep-alive' => 'timeout=15, max=100',
    'connection' => 'Keep-Alive',
    'transfer-encoding' => 'chunked',
    'content-type' => 'application/xml; charset=utf-8',
  ),
  'body' => '<?xml version="1.0" encoding="utf-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d:href>/remote.php/carddav/</d:href><d:propstat><d:prop><d:current-user-principal><d:href>/remote.php/carddav/principals/b***r@s***r.h***p.n***t/</d:href></d:current-user-principal><d:resourcetype><d:collection/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:displayname/><card:addressbook-home-set/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/carddav/principals/</d:href><d:propstat><d:prop><d:current-user-principal><d:href>/remote.php/carddav/principals/b***r@s***r.h***p.n***t/</d:href></d:current-user-principal><d:resourcetype><d:collection/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:displayname/><card:addressbook-home-set/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/carddav/addressbooks/</d:href><d:propstat><d:prop><d:current-user-principal><d:href>/remote.php/carddav/principals/b***r@s***r.h***p.n***t/</d:href></d:current-user-principal><d:resourcetype><d:collection/></d:resourcetype></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:displayname/><card:addressbook-home-set/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
',
)
georgehrke commented 11 years ago

please reopen in contacts repo