mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
Merge pull request #296 from deltachat/remove_gotos_dc_e2ee
Remove gotos from dc_e2ee
This commit is contained in:
@@ -66,7 +66,7 @@ pub unsafe fn dc_e2ee_encrypt(
|
|||||||
mut in_out_message: *mut mailmime,
|
mut in_out_message: *mut mailmime,
|
||||||
helper: &mut dc_e2ee_helper_t,
|
helper: &mut dc_e2ee_helper_t,
|
||||||
) {
|
) {
|
||||||
let mut current_block: u64 = 0;
|
let mut ok_to_continue = true;
|
||||||
let mut col: libc::c_int = 0i32;
|
let mut col: libc::c_int = 0i32;
|
||||||
let mut do_encrypt: libc::c_int = 0i32;
|
let mut do_encrypt: libc::c_int = 0i32;
|
||||||
/*just a pointer into mailmime structure, must not be freed*/
|
/*just a pointer into mailmime structure, must not be freed*/
|
||||||
@@ -283,7 +283,7 @@ pub unsafe fn dc_e2ee_encrypt(
|
|||||||
);
|
);
|
||||||
mailmime_write_mem(plain, &mut col, message_to_encrypt);
|
mailmime_write_mem(plain, &mut col, message_to_encrypt);
|
||||||
if (*plain).str_0.is_null() || (*plain).len <= 0 {
|
if (*plain).str_0.is_null() || (*plain).len <= 0 {
|
||||||
current_block = 14181132614457621749;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
if let Some(ctext_v) = dc_pgp_pk_encrypt(
|
if let Some(ctext_v) = dc_pgp_pk_encrypt(
|
||||||
(*plain).str_0 as *const libc::c_void,
|
(*plain).str_0 as *const libc::c_void,
|
||||||
@@ -340,15 +340,10 @@ pub unsafe fn dc_e2ee_encrypt(
|
|||||||
(*encrypted_part).mm_parent = in_out_message;
|
(*encrypted_part).mm_parent = in_out_message;
|
||||||
mailmime_free(message_to_encrypt);
|
mailmime_free(message_to_encrypt);
|
||||||
(*helper).encryption_successfull = 1i32;
|
(*helper).encryption_successfull = 1i32;
|
||||||
current_block = 13824533195664196414;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 13824533195664196414;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
if ok_to_continue {
|
||||||
14181132614457621749 => {}
|
|
||||||
_ => {
|
|
||||||
let aheader = Aheader::new(addr, public_key, prefer_encrypt);
|
let aheader = Aheader::new(addr, public_key, prefer_encrypt);
|
||||||
mailimf_fields_add(
|
mailimf_fields_add(
|
||||||
imffields_unprotected,
|
imffields_unprotected,
|
||||||
@@ -362,7 +357,6 @@ pub unsafe fn dc_e2ee_encrypt(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if !plain.is_null() {
|
if !plain.is_null() {
|
||||||
mmap_string_free(plain);
|
mmap_string_free(plain);
|
||||||
@@ -378,7 +372,7 @@ unsafe fn new_data_part(
|
|||||||
default_content_type: *mut libc::c_char,
|
default_content_type: *mut libc::c_char,
|
||||||
default_encoding: libc::c_int,
|
default_encoding: libc::c_int,
|
||||||
) -> *mut mailmime {
|
) -> *mut mailmime {
|
||||||
let mut current_block: u64;
|
let mut ok_to_continue = true;
|
||||||
//char basename_buf[PATH_MAX];
|
//char basename_buf[PATH_MAX];
|
||||||
let mut encoding: *mut mailmime_mechanism;
|
let mut encoding: *mut mailmime_mechanism;
|
||||||
let content: *mut mailmime_content;
|
let content: *mut mailmime_content;
|
||||||
@@ -398,7 +392,7 @@ unsafe fn new_data_part(
|
|||||||
}
|
}
|
||||||
content = mailmime_content_new_with_str(content_type_str);
|
content = mailmime_content_new_with_str(content_type_str);
|
||||||
if content.is_null() {
|
if content.is_null() {
|
||||||
current_block = 16266721588079097885;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
do_encoding = 1i32;
|
do_encoding = 1i32;
|
||||||
if (*(*content).ct_type).tp_type == MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int {
|
if (*(*content).ct_type).tp_type == MAILMIME_TYPE_COMPOSITE_TYPE as libc::c_int {
|
||||||
@@ -426,16 +420,10 @@ unsafe fn new_data_part(
|
|||||||
}
|
}
|
||||||
encoding = mailmime_mechanism_new(encoding_type, 0 as *mut libc::c_char);
|
encoding = mailmime_mechanism_new(encoding_type, 0 as *mut libc::c_char);
|
||||||
if encoding.is_null() {
|
if encoding.is_null() {
|
||||||
current_block = 16266721588079097885;
|
ok_to_continue = false;
|
||||||
} else {
|
|
||||||
current_block = 11057878835866523405;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 11057878835866523405;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
if ok_to_continue {
|
||||||
16266721588079097885 => {}
|
|
||||||
_ => {
|
|
||||||
mime_fields = mailmime_fields_new_with_data(
|
mime_fields = mailmime_fields_new_with_data(
|
||||||
encoding,
|
encoding,
|
||||||
0 as *mut libc::c_char,
|
0 as *mut libc::c_char,
|
||||||
@@ -444,7 +432,7 @@ unsafe fn new_data_part(
|
|||||||
0 as *mut mailmime_language,
|
0 as *mut mailmime_language,
|
||||||
);
|
);
|
||||||
if mime_fields.is_null() {
|
if mime_fields.is_null() {
|
||||||
current_block = 16266721588079097885;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
mime = mailmime_new_empty(content, mime_fields);
|
mime = mailmime_new_empty(content, mime_fields);
|
||||||
if mime.is_null() {
|
if mime.is_null() {
|
||||||
@@ -459,13 +447,11 @@ unsafe fn new_data_part(
|
|||||||
}
|
}
|
||||||
return mime;
|
return mime;
|
||||||
}
|
}
|
||||||
current_block = 13668317689588454213;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
match current_block {
|
if ok_to_continue == false {
|
||||||
16266721588079097885 => {
|
|
||||||
if !encoding.is_null() {
|
if !encoding.is_null() {
|
||||||
mailmime_mechanism_free(encoding);
|
mailmime_mechanism_free(encoding);
|
||||||
}
|
}
|
||||||
@@ -473,8 +459,6 @@ unsafe fn new_data_part(
|
|||||||
mailmime_content_free(content);
|
mailmime_content_free(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
return 0 as *mut mailmime;
|
return 0 as *mut mailmime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,7 +819,7 @@ unsafe fn decrypt_part(
|
|||||||
ret_valid_signatures: &mut HashSet<String>,
|
ret_valid_signatures: &mut HashSet<String>,
|
||||||
ret_decrypted_mime: *mut *mut mailmime,
|
ret_decrypted_mime: *mut *mut mailmime,
|
||||||
) -> libc::c_int {
|
) -> libc::c_int {
|
||||||
let current_block: u64;
|
let mut ok_to_continue = true;
|
||||||
let mime_data: *mut mailmime_data;
|
let mime_data: *mut mailmime_data;
|
||||||
let mut mime_transfer_encoding: libc::c_int = MAILMIME_MECHANISM_BINARY as libc::c_int;
|
let mut mime_transfer_encoding: libc::c_int = MAILMIME_MECHANISM_BINARY as libc::c_int;
|
||||||
/* mmap_string_unref()'d if set */
|
/* mmap_string_unref()'d if set */
|
||||||
@@ -883,9 +867,7 @@ unsafe fn decrypt_part(
|
|||||||
decoded_data_bytes = (*mime_data).dt_data.dt_text.dt_length;
|
decoded_data_bytes = (*mime_data).dt_data.dt_text.dt_length;
|
||||||
if decoded_data.is_null() || decoded_data_bytes <= 0 {
|
if decoded_data.is_null() || decoded_data_bytes <= 0 {
|
||||||
/* no error - but no data */
|
/* no error - but no data */
|
||||||
current_block = 2554982661806928548;
|
ok_to_continue = false;
|
||||||
} else {
|
|
||||||
current_block = 4488286894823169796;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let r: libc::c_int;
|
let r: libc::c_int;
|
||||||
@@ -902,18 +884,14 @@ unsafe fn decrypt_part(
|
|||||||
|| transfer_decoding_buffer.is_null()
|
|| transfer_decoding_buffer.is_null()
|
||||||
|| decoded_data_bytes <= 0
|
|| decoded_data_bytes <= 0
|
||||||
{
|
{
|
||||||
current_block = 2554982661806928548;
|
ok_to_continue = false;
|
||||||
} else {
|
} else {
|
||||||
decoded_data = transfer_decoding_buffer;
|
decoded_data = transfer_decoding_buffer;
|
||||||
current_block = 4488286894823169796;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match current_block {
|
if ok_to_continue {
|
||||||
2554982661806928548 => {}
|
|
||||||
_ => {
|
|
||||||
/* encrypted, decoded data in decoded_data now ... */
|
/* encrypted, decoded data in decoded_data now ... */
|
||||||
if !(0 == has_decrypted_pgp_armor(decoded_data, decoded_data_bytes as libc::c_int))
|
if !(0 == has_decrypted_pgp_armor(decoded_data, decoded_data_bytes as libc::c_int)) {
|
||||||
{
|
|
||||||
let add_signatures = if ret_valid_signatures.is_empty() {
|
let add_signatures = if ret_valid_signatures.is_empty() {
|
||||||
Some(ret_valid_signatures)
|
Some(ret_valid_signatures)
|
||||||
} else {
|
} else {
|
||||||
@@ -952,7 +930,6 @@ unsafe fn decrypt_part(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//mailmime_substitute(mime, new_mime);
|
//mailmime_substitute(mime, new_mime);
|
||||||
//s. mailprivacy_gnupg.c::pgp_decrypt()
|
//s. mailprivacy_gnupg.c::pgp_decrypt()
|
||||||
if !transfer_decoding_buffer.is_null() {
|
if !transfer_decoding_buffer.is_null() {
|
||||||
|
|||||||
Reference in New Issue
Block a user