@@ -14,6 +14,7 @@ use crate::contact;
14
14
use crate :: download:: MIN_DOWNLOAD_LIMIT ;
15
15
use crate :: imap:: prefetch_should_download;
16
16
use crate :: imex:: { ImexMode , imex} ;
17
+ use crate :: mimefactory:: MimeFactory ;
17
18
use crate :: securejoin:: get_securejoin_qr;
18
19
use crate :: test_utils:: {
19
20
E2EE_INFO_MSGS , TestContext , TestContextManager , get_chat_msg, mark_as_verified,
@@ -3050,6 +3051,46 @@ async fn test_auto_accept_protected_group_for_bots() -> Result<()> {
3050
3051
Ok ( ( ) )
3051
3052
}
3052
3053
3054
+ /// Regression test for a bug where receive_imf() failed
3055
+ /// if the sender of a message also put itself into the recipients list.
3056
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
3057
+ async fn test_verification_gossip ( ) -> Result < ( ) > {
3058
+ let mut tcm = TestContextManager :: new ( ) ;
3059
+ let alice = & tcm. alice ( ) . await ;
3060
+ let bob = & tcm. bob ( ) . await ;
3061
+ let fiona = & tcm. fiona ( ) . await ;
3062
+
3063
+ mark_as_verified ( alice, bob) . await ;
3064
+ mark_as_verified ( bob, alice) . await ;
3065
+
3066
+ mark_as_verified ( alice, fiona) . await ;
3067
+ mark_as_verified ( fiona, alice) . await ;
3068
+
3069
+ let group_id = alice
3070
+ . create_group_with_members ( ProtectionStatus :: Protected , "Group" , & [ bob, fiona] )
3071
+ . await ;
3072
+
3073
+ let mut msg = Message :: new_text ( "Hello!" . to_string ( ) ) ;
3074
+ msg. chat_id = group_id;
3075
+ msg. from_id = ContactId :: SELF ;
3076
+ msg. rfc724_mid = "rfc724_mid" . to_string ( ) ;
3077
+ msg. id = MsgId :: new ( 10 ) ;
3078
+ let mut mime_factory = MimeFactory :: from_msg ( alice, msg) . await ?;
3079
+ mime_factory
3080
+ . to
3081
+ . push ( ( "Alice" . to_string ( ) , "[email protected] " . to_string ( ) ) ) ;
3082
+ mime_factory
3083
+ . member_fingerprints
3084
+ . push ( crate :: key:: self_fingerprint ( alice) . await ?. to_string ( ) ) ;
3085
+ mime_factory. member_timestamps . push ( 0 ) ;
3086
+ let rendered = mime_factory. render ( alice) . await ?;
3087
+ let imf_raw = rendered. message . as_bytes ( ) ;
3088
+
3089
+ let _msg = receive_imf ( bob, imf_raw, false ) . await ?;
3090
+
3091
+ Ok ( ( ) )
3092
+ }
3093
+
3053
3094
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
3054
3095
async fn test_bot_accepts_another_group_after_qr_scan ( ) -> Result < ( ) > {
3055
3096
let mut tcm = TestContextManager :: new ( ) ;
0 commit comments