Skip to content

Wait for IMAP greeting before CAPABILITY - #11

Open
ichengzi wants to merge 1 commit into
situker:mainfrom
ichengzi:fix/wait-imap-greeting
Open

ichengzi wants to merge 1 commit into
situker:mainfrom
ichengzi:fix/wait-imap-greeting

Conversation

@ichengzi

Copy link
Copy Markdown

Bug

qqmail-cli auth login can fail before the authorization code is checked. The CLI prints only:

未预期的内部错误
诊断(--verbose):unexpected EOF

The account is not saved. A wrong authorization code is a different failure: that path returns 认证失败 or 等待 IMAP 登录响应超时, and --verbose includes that prefix. This bug is the bare unexpected EOF.

Cause

dialWithVersion calls Capability() immediately after imapclient.New. The client writes CAPABILITY before it has read the server greeting, so the command is pipelined ahead of the greeting.

QQ Mail accepts the TCP/TLS connection and sends the greeting, then ignores that early command. No tagged CAPABILITY response arrives. The command watchdog later closes the socket. Capability().Wait() returns a raw unexpected EOF. errmap.Classify does not recognize that string, so the user-facing result is the generic internal error.

A direct session that waits for the greeting first receives the CAPABILITY completion, and a rejected LOGIN comes back as a normal tagged NO, within a few hundred milliseconds.

Fix

Wait for the greeting before the first CAPABILITY. If the greeting itself fails, return a network error instead of an unclassified internal error.

Made with Cursor

QQ Mail ignores a command sent before the greeting is read. The
following CAPABILITY never completes, and the socket close is reported
as unexpected EOF during login.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant