mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
fix: more logic fixes for encryption
This commit is contained in:
@@ -522,15 +522,15 @@ pub unsafe fn dc_apeerstate_save_to_db(
|
||||
success
|
||||
}
|
||||
|
||||
// TODO should return bool /rtn
|
||||
pub unsafe fn dc_apeerstate_has_verified_key(
|
||||
peerstate: &dc_apeerstate_t,
|
||||
fingerprints: *const dc_hash_t,
|
||||
) -> libc::c_int {
|
||||
) -> bool {
|
||||
if fingerprints.is_null() {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
if !peerstate.verified_key.is_some()
|
||||
|
||||
if peerstate.verified_key.is_some()
|
||||
&& !peerstate.verified_key_fingerprint.is_null()
|
||||
&& !dc_hash_find(
|
||||
fingerprints,
|
||||
@@ -539,8 +539,8 @@ pub unsafe fn dc_apeerstate_has_verified_key(
|
||||
)
|
||||
.is_null()
|
||||
{
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
0
|
||||
false
|
||||
}
|
||||
|
||||
@@ -1114,19 +1114,21 @@ pub unsafe fn dc_contact_is_verified_ex<'a>(
|
||||
}
|
||||
} else {
|
||||
let mut peerstate = dc_apeerstate_new((*contact).context);
|
||||
let mut res = 0;
|
||||
|
||||
if 0 != dc_apeerstate_load_by_addr(
|
||||
&mut peerstate,
|
||||
&mut (*contact).context.sql.clone().read().unwrap(),
|
||||
(*contact).addr,
|
||||
) {
|
||||
res = if peerstate.verified_key.is_some() {
|
||||
let res = if 0
|
||||
!= dc_apeerstate_load_by_addr(
|
||||
&mut peerstate,
|
||||
&(*contact).context.sql.clone().read().unwrap(),
|
||||
(*contact).addr,
|
||||
) {
|
||||
if peerstate.verified_key.is_some() {
|
||||
2
|
||||
} else {
|
||||
0
|
||||
};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
0
|
||||
};
|
||||
dc_apeerstate_unref(&mut peerstate);
|
||||
|
||||
res
|
||||
|
||||
@@ -1896,12 +1896,10 @@ unsafe fn check_verified_properties(
|
||||
);
|
||||
dc_log_warning(context, 0i32, *failure_reason);
|
||||
current_block = 14837890932895028253;
|
||||
} else if 0
|
||||
== dc_apeerstate_has_verified_key(
|
||||
&peerstate,
|
||||
(*(*mimeparser).e2ee_helper).signatures,
|
||||
)
|
||||
{
|
||||
} else if !dc_apeerstate_has_verified_key(
|
||||
&peerstate,
|
||||
(*(*mimeparser).e2ee_helper).signatures,
|
||||
) {
|
||||
*failure_reason = dc_mprintf(
|
||||
b"%s. See \"Info\" for details.\x00" as *const u8 as *const libc::c_char,
|
||||
b"The message was sent with non-verified encryption.\x00" as *const u8
|
||||
|
||||
Reference in New Issue
Block a user