...
authorvb
Thu, 31 Jul 2014 10:15:09 +0200
changeset 10ead888e73384
parent 9 41e66a54f03e
child 11 3ac4c77f987a
child 14 c99db0b8fc0f
...
src/keymanagement.c
src/keymanagement.h
src/pEpEngine.c
src/pEpEngine.h
     1.1 --- a/src/keymanagement.c	Wed Jul 30 16:02:49 2014 +0200
     1.2 +++ b/src/keymanagement.c	Thu Jul 31 10:15:09 2014 +0200
     1.3 @@ -37,23 +37,14 @@
     1.4      if (status == PEP_OUT_OF_MEMORY)
     1.5          return PEP_OUT_OF_MEMORY;
     1.6  
     1.7 +    PEP_comm_type _comm_type_key;
     1.8 +    status = get_key_rating(session, stored_identity->fpr, &_comm_type_key);
     1.9 +    assert(status != PEP_OUT_OF_MEMORY);
    1.10 +    if (status == PEP_OUT_OF_MEMORY)
    1.11 +        return PEP_OUT_OF_MEMORY;
    1.12 +
    1.13      if (stored_identity) {
    1.14          if (EMPTY(identity->fpr)) {
    1.15 -            identity->comm_type = PEP_ct_unknown;
    1.16 -
    1.17 -            stringlist_t *keylist;
    1.18 -
    1.19 -            status = find_keys(session, stored_identity->fpr, &keylist);
    1.20 -            assert(status != PEP_OUT_OF_MEMORY);
    1.21 -            if (status == PEP_OUT_OF_MEMORY)
    1.22 -                return PEP_OUT_OF_MEMORY;
    1.23 -
    1.24 -            if (keylist && keylist->value) {
    1.25 -                identity->comm_type = stored_identity->comm_type;
    1.26 -            }
    1.27 -
    1.28 -            free_stringlist(keylist);
    1.29 -
    1.30              identity->fpr = strdup(stored_identity->fpr);
    1.31              assert(identity->fpr);
    1.32              if (identity->fpr == NULL)
     2.1 --- a/src/keymanagement.h	Wed Jul 30 16:02:49 2014 +0200
     2.2 +++ b/src/keymanagement.h	Thu Jul 31 10:15:09 2014 +0200
     2.3 @@ -9,10 +9,10 @@
     2.4  //      identity (inout)    identity information of communication partner
     2.5  //
     2.6  //  caveat:
     2.7 -//      if this function returns PEP_ct_unknown in identity->comm_type, the
     2.8 -//      caller must insert the identity into the asynchronous management
     2.9 -//      implementation, so retrieve_next_identity() will return this identity
    2.10 -//      later
    2.11 +//      if this function returns PEP_ct_unknown or PEP_ct_key_expired in
    2.12 +//      identity->comm_type, the caller must insert the identity into the
    2.13 +//      asynchronous management implementation, so retrieve_next_identity()
    2.14 +//      will return this identity later
    2.15  //      at least identity->address must be a valid UTF-8 string as input
    2.16  
    2.17  DYNAMIC_API PEP_STATUS update_identity(
     3.1 --- a/src/pEpEngine.c	Wed Jul 30 16:02:49 2014 +0200
     3.2 +++ b/src/pEpEngine.c	Thu Jul 31 10:15:09 2014 +0200
     3.3 @@ -2003,6 +2003,7 @@
     3.4          break;
     3.5      case GPG_ERR_ENOMEM:
     3.6          _session->gpgme_op_keylist_end(_session->ctx);
     3.7 +        *comm_type = PEP_ct_unknown;
     3.8          return PEP_OUT_OF_MEMORY;
     3.9      default:
    3.10          // BUG: GPGME returns an illegal value instead of GPG_ERR_EOF after
     4.1 --- a/src/pEpEngine.h	Wed Jul 30 16:02:49 2014 +0200
     4.2 +++ b/src/pEpEngine.h	Thu Jul 31 10:15:09 2014 +0200
     4.3 @@ -612,6 +612,9 @@
     4.4  //      session (in)            session handle
     4.5  //      fpr (in)                unique identifyer for key as UTF-8 string
     4.6  //      comm_type (out)         key rating
     4.7 +//
     4.8 +//  if an error occurs, *comm_type is set to PEP_ct_unknown and an error status
     4.9 +//  is returned
    4.10  
    4.11  DYNAMIC_API PEP_STATUS get_key_rating(
    4.12      PEP_SESSION session,