ENGINE-27: #comment I forgot one possible blacklist case. If you still get an assertion fail, I'd appreciate capturing the error type if you can so I can follow the logic. Please pull and try again... ENGINE-27
authorKrista Grothoff <krista@pep-project.org>
Tue, 27 Sep 2016 00:32:44 +0200
branchENGINE-27
changeset 1196d75a7a2e6577
parent 1194 887976b65446
child 1220 f992b45d7e08
ENGINE-27: #comment I forgot one possible blacklist case. If you still get an assertion fail, I'd appreciate capturing the error type if you can so I can follow the logic. Please pull and try again...
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Mon Sep 26 12:48:28 2016 +0200
     1.2 +++ b/src/keymanagement.c	Tue Sep 27 00:32:44 2016 +0200
     1.3 @@ -146,6 +146,8 @@
     1.4          goto exit_free;
     1.5  
     1.6      /* We elect a pubkey first in case there's no acceptable stored fpr */
     1.7 +    free(identity->fpr);
     1.8 +    identity->fpr = strdup("");
     1.9      status = elect_pubkey(session, identity);
    1.10      if (status != PEP_STATUS_OK)
    1.11          goto exit_free;
    1.12 @@ -165,6 +167,7 @@
    1.13              status = blacklist_is_listed(session, identity->fpr, &dont_use_fpr);
    1.14              if (dont_use_fpr) {
    1.15                  free(identity->fpr);
    1.16 +                identity->fpr = strdup("");
    1.17              }
    1.18              else {
    1.19                  _did_elect_new_key = 1;
    1.20 @@ -221,14 +224,26 @@
    1.21  
    1.22          /* Work with the elected key from above */
    1.23          if (!EMPTYSTR(identity->fpr)) {
    1.24 -            PEP_comm_type _comm_type_key;
    1.25 +            
    1.26 +            bool dont_use_fpr = true;
    1.27 +            status = blacklist_is_listed(session, identity->fpr, &dont_use_fpr);
    1.28 +            if (status != PEP_STATUS_OK)
    1.29 +                dont_use_fpr = true; 
    1.30  
    1.31 -            status = get_key_rating(session, identity->fpr, &_comm_type_key);
    1.32 -            assert(status != PEP_OUT_OF_MEMORY);
    1.33 -            if (status == PEP_OUT_OF_MEMORY)
    1.34 -                goto exit_free;
    1.35 +            if (!dont_use_fpr) {
    1.36 +                PEP_comm_type _comm_type_key;
    1.37  
    1.38 -            identity->comm_type = _comm_type_key;
    1.39 +                status = get_key_rating(session, identity->fpr, &_comm_type_key);
    1.40 +                assert(status != PEP_OUT_OF_MEMORY);
    1.41 +                if (status == PEP_OUT_OF_MEMORY)
    1.42 +                    goto exit_free;
    1.43 +
    1.44 +                identity->comm_type = _comm_type_key;
    1.45 +            }
    1.46 +            else {
    1.47 +                free(identity->fpr);
    1.48 +                identity->fpr = strdup("");
    1.49 +            }
    1.50          }
    1.51      }
    1.52