Browse Source

encrypt_message: fix semantics, after factoring

...Semantics change in decrypt_message:

After factoring the code to fit my smaller mental capacity I noticed that in
case of _status being one of PEP_PASSPHRASE_REQUIRED,
PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED or PEP_WRONG_PASSPHRASE, encrypt_message
went to the pEp_error label but in the end returned PEP_STATUS_OK.

I assume this was not intended.  Simplify further, using status in the place
of _status.  Nothing seems to break.
ENGINE-967
Luca Saiu 9 months ago
parent
commit
8e9197fd4b
1 changed files with 14 additions and 17 deletions
  1. +14
    -17
      src/message_api.c

+ 14
- 17
src/message_api.c View File

@ -2753,17 +2753,17 @@ DYNAMIC_API PEP_STATUS encrypt_message(
do { \
identity_list *ident_list = (ident_list_actual); \
if (ident_list) { \
_status = _update_state_for_ident_list( \
session, src->from, ident_list, \
&_k, \
&max_comm_type, \
&max_version_major, \
&max_version_minor, \
&has_pEp_user, \
&dest_keys_found, \
false \
); \
switch (_status) { \
status = _update_state_for_ident_list( \
session, src->from, ident_list, \
&_k, \
&max_comm_type, \
&max_version_major, \
&max_version_minor, \
&has_pEp_user, \
&dest_keys_found, \
false \
); \
switch (status) { \
case PEP_PASSPHRASE_REQUIRED: \
case PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED: \
case PEP_WRONG_PASSPHRASE: \
@ -2776,12 +2776,9 @@ DYNAMIC_API PEP_STATUS encrypt_message(
} \
} \
} while (false)
{
PEP_STATUS _status = PEP_STATUS_OK;
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->to);
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->cc);
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->bcc);
}
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->to);
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->cc);
UPDATE_STATE_FOR_IDENT_LIST_AND_JUMP_ON_ERROR (src->bcc);
if (max_version_major < 2)
force_v_1 = true;


Loading…
Cancel
Save