ENGINE-84: fixed status TODOs. ENGINE-84
authorKrista Grothoff <krista@pep-project.org>
Tue, 08 Nov 2016 17:57:06 +0100
branchENGINE-84
changeset 1371e2423e1df7e7
parent 1363 09d68a361f8a
child 1377 20be7d9a7536
ENGINE-84: fixed status TODOs.
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Tue Nov 08 17:42:14 2016 +0100
     1.2 +++ b/src/keymanagement.c	Tue Nov 08 17:57:06 2016 +0100
     1.3 @@ -384,12 +384,13 @@
     1.4      bool dont_use_fpr = true;
     1.5      
     1.6      PEP_STATUS status = blacklist_is_listed(session, fpr, &dont_use_fpr);
     1.7 -    if (!dont_use_fpr) {
     1.8 +    if (status == PEP_STATUS_OK && !dont_use_fpr) {
     1.9          // Make sure there is a *private* key associated with this fpr
    1.10          bool has_private = false;
    1.11          status = contains_priv_key(session, fpr, &has_private);
    1.12 -        // TODO: check status
    1.13 -        dont_use_fpr = !has_private;
    1.14 +
    1.15 +        if (status == PEP_STATUS_OK)
    1.16 +            dont_use_fpr = !has_private;
    1.17      }
    1.18      
    1.19      *is_usable = !dont_use_fpr;
    1.20 @@ -448,6 +449,7 @@
    1.21              
    1.22              status = _has_usable_priv_key(session, stored_identity->fpr, &has_private); 
    1.23              
    1.24 +            // N.B. has_private is never true if the returned status is not PEP_STATUS_OK
    1.25              if (has_private) {
    1.26                  identity->fpr = strdup(stored_identity->fpr);
    1.27                  assert(identity->fpr);
    1.28 @@ -475,6 +477,7 @@
    1.29          
    1.30          status = _has_usable_priv_key(session, identity->fpr, &has_private); 
    1.31          
    1.32 +        // N.B. has_private is never true if the returned status is not PEP_STATUS_OK
    1.33          if (has_private) {
    1.34              identity->flags = 0;
    1.35              dont_use_input_fpr = false;
    1.36 @@ -497,8 +500,9 @@
    1.37              // Check to see if it's blacklisted
    1.38              bool listed;
    1.39              status = blacklist_is_listed(session, identity->fpr, &listed); 
    1.40 -            // TODO: check status
    1.41 -            has_private = !listed;
    1.42 +
    1.43 +            if (status == PEP_STATUS_OK)
    1.44 +                has_private = !listed;
    1.45          }
    1.46          
    1.47          if (has_private) {