Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The mailbox selection reuse logic now matches RFC 9051’s case-sensitivity requirements (with correct INBOX exception) and the updated test explicitly verifies the intended behavioral change.
Pull request overview
This PR fixes IMAP connection reuse logic so libcurl only skips SELECT when the already-selected mailbox name matches exactly, except for the special INBOX mailbox which remains case-insensitive per RFC 9051. This prevents incorrect reuse when the requested mailbox differs only by case (e.g., Private vs private), which previously could result in operating on the wrong mailbox selection state.
Changes:
- Make selected-mailbox reuse comparison case-sensitive for non-
INBOXmailbox names inlib/imap.c. - Preserve case-insensitive handling specifically for
INBOX. - Update the IMAP reuse test to cover a case-change mailbox request and verify that two
SELECTcommands are sent.
File summaries
| File | Description |
|---|---|
| lib/imap.c | Updates the selected-mailbox equality check to be exact-match except for case-insensitive INBOX. |
| tests/data/test804 | Adjusts the reuse regression test to request Private then private and validates both SELECTs occur. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks! |
A recent patch introduced a test using an irregular IMAP folder, which isn't the test number, but a string, causing a Perl warning. Fixing warnings in runtests log when running test 804: ``` Argument "" isn't numeric in numeric gt (>) at /home/runner/work/curl/curl/tests/ftpserver.pl line 445. Argument "" isn't numeric in numeric gt (>) at /home/runner/work/curl/curl/tests/ftpserver.pl line 445. ``` Ref: https://github.com/curl/curl/actions/runs/36429133995/job/108950479015#step:50:1589 Follow-up to 12cfc83 #22868 Follow-up to 3a29ee4 Closes #23140
When an authenticated IMAP connection is reused, libcurl checks whether the requested mailbox is already selected. The previous comparison was case-insensitive for every mailbox, so a request for
privatecould reuse a connection withPrivateselected and skipSELECT.RFC 9051 section 5.1 requires non-INBOX mailbox names to be case-sensitive. This changes the selected-mailbox check to compare exact names, while retaining case-insensitive handling for the reserved
INBOXname.The existing IMAP reuse test now covers a case-changing mailbox request and verifies that both SELECT commands are sent.
Closes HackerOne report #3976342.
Validation:
cmake --build /home/bobbeh/koth/loot/curl-mail-round2-20260828/build-master-clean -j2passed.git diff --checkpassed.tests/server/serversandcurlinfo; no test pass is claimed for that runner.