Login with valid LDAP users throw ERROR: IMAP Login failed via curl: Login denied

Open Beginner friendly
#298 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
php

Research direction

Start in apps/user_external/lib/IMAP.php at checkPassword($uid, $password), focusing on the escaped-@ handling and how non-email LDAP usernames reach IMAP authentication. Reproduce the mixed user_external and LDAP setup described in the issue, then verify that valid LDAP users no longer produce an IMAP Login denied error.

Written by the indexing model from the issue text.

Description

0. Needs triage bug
Steps to reproduce

I use a mixed setup with user_external & imap and ldap. If a valid ldap user is successfully connecting, the user_external app is throwing the error: "ERROR: IMAP Login failed via curl: Login denied"

I fixed it by adding at apps/user_external/lib/IMAP.php in function checkPassword($uid, $password) after the "Replace escaped @ symbol" code block this:

        // if uid is not an email-adress, don't use this method
        if (strpos($uid, '@') === false) {
            return false;
        }
Affected Authentication backend

IMAP

Server configuration

User External App version: 4.0.0
Nextcloud version: 33.0.3

List of activated apps:

App list
[...]
  - user_ldap: 1.24.0
[...]

Nextcloud configuration:

Config report

I only use IMAP backend

        "user_backends": [
            {
                "class": "\\OCA\\UserExternal\\IMAP",
                "arguments": [
                    "***REMOVED SENSITIVE VALUE***",
                    993,
                    "ssl"
                ]
            }
        ],
Logs
Nextcloud log (data/nextcloud.log)
Nextcloud log
{"reqId":"afoZH4ZrxGscN10vjbAkrAAAhE0","level":3,"time":"2026-05-05T18:21:55+02:00","remoteAddr":"2003:e8:e740:7f01:cfeb:a58a:5879:7dfd","user":"<ldap-user>","app":"user_external","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","scriptName":"/ocs/v2.php","message":"ERROR: IMAP Login failed via curl: Login denied","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36","version":"33.0.3.2","data":{"app":"user_external"}}
Dominant language
JavaScript
Stars
120
Forks
73
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/user_external

All issues in nextcloud/user_external

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.