src/keymanagement.c
branchENGINE-209
changeset 1799 1e46b8759248
parent 1797 32581fade44d
child 1853 a86d6290d493
     1.1 --- a/src/keymanagement.c	Thu May 18 11:43:01 2017 +0200
     1.2 +++ b/src/keymanagement.c	Fri May 19 14:56:20 2017 +0200
     1.3 @@ -152,9 +152,9 @@
     1.4                  
     1.5              if (revoked) {
     1.6                  // Do stuff
     1.7 -                status = change_key_comm_type(session, stored_identity->fpr, PEP_ct_key_revoked);
     1.8 +                status = update_trust_for_fpr(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, stored_identity->fpr);
    1.11 +                status = replace_identities_fpr(session, stored_identity->fpr, "");
    1.12              }
    1.13              else {    
    1.14                  status = blacklist_is_listed(session, stored_identity->fpr, &dont_use_stored_fpr);
    1.15 @@ -1062,67 +1062,3 @@
    1.16  
    1.17      return session->cryptotech[PEP_crypt_OpenPGP].contains_priv_key(session, fpr, has_private);
    1.18  }
    1.19 -
    1.20 -PEP_STATUS change_key_comm_type(PEP_SESSION session, 
    1.21 -                                       const char* fpr,
    1.22 -                                       PEP_comm_type comm_type) {
    1.23 -                                           
    1.24 -    // get all user ids associated with this key
    1.25 -    stringlist_t* user_id_list = NULL;
    1.26 -    
    1.27 -    PEP_STATUS status = get_key_userids(session, fpr, &user_id_list);
    1.28 -    
    1.29 -    if (status != PEP_STATUS_OK) {
    1.30 -        free_stringlist(user_id_list);
    1.31 -        return status;
    1.32 -    }
    1.33 -        
    1.34 -    if (!user_id_list || !user_id_list->value)
    1.35 -        return PEP_KEY_NOT_FOUND;
    1.36 -        
    1.37 -    stringlist_t* curr_id = user_id_list;
    1.38 -    
    1.39 -    while (curr_id) {
    1.40 -        status = set_trust(session, curr_id->value, fpr, comm_type);
    1.41 -        if (status != PEP_STATUS_OK) {
    1.42 -            free_stringlist(user_id_list);
    1.43 -            return status;
    1.44 -        }
    1.45 -        curr_id = curr_id->next;
    1.46 -    }
    1.47 -    
    1.48 -    return PEP_STATUS_OK;
    1.49 -}
    1.50 -
    1.51 -PEP_STATUS remove_key_as_id_default(PEP_SESSION session, 
    1.52 -                                           const char* fpr)
    1.53 -{
    1.54 -    identity_list* affected_ids = NULL;
    1.55 -    
    1.56 -    PEP_STATUS status = get_identities_by_fpr(session, fpr, &affected_ids);
    1.57 -    
    1.58 -    if (status != PEP_STATUS_OK) {
    1.59 -        free_identity_list(affected_ids);
    1.60 -        return status;
    1.61 -    }
    1.62 -    if (!affected_ids)
    1.63 -        return PEP_STATUS_OK; // it's fine if none are found;
    1.64 -        
    1.65 -    identity_list* curr_identity = affected_ids;
    1.66 -    
    1.67 -    status = PEP_STATUS_OK;
    1.68 -    
    1.69 -    while (curr_identity) {
    1.70 -        free(curr_identity->ident->fpr);
    1.71 -        curr_identity->ident->fpr = (char*)calloc(1, sizeof(char)); // ""
    1.72 -        status = set_identity(session, curr_identity->ident);
    1.73 -        if (status != PEP_STATUS_OK)
    1.74 -            goto the_end;
    1.75 -        curr_identity = curr_identity->next;
    1.76 -    }
    1.77 -    
    1.78 -    
    1.79 -the_end:    
    1.80 -    free_identity_list(affected_ids);
    1.81 -    return status;
    1.82 -}