Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(imap): Ignore non existent mailboxes / no select for MYRIGHTS #8563

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Jun 16, 2023

Fixes #8534

Regression of #8449. The code

try {
$client->status($mailbox["mailbox"]);
} catch (Horde_Imap_Client_Exception $e) {
// ignore folders which cause errors on access
// (i.e. server-side system I/O errors)
if (in_array($e->getCode(), [
Horde_Imap_Client_Exception::UNSPECIFIED,
], true)) {
return null;
}
}
was dropped, which previously caught access to invalid mailboxes and silently ignored the mailbox.

Mailbox synchronization fails if a nonexistent mailbox is access during the MYRIGHTS command, if the server supports ACLs.

C: 4 LIST () "" (*) RETURN (SUBSCRIBED SPECIAL-USE)
S: * LIST (\Subscribed \Archive) "/" Archives
S: * LIST (\Subscribed \Drafts) "/" Drafts
S: * LIST (\Subscribed \Sent) "/" Sent
S: * LIST (\Subscribed \Trash) "/" Trash
S: * LIST (\NonExistent) "/" shared
S: * LIST (\Subscribed) "/" shared/[email protected]
S: * LIST (\Subscribed) "/" INBOX

but then

C: 11 MYRIGHTS shared
>> ERROR: read/timeout error.
>> ERROR: Server closed the connection.

@ChristophWurst
Copy link
Member Author

This patch can be tested with the bitgrid test accounts

image

@ChristophWurst
Copy link
Member Author

/backport to stable2.2

@ChristophWurst
Copy link
Member Author

/backport to stable3.2

@kesselb
Copy link
Contributor

kesselb commented Jun 19, 2023

Do we need the same logic for \NoSelect?
Found a bug report for Thunderbird https://bugzilla.mozilla.org/show_bug.cgi?id=222394

@ChristophWurst
Copy link
Member Author

That probably makes sense. Let me add that too.

@ChristophWurst ChristophWurst changed the title fix(imap): Ignore non existent mailboxes (again) fix(imap): Ignore non existent mailboxes / no select for MYRIGHTS Jun 19, 2023
Copy link
Contributor

@hamza221 hamza221 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested creating new mailbox doesn't work on main and works with these fixes

Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't able to reproduce the initial problem but the code looks good.

@ChristophWurst ChristophWurst force-pushed the fix/imap/ignore-non-existent-mailboxes branch from 46f1e84 to 426d51f Compare June 26, 2023 16:23
@ChristophWurst ChristophWurst merged commit 7f573fc into main Jun 28, 2023
14 checks passed
@ChristophWurst ChristophWurst deleted the fix/imap/ignore-non-existent-mailboxes branch June 28, 2023 07:12
@backportbot-nextcloud
Copy link

The backport to stable2.2 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable2.2
git pull origin stable2.2

# Create the new backport branch
git checkout -b fix/foo-stable2.2

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable2.2

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants