From c49a6aecb79658f6e362d008d553444ddf87900c Mon Sep 17 00:00:00 2001 From: Krista Grothoff Date: Wed, 5 Oct 2016 14:56:54 +0200 Subject: [PATCH] ENGINE-107: added ct and rating states for having no key --- src/keymanagement.c | 6 +++++- src/message_api.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/keymanagement.c b/src/keymanagement.c index e0395cd7..eca4a1ee 100644 --- a/src/keymanagement.c +++ b/src/keymanagement.c @@ -226,7 +226,11 @@ DYNAMIC_API PEP_STATUS update_identity( } } } - + else { + /* Set comm_type accordingly */ + temp_id->comm_type = PEP_ct_key_not_found; + } + if (EMPTYSTR(temp_id->username)) { free(temp_id->username); temp_id->username = strdup(stored_identity->username); diff --git a/src/message_api.c b/src/message_api.c index 418f7cdb..3b9b8d58 100644 --- a/src/message_api.c +++ b/src/message_api.c @@ -667,7 +667,10 @@ static PEP_rating _rating(PEP_comm_type ct, PEP_rating rating) { if (ct == PEP_ct_unknown) return PEP_rating_undefined; - + + else if (ct == PEP_ct_key_not_found) + return PEP_rating_have_no_key; + else if (ct == PEP_ct_compromized) return PEP_rating_under_attack; @@ -1878,7 +1881,7 @@ DYNAMIC_API PEP_STATUS get_binary_path(PEP_cryptotech tech, const char **path) DYNAMIC_API PEP_color color_from_rating(PEP_rating rating) { - if (rating == PEP_rating_b0rken) + if (rating == PEP_rating_b0rken || rating == PEP_rating_have_no_key) return PEP_color_no_color; if (rating < PEP_rating_undefined)