Repository navigation
COR-273 - Report a refusal over the IMAP session limit as its own error - #120
Merged
Merged
Conversation
…R-273 Yahoo and AOL refuse a login over their limit of simultaneous sessions with `* BYE` and then `NO [LIMIT]`. libetpan stops at the BYE with a stream error, so the refusal came out as ErrorConnection and the client retried at once, against the same limit. The tagged refusal is still in the stream buffer; the login now reports it as ErrorIMAPTooManySimultaneousConnections, the counterpart of Gmail's ErrorGmailTooManySimultaneousConnections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0c35c53. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Yahoo and AOL cap the simultaneous sessions per mailbox (5 and 8, measured) and refuse one more login with an untagged
* BYEfollowed by the tagged refusal —N NO [LIMIT] AUTHENTICATE Rate limit hit.for XOAUTH2,N NO [LIMIT] LOGIN Rate limit hit.for a password. libetpan stops at the BYE withMAILIMAP_ERROR_STREAM, so the login reportedErrorConnection, and the client retried at once — one more login against the same limit.imap_stream_bufferafter the BYE. On a stream error the login looks there forNO [LIMIT](the RFC 5530 code, not the text after it, which echoes the login command) and reports the newErrorIMAPTooManySimultaneousConnections, the counterpart of Gmail'sErrorGmailTooManySimultaneousConnections. Spark handles both the same way: it narrows the account's connections for a while instead of retrying.ErrorCanceledin the C++, C and Swift enums, so no existing value moves. LikeErrorCanceled, it has no ObjC constant and no localized description.ErrorConnection, Gmail's texts and wrong credentials keep their codes.The C++ changed, so the Windows prebuilt needs a rebuild for this revision before a tag.
Tests:
IMAPLoginTestsagainstLeaseTestTCPEndpoint, which can now answer a command with a refusal and close the socket.* BYE+NO [LIMIT]gives the new code (it gaveErrorConnectionbefore the fix); a bare BYE, Gmail's text and[AUTHENTICATIONFAILED]keep theirs. Checked in Spark against Yahoo and AOL with two devices on one account.🤖 Generated with Claude Code
Note
Medium Risk
Touches IMAP login error classification on stream failures; mis-detection could change client retry/backoff behavior, though scope is narrow (substring on buffered stream after BYE).
Overview
Adds
ErrorIMAPTooManySimultaneousConnections(C/C++/Swift) so Yahoo/AOL session-cap refusals are not reported as generic connection failures.When libetpan returns
MAILIMAP_ERROR_STREAMafter an untagged* BYE,IMAPSession::logininspectsimap_stream_bufferfor the taggedNO [LIMIT](RFC 5530) and returns the new code—parallel to Gmail’sErrorGmailTooManySimultaneousConnections. A bare BYE, Gmail “too many connections” text, andAUTHENTICATIONFAILEDbehavior is unchanged.LeaseTestTCPEndpointgains configurable refusals (custom reply + optional socket close).IMAPLoginTestscover* BYE+[LIMIT], Gmail text, auth failure, and BYE-only cases for LOGIN and XOAUTH2.Reviewed by Cursor Bugbot for commit 0c35c53. Bugbot is set up for automated code reviews on this repo. Configure here.