Skip to content

IMAP Authentication using TLS on port 993 is broken #163

@standardrat

Description

@standardrat

Steps to reproduce

  1. Setup an IMAP server using TLS on port 993
  2. Set up config.php with imap support with TLS
  'user_backends' => array(
    array(
        'class' => 'OC_User_IMAP',
        'arguments' => array(
            'imap.server.co', 993, 'tls', 'server.co', true, false
        ),
    ),
),
  1. Attempt to log in to nextcloud

Expected behaviour

Log in should complete successfully

Actual behaviour

Login is timing out.

Affected Authentication backend

IMAP using TLS

Server configuration

version 20.0.2
Fresh install

Logs

Nextcloud log (data/nextcloud.log)

Nextcloud log
`ERROR: Could not connect to imap server via curl: Operation timed out`

Found the problem and fix:

$protocol = ($this->sslmode === "ssl") ? "imaps" : "imap";

It only sets the protocol to imaps for ssl, not tls. Changing the line to the following fixes the issue:
$protocol = ($this->sslmode === "ssl" || $this->sslmode === "tls") ? "imaps" : "imap";

Seems loosely related to #140

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions