Cannot connect to Cyrus IMAP 2.5 - hangs on login
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 358
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 1
Description
I am using the general example to Dial and Login to the IMAP server. I can DialTLS but I am failing to Login.
Code:
```
c, err := imapclient.DialTLS(imapServer, options)
if err != nil {
log.Fatalf("failed to dial IMAP server: %v", err)
}
defer c.Close()
if err := c.Login(userName, password).Wait(); err != nil {
log.Fatalf("failed to login: %v", err)
}
```
It hangs on the Wait(). If the Wait() is not specified, it passes through with: `failed to login: &{T1 0xc000079260 }`
I used the `options := &imapclient.Options{ DebugWriter: os.Stdout, }` which prints out this:
```
T1 LOGIN "" ""
* OK [CAPABILITIES IMAP4rev1 LITERAL+ ID ENABLE AUTH=PLAIN AUTH=LOGIN SASL-IR] Cyrus IMAP 2.5.10-55-gb6dbffa-Kolab-2.5.10-6.1.el7.kolab_16 server ready
T2 CAPABILITY
* CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE ACL RIGHTS=kxten QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY CATENATE CONDSTORE ESEARCH SORT SORT=MODSEQ SORT=DISPLAY SORT=UID THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE ANNOTATE-EXPERIMENT-1 METADATA LIST-EXTENDED LIST-STATUS LIST-MYRIGHTS WITHIN QRESYNC SCAN XLIST XMOVE MOVE SPECIAL-USE CREATE-SPECIAL-USE URLAUTH URLAUTH=BINARY X-NETSCAPE AUTH=PLAIN AUTH=LOGIN SASL-IR X-QUOTA=STORAGE X-QUOTA=MESSAGE X-QUOTA=X-ANNOTATION-STORAGE X-QUOTA=X-NUM-FOLDERS IDLE
T2 OK Completed
```
And the code stalls and never finishes.
I tried other IMAP servers and was able to connect to it. I am using the Cyrus IMAP server with several email clients - desktop, mobile, webmail and everything works OK.
When I looked at the outputs, it looks like it may be because it is missing something like `OK LOGIN Completed` confirmation.
I have looked into the RFC 9051 and the LOGIN and it states:
```
6.2.3. LOGIN Command
Arguments:
user name
password
Responses:
no specific responses for this command
Result:
OK - login completed, now in authenticated state
NO - login failure: user name or password rejected
BAD - command unknown or arguments invalid
```
This makes me thinking that it is OK that the server does not respond to the LOGIN message (although, I would also rather see it does). But since it proceeds further with the CAPABILITY announcement it somewhat implies that the LOGIN went through OK.
Anyone came across this and is it a problem (unusual use case) with the imap package or is it a problem of the Cyrus IMAP server, or both?
Thanks in advance!
Contributor guide
Research direction
Start with the general example and trace the DialTLS, Login, and Wait calls using the DebugWriter output shown in the issue. Compare the Cyrus IMAP 2.5 transcript with the LOGIN requirements in RFC 9051 and determine whether the missing tagged response is handled by the Go package or violates the server protocol. Done means the compatibility problem and responsible component are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100