src/keymanagement.c
branchENGINE-199
changeset 1764 e1c31ee55aad
parent 1753 01faac16cec6
parent 1760 f691b9603e8b
child 1765 1693d16c36ea
     1.1 --- a/src/keymanagement.c	Mon May 08 08:21:24 2017 +0200
     1.2 +++ b/src/keymanagement.c	Tue May 09 09:31:15 2017 +0200
     1.3 @@ -339,19 +339,14 @@
     1.4          for (_keylist = keylist; _keylist && _keylist->value; _keylist = _keylist->next) {
     1.5              bool is_own = false;
     1.6              
     1.7 -            if (session->use_only_own_private_keys)
     1.8 -            {
     1.9 -                status = own_key_is_listed(session, _keylist->value, &is_own);
    1.10 -                assert(status == PEP_STATUS_OK);
    1.11 -                if (status != PEP_STATUS_OK) {
    1.12 -                    free_stringlist(keylist);
    1.13 -                    return status;
    1.14 -                }
    1.15 +            status = own_key_is_listed(session, _keylist->value, &is_own);
    1.16 +            assert(status == PEP_STATUS_OK);
    1.17 +            if (status != PEP_STATUS_OK) {
    1.18 +                free_stringlist(keylist);
    1.19 +                return status;
    1.20              }
    1.21 -
    1.22 -            // TODO : also accept synchronized device group keys ?
    1.23              
    1.24 -            if (!session->use_only_own_private_keys || is_own)
    1.25 +            if (is_own)
    1.26              {
    1.27                  PEP_comm_type _comm_type_key;
    1.28                  
    1.29 @@ -543,8 +538,7 @@
    1.30      {
    1.31          status = key_revoked(session, identity->fpr, &revoked);
    1.32  
    1.33 -        // Forces re-election if key is missing and own-key-only not forced
    1.34 -        if (!session->use_only_own_private_keys && status == PEP_KEY_NOT_FOUND) 
    1.35 +        if (status != PEP_STATUS_OK) 
    1.36          {
    1.37              status = elect_ownkey(session, identity);
    1.38              assert(status == PEP_STATUS_OK);
    1.39 @@ -1010,7 +1004,7 @@
    1.40      return _own_keys_retrieve(session, keylist, 0);
    1.41  }
    1.42  
    1.43 -// TODO: Unused for now, but should be used when sync receive old keys (ENGINE-145)
    1.44 +// FIXME: should it be be used when sync receive old keys ? (ENGINE-145)
    1.45  DYNAMIC_API PEP_STATUS set_own_key(
    1.46         PEP_SESSION session,
    1.47         const char *address,
    1.48 @@ -1020,12 +1014,12 @@
    1.49      PEP_STATUS status = PEP_STATUS_OK;
    1.50      
    1.51      assert(session &&
    1.52 -           address && address[0] &&
    1.53 +           address &&
    1.54             fpr && fpr[0]
    1.55            );
    1.56      
    1.57      if (!(session &&
    1.58 -          address && address[0] &&
    1.59 +          address &&
    1.60            fpr && fpr[0]
    1.61           ))
    1.62          return PEP_ILLEGAL_VALUE;