src/keymanagement.c
branchENGINE-289
changeset 2319 93c84d8281d2
parent 2317 b80dd91c8869
child 2324 de5b5578fc16
     1.1 --- a/src/keymanagement.c	Fri Dec 15 12:49:03 2017 +0100
     1.2 +++ b/src/keymanagement.c	Sat Dec 16 15:35:38 2017 +0100
     1.3 @@ -86,19 +86,28 @@
     1.4      status = key_revoked(session, fpr, &revoked);    
     1.5      
     1.6      assert(status == PEP_STATUS_OK);
     1.7 +    // switch (status) {
     1.8 +    //     case PEP_STATUS_OK:
     1.9 +    //         break;
    1.10 +    //     case PEP_KEY_NOT_FOUND:
    1.11 +    //         // Key not found in keyring
    1.12 +    //     case PEP_GET_KEY_FAILED:
    1.13 +    //         // other GPG error
    1.14 +    //     default:
    1.15 +    //         return status;
    1.16 +    // }
    1.17 +    
    1.18      if (status != PEP_STATUS_OK) {
    1.19 -         // only happens when there was a problem
    1.20 -         // retrieving key.
    1.21 -         ADD_TO_LOG(status);
    1.22 +         return ADD_TO_LOG(status);
    1.23       }
    1.24      
    1.25 -    status = key_expired(session, identity->fpr, 
    1.26 -                         time(NULL) + (7*24*3600), // In a week
    1.27 +    status = key_expired(session, fpr, 
    1.28 +                         time(NULL), // NOW. For _myself, this is different.
    1.29                           &expired);
    1.30  
    1.31      assert(status == PEP_STATUS_OK);
    1.32      if (status != PEP_STATUS_OK)
    1.33 -         ADD_TO_LOG(status);
    1.34 +         return ADD_TO_LOG(status);
    1.35      
    1.36      char* retval = fpr;
    1.37      
    1.38 @@ -113,6 +122,8 @@
    1.39              // if key is valid (second check because pEp key might be extended above)
    1.40              //      Return fpr        
    1.41              status = key_expired(session, fpr, &expired);            
    1.42 +            if (status != PEP_STATUS_OK)
    1.43 +                 return ADD_TO_LOG(status);
    1.44              // communicate key(?)
    1.45              done = true;
    1.46          }        
    1.47 @@ -128,6 +139,7 @@
    1.48          case PEP_ct_key_revoked
    1.49          case PEP_ct_key_b0rken:
    1.50              // delete key from being default key for all users/identities
    1.51 +            status = remove_fpr_as_default(session, fpr);
    1.52              ident->fpr = NULL;
    1.53          default:
    1.54              break;