Myself() : elect another pre-existing private key if stored own identity key have been removed from GPG keyring (Outlook+GPA case)
authorEdouard Tisserant
Wed, 29 Jun 2016 19:20:10 +0200
changeset 775af16c9faedf2
parent 774 bc90d5bf74d5
child 776 c3428bcc5300
Myself() : elect another pre-existing private key if stored own identity key have been removed from GPG keyring (Outlook+GPA case)
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Wed Jun 29 17:31:50 2016 +0200
     1.2 +++ b/src/keymanagement.c	Wed Jun 29 19:20:10 2016 +0200
     1.3 @@ -401,8 +401,18 @@
     1.4      if (!EMPTYSTR(identity->fpr))
     1.5      {
     1.6          status = key_revoked(session, identity->fpr, &revoked);
     1.7 -        assert(status == PEP_STATUS_OK);
     1.8 -        if (status != PEP_STATUS_OK) {
     1.9 +
    1.10 +        // Forces re-election if key is missing and own-key-only not forced
    1.11 +        if (!session->use_only_own_private_keys && status == PEP_KEY_NOT_FOUND) 
    1.12 +        {
    1.13 +            status = elect_ownkey(session, identity);
    1.14 +            assert(status == PEP_STATUS_OK);
    1.15 +            if (status != PEP_STATUS_OK) {
    1.16 +                return status;
    1.17 +            }
    1.18 +        } 
    1.19 +        else if (status != PEP_STATUS_OK) 
    1.20 +        {
    1.21              return status;
    1.22          }
    1.23      }