ENGINE-522: merged in removal of bad PEP_OWN_USERID from get_message_trustwords sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 27 Mar 2019 17:03:31 +0100
branchsync
changeset 34048b7d693bebfe
parent 3403 61dbe005c428
parent 3402 2ed9ae4bb6e8
child 3406 c7540a618a4c
child 3417 a1cabfd63053
ENGINE-522: merged in removal of bad PEP_OWN_USERID from get_message_trustwords
src/keymanagement.c
src/message_api.c
     1.1 --- a/src/keymanagement.c	Wed Mar 27 17:00:40 2019 +0100
     1.2 +++ b/src/keymanagement.c	Wed Mar 27 17:03:31 2019 +0100
     1.3 @@ -1988,6 +1988,7 @@
     1.4          thing = _pgp_thing_next(thing);
     1.5          switch (thing) {
     1.6              case _pgp_fpr:
     1.7 +                // PEP_OWN_USERID is ok here because this is only run on first use!
     1.8                  identity = new_identity(NULL, NULL, PEP_OWN_USERID, NULL);
     1.9                  if (!identity) {
    1.10                      status = PEP_OUT_OF_MEMORY;
     2.1 --- a/src/message_api.c	Wed Mar 27 17:00:40 2019 +0100
     2.2 +++ b/src/message_api.c	Wed Mar 27 17:03:31 2019 +0100
     2.3 @@ -4414,10 +4414,21 @@
     2.4      // Find own identity corresponding to given account address.
     2.5      // In that case we want default key attached to own identity
     2.6      pEp_identity *stored_identity = NULL;
     2.7 +    
     2.8 +    char* own_id = NULL;
     2.9 +    status = get_default_own_userid(session, &own_id);
    2.10 +
    2.11 +    if (!(status == PEP_STATUS_OK && own_id)) {
    2.12 +        free(own_id);
    2.13 +        return PEP_CANNOT_FIND_IDENTITY;
    2.14 +    }
    2.15 +    
    2.16      status = get_identity(session,
    2.17                            received_by->address,
    2.18 -                          PEP_OWN_USERID,
    2.19 +                          own_id,
    2.20                            &stored_identity);
    2.21 +    free(own_id);
    2.22 +    own_id = NULL;                      
    2.23  
    2.24      if (status != PEP_STATUS_OK) {
    2.25          free_identity(stored_identity);