diff --git a/SOURCES/patch-cassandane-seen-unseen-flag b/SOURCES/patch-cassandane-seen-unseen-flag new file mode 100644 index 0000000..f378d18 --- /dev/null +++ b/SOURCES/patch-cassandane-seen-unseen-flag @@ -0,0 +1,78 @@ +diff --git a/Cassandane/Cyrus/Flags.pm b/Cassandane/Cyrus/Flags.pm +index a61d256..eedaf40 100644 +--- a/Cassandane/Cyrus/Flags.pm ++++ b/Cassandane/Cyrus/Flags.pm +@@ -239,6 +239,73 @@ sub test_seen_otheruser + $self->check_messages(\%msg); + } + ++# https://github.com/cyrusimap/cyrus-imapd/issues/3240 ++sub test_seen_sharedmb_nosharedseen ++ :UnixHierarchySep :AltNamespace ++{ ++ my ($self) = @_; ++ ++ my $folder = 'shared'; ++ ++ # shared mailbox with sharedseen=false ++ my $admintalk = $self->{adminstore}->get_client(); ++ $admintalk->create($folder); ++ $self->assert_str_equals('ok', $admintalk->get_last_completion_response()); ++ $admintalk->setacl('shared', 'cassandane' => 'lrswipkxtecdan'); ++ $self->assert_str_equals('ok', $admintalk->get_last_completion_response()); ++ $admintalk->setmetadata($folder, ++ '/shared/vendor/cmu/cyrus-imapd/sharedseen' => 'false' ++ ); ++ $self->assert_str_equals('ok', $admintalk->get_last_completion_response()); ++ ++ ++ # add some messages ++ my $talk = $self->{store}->get_client(); ++ $self->{store}->set_folder("Shared Folders/$folder"); ++ $self->{store}->_select(); ++ $self->assert_num_equals(1, $talk->uid()); ++ $self->{store}->set_fetch_attributes(qw(uid flags)); ++ ++ xlog $self, "Add two messages"; ++ my %msg; ++ $msg{A} = $self->make_message('Message A'); ++ $msg{A}->set_attributes(id => 1, ++ uid => 1, ++ flags => []); ++ $msg{B} = $self->make_message('Message B'); ++ $msg{B}->set_attributes(id => 2, ++ uid => 2, ++ flags => []); ++ $self->check_messages(\%msg); ++ ++ # fiddle with seen flag, making sure we get both the expected results ++ # and the expected untagged fetch response ++ xlog $self, "Set \\Seen on message A"; ++ my $res = $talk->store('1', '+flags', '(\\Seen)'); ++ $self->assert_deep_equals({ '1' => { 'flags' => [ '\\Seen' ] }}, $res); ++ $msg{A}->set_attribute(flags => ['\\Seen']); ++ $self->check_messages(\%msg); ++ ++ xlog $self, "Clear \\Seen on message A"; ++ $res = $talk->store('1', '-flags', '(\\Seen)'); ++ $self->assert_deep_equals({ '1' => { 'flags' => [] }}, $res); ++ $msg{A}->set_attribute(flags => []); ++ $self->check_messages(\%msg); ++ ++ xlog $self, "Set \\Seen on message A again"; ++ $res = $talk->store('1', '+flags', '(\\Seen)'); ++ $self->assert_deep_equals({ '1' => { 'flags' => [ '\\Seen' ] }}, $res); ++ $msg{A}->set_attribute(flags => ['\\Seen']); ++ $self->check_messages(\%msg); ++ ++ # seen flag should survive a reconnect ++ xlog $self, "Reconnect, \\Seen should still be on message A"; ++ $self->{store}->disconnect(); ++ $self->{store}->connect(); ++ $self->{store}->_select(); ++ $self->check_messages(\%msg); ++} ++ + # + # Test that + # - the \Flagged flag can be set diff --git a/SOURCES/cyrus-imapd-CVE-2021-33582.patch b/SOURCES/patch-cyrus-CVE-2021-33582 similarity index 100% rename from SOURCES/cyrus-imapd-CVE-2021-33582.patch rename to SOURCES/patch-cyrus-CVE-2021-33582 diff --git a/SOURCES/fix-broken-delivery-to-shared-mailboxes.patch b/SOURCES/patch-cyrus-fix-broken-delivery-to-shared-mailboxes similarity index 100% rename from SOURCES/fix-broken-delivery-to-shared-mailboxes.patch rename to SOURCES/patch-cyrus-fix-broken-delivery-to-shared-mailboxes diff --git a/SOURCES/patch-cyrus-seen-unseen-flag b/SOURCES/patch-cyrus-seen-unseen-flag new file mode 100644 index 0000000..aaff4e2 --- /dev/null +++ b/SOURCES/patch-cyrus-seen-unseen-flag @@ -0,0 +1,60 @@ +From 6dc8b483b5045a94e72e631a8faee388713c3c05 Mon Sep 17 00:00:00 2001 +From: Bron Gondwana +Date: Wed, 21 Sep 2022 16:08:07 +1000 +Subject: [PATCH] index: track changes for modseq bump when setting seen on + shared folders + +--- + imap/index.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/imap/index.c b/imap/index.c +index af06e94e6..5c96216ad 100644 +--- a/imap/index.c ++++ b/imap/index.c +@@ -4778,6 +4778,7 @@ static int index_storeflag(struct index_state *state, + int dirty = 0; + modseq_t oldmodseq; + struct index_map *im = &state->map[msgno-1]; ++ int seen_dirty = 0; + int r; + + memset(modified_flags, 0, sizeof(struct index_modified_flags)); +@@ -4803,6 +4804,7 @@ static int index_storeflag(struct index_state *state, + im->isseen = new; + state->seen_dirty = 1; + dirty++; ++ seen_dirty = 1; + } + } + +@@ -4925,6 +4927,7 @@ static int index_storeflag(struct index_state *state, + else + system_flags &= ~FLAG_SEEN; + } ++ + /* add back the internal tracking flags */ + system_flags |= keep; + +@@ -4942,6 +4945,18 @@ static int index_storeflag(struct index_state *state, + r = msgrecord_set_userflags(msgrec, user_flags); + if (r) return r; + ++ // patch back in seen state for non-internal-seen ++ if (seen_dirty && !state->internalseen) { ++ if (im->isseen) { ++ modified_flags->added_system_flags |= FLAG_SEEN; ++ modified_flags->added_flags++; ++ } ++ else { ++ modified_flags->removed_system_flags |= FLAG_SEEN; ++ modified_flags->removed_flags++; ++ } ++ } ++ + /* if it's silent and unchanged, update the seen value, but + * not if qresync is enabled - RFC 4551 says that the MODSEQ + * must always been told, and we prefer just to tell flags +-- +2.43.0 + diff --git a/SOURCES/cyrus-imapd-squatter-assert-crash.patch b/SOURCES/patch-cyrus-squatter-assert-crash similarity index 100% rename from SOURCES/cyrus-imapd-squatter-assert-crash.patch rename to SOURCES/patch-cyrus-squatter-assert-crash diff --git a/SPECS/cyrus-imapd.spec b/SPECS/cyrus-imapd.spec index 822b451..931e09e 100644 --- a/SPECS/cyrus-imapd.spec +++ b/SPECS/cyrus-imapd.spec @@ -14,7 +14,7 @@ Name: cyrus-imapd Version: 3.4.1 -Release: 10%{?dist} +Release: 11%{?dist} %define ssl_pem_file_prefix /etc/pki/%name/%name @@ -48,17 +48,25 @@ Patch1: patch-cyrus-default-configs # place in the source must be patched to match. Patch2: patch-cyrus-rename-quota - # Workaround for some compiled Perl modules not being linked against # libpcreposix, which causes them to fail to load. # https://bugzilla.redhat.com/show_bug.cgi?id=1668723 # https://github.com/cyrusimap/cyrus-imapd/issues/2629#issuecomment-456925909 Patch4: patch-cyrus-perl-linking -Patch5: cyrus-imapd-CVE-2021-33582.patch -Patch6: fix-broken-delivery-to-shared-mailboxes.patch +Patch5: patch-cyrus-CVE-2021-33582 +Patch6: patch-cyrus-fix-broken-delivery-to-shared-mailboxes + # https://github.com/cyrusimap/cyrus-imapd/pull/3892 -Patch7: cyrus-imapd-squatter-assert-crash.patch +Patch7: patch-cyrus-squatter-assert-crash + +# https://issues.redhat.com/browse/RHEL-20925 +# https://github.com/cyrusimap/cyrus-imapd/issues/3240 +# was fixed upstream in 3.2 by: +# https://github.com/cyrusimap/cyrus-imapd/pull/3577 +# for 3.4 and up the below fix got used instead: +# https://github.com/cyrusimap/cyrus-imapd/pull/4240 +Patch8: patch-cyrus-seen-unseen-flag Source10: cyrus-imapd.logrotate Source11: cyrus-imapd.pam-config @@ -89,6 +97,9 @@ Source91: patch-cassandane-no-syslog # Upstream ticket https://github.com/cyrusimap/cyrus-imapd/issues/1995 Source92: patch-cassandane-fix-annotator +# Regression test for RHEL-20925 +# https://github.com/cyrusimap/cyrus-imapd/commit/b78c39153f96f473c1b0bbac8f8762c0ad4c64cc +Source93: patch-cassandane-seen-unseen-flag BuildRequires: autoconf automake bison flex gcc gcc-c++ git glibc-langpack-en BuildRequires: groff libtool pkgconfig rsync systemd transfig @@ -265,6 +276,7 @@ tar xf %SOURCE81 patch -p1 < %SOURCE91 patch -p1 < %SOURCE92 +patch -p1 < %SOURCE93 cp %SOURCE82 cassandane.ini # RF rpm-buildroot-usage @@ -671,6 +683,11 @@ exclude+=("!Master.maxforkrate") %changelog +* Thu Feb 08 2024 Martin Osvald - 3.4.1-11 +- Resolves: RHEL-20925 - Seen/Unseen Flag not working correctly + for shared mailboxes +- cyrus-imapd.spec: rename patches to correspond with others + * Tue Aug 01 2023 Martin Osvald - 3.4.1-10 - Resolves: #2095381 - Use systemd-sysusers for cyrus user and group