src/keymanagement.c
branchENGINE-209
changeset 1797 32581fade44d
parent 1793 74cf3813c28e
child 1799 1e46b8759248
     1.1 --- a/src/keymanagement.c	Wed May 17 15:07:49 2017 +0200
     1.2 +++ b/src/keymanagement.c	Thu May 18 11:27:07 2017 +0200
     1.3 @@ -152,14 +152,15 @@
     1.4                  
     1.5              if (revoked) {
     1.6                  // Do stuff
     1.7 -                status = change_key_comm_type(session, fpr, PEP_ct_key_revoked);
     1.8 +                status = change_key_comm_type(session, stored_identity->fpr, PEP_ct_key_revoked);
     1.9                  // What to do on failure? FIXME
    1.10 -                status = remove_key_as_id_default(session, fpr);
    1.11 +                status = remove_key_as_id_default(session, stored_identity->fpr);
    1.12              }
    1.13 -                
    1.14 -            status = blacklist_is_listed(session, stored_identity->fpr, &dont_use_stored_fpr);
    1.15 -            if (status != PEP_STATUS_OK)
    1.16 -                dont_use_stored_fpr = true; 
    1.17 +            else {    
    1.18 +                status = blacklist_is_listed(session, stored_identity->fpr, &dont_use_stored_fpr);
    1.19 +                if (status != PEP_STATUS_OK)
    1.20 +                    dont_use_stored_fpr = true; 
    1.21 +            }
    1.22          }
    1.23              
    1.24  
    1.25 @@ -1062,7 +1063,7 @@
    1.26      return session->cryptotech[PEP_crypt_OpenPGP].contains_priv_key(session, fpr, has_private);
    1.27  }
    1.28  
    1.29 -static PEP_STATUS change_key_comm_type(PEP_SESSION session, 
    1.30 +PEP_STATUS change_key_comm_type(PEP_SESSION session, 
    1.31                                         const char* fpr,
    1.32                                         PEP_comm_type comm_type) {
    1.33                                             
    1.34 @@ -1076,7 +1077,7 @@
    1.35          return status;
    1.36      }
    1.37          
    1.38 -    if (!user_id_list || !user_id_list->value())
    1.39 +    if (!user_id_list || !user_id_list->value)
    1.40          return PEP_KEY_NOT_FOUND;
    1.41          
    1.42      stringlist_t* curr_id = user_id_list;
    1.43 @@ -1093,12 +1094,12 @@
    1.44      return PEP_STATUS_OK;
    1.45  }
    1.46  
    1.47 -static PEP_STATUS remove_key_as_id_default(PEP_SESSIONS session, 
    1.48 +PEP_STATUS remove_key_as_id_default(PEP_SESSION session, 
    1.49                                             const char* fpr)
    1.50  {
    1.51      identity_list* affected_ids = NULL;
    1.52      
    1.53 -    PEP_STATUS status get_identities_by_fpr(session, fpr, &identity_list);
    1.54 +    PEP_STATUS status = get_identities_by_fpr(session, fpr, &affected_ids);
    1.55      
    1.56      if (status != PEP_STATUS_OK) {
    1.57          free_identity_list(affected_ids);
    1.58 @@ -1112,9 +1113,9 @@
    1.59      status = PEP_STATUS_OK;
    1.60      
    1.61      while (curr_identity) {
    1.62 -        free(curr_identity->fpr);
    1.63 -        curr_identity->fpr = (char*)calloc(1, sizeof(char)); // ""
    1.64 -        status = set_identity(session, curr_identity);
    1.65 +        free(curr_identity->ident->fpr);
    1.66 +        curr_identity->ident->fpr = (char*)calloc(1, sizeof(char)); // ""
    1.67 +        status = set_identity(session, curr_identity->ident);
    1.68          if (status != PEP_STATUS_OK)
    1.69              goto the_end;
    1.70          curr_identity = curr_identity->next;