ENGINE-352: added is_pep_user exception in encrypt_message ENGINE-352
authorKrista Bennett <krista@pep-project.org>
Sun, 04 Feb 2018 02:05:53 +0100
branchENGINE-352
changeset 24708ee0981369bb
parent 2469 419243d81d6f
child 2473 6ca62f99148e
child 2474 84717500ff5b
ENGINE-352: added is_pep_user exception in encrypt_message
src/message_api.c
     1.1 --- a/src/message_api.c	Fri Feb 02 17:15:33 2018 +0100
     1.2 +++ b/src/message_api.c	Sun Feb 04 02:05:53 2018 +0100
     1.3 @@ -1495,6 +1495,8 @@
     1.4      }
     1.5  
     1.6      bool dest_keys_found = true;
     1.7 +    bool has_pep_user = false;
     1.8 +    
     1.9      PEP_comm_type max_comm_type = PEP_ct_pEp;
    1.10  
    1.11      identity_list * _il;
    1.12 @@ -1518,6 +1520,8 @@
    1.13                  _il->ident->comm_type = PEP_ct_key_not_found;
    1.14                  _status = PEP_STATUS_OK;
    1.15              }
    1.16 +            if (!has_pep_user)
    1.17 +                is_pep_user(session, _il->ident, &has_pep_user);
    1.18          }
    1.19          else
    1.20              _status = myself(session, _il->ident);
    1.21 @@ -1548,6 +1552,8 @@
    1.22                      _il->ident->comm_type = PEP_ct_key_not_found;
    1.23                      _status = PEP_STATUS_OK;
    1.24                  }
    1.25 +                if (!has_pep_user)
    1.26 +                    is_pep_user(session, _il->ident, &has_pep_user);
    1.27              }
    1.28              else
    1.29                  _status = myself(session, _il->ident);
    1.30 @@ -1577,6 +1583,8 @@
    1.31                      _il->ident->comm_type = PEP_ct_key_not_found;
    1.32                      _status = PEP_STATUS_OK;
    1.33                  }
    1.34 +                if (!has_pep_user)
    1.35 +                    is_pep_user(session, _il->ident, &has_pep_user);
    1.36              }
    1.37              else
    1.38                  _status = myself(session, _il->ident);
    1.39 @@ -1606,7 +1614,7 @@
    1.40                  PEP_rating_undefined) < PEP_rating_reliable)
    1.41      {
    1.42          free_stringlist(keys);
    1.43 -        if (!session->passive_mode && 
    1.44 +        if ((has_pep_user || !session->passive_mode) && 
    1.45              !(flags & PEP_encrypt_flag_force_no_attached_key)) {
    1.46              attach_own_key(session, src);
    1.47              decorate_message(src, PEP_rating_undefined, NULL, true);