ENGINE-174: merging ratings stuff into bug branch to close temp branch ENGINE-174
authorKrista Grothoff <krista@pep-project.org>
Tue, 28 Feb 2017 10:08:59 +0100
branchENGINE-174
changeset 161304ebdc275924
parent 1612 dd420da8d8a9
parent 1611 388b42ad1ead
child 1615 858298055d48
ENGINE-174: merging ratings stuff into bug branch to close temp branch
     1.1 --- a/src/keymanagement.c	Mon Feb 27 17:44:12 2017 +0100
     1.2 +++ b/src/keymanagement.c	Tue Feb 28 10:08:59 2017 +0100
     1.3 @@ -779,10 +779,10 @@
     1.4      assert(!EMPTYSTR(ident->address));
     1.5      assert(!EMPTYSTR(ident->user_id));
     1.6      assert(!EMPTYSTR(ident->fpr));
     1.7 -    assert(!ident->me);
     1.8 +//    assert(!ident->me);
     1.9  
    1.10      if (!ident || EMPTYSTR(ident->address) || EMPTYSTR(ident->user_id) ||
    1.11 -            EMPTYSTR(ident->fpr) || ident->me)
    1.12 +            EMPTYSTR(ident->fpr)) // || ident->me)
    1.13          return PEP_ILLEGAL_VALUE;
    1.14  
    1.15      status = update_identity(session, ident);
     2.1 --- a/src/message_api.c	Mon Feb 27 17:44:12 2017 +0100
     2.2 +++ b/src/message_api.c	Tue Feb 28 10:08:59 2017 +0100
     2.3 @@ -810,13 +810,14 @@
     2.4  
     2.5  static PEP_rating keylist_rating(PEP_SESSION session, stringlist_t *keylist)
     2.6  {
     2.7 -    PEP_rating rating = PEP_rating_reliable;
     2.8 +    PEP_rating rating = PEP_rating_undefined;
     2.9  
    2.10      assert(keylist && keylist->value);
    2.11      if (keylist == NULL || keylist->value == NULL)
    2.12          return PEP_rating_undefined;
    2.13  
    2.14      stringlist_t *_kl;
    2.15 +    bool first = true;
    2.16      for (_kl = keylist; _kl && _kl->value; _kl = _kl->next) {
    2.17          PEP_comm_type ct;
    2.18          PEP_STATUS status;
    2.19 @@ -825,8 +826,12 @@
    2.20           
    2.21          if (_rating_ <= PEP_rating_mistrust)
    2.22              return _rating_;
    2.23 -
    2.24 -        if (rating == PEP_rating_undefined)
    2.25 +            
    2.26 +        if (first) {
    2.27 +            rating = _rating_;
    2.28 +            first = false;
    2.29 +        }
    2.30 +        else if (rating == PEP_rating_undefined)
    2.31              rating = worst_rating(rating, _rating_);
    2.32  
    2.33          if (_rating_ >= PEP_rating_reliable) {
    2.34 @@ -835,7 +840,8 @@
    2.35                  return PEP_rating_undefined;
    2.36              if (ct == PEP_ct_unknown){
    2.37                  if (rating >= PEP_rating_reliable){
    2.38 -                    rating = worst_rating(rating, PEP_rating_reliable);
    2.39 +                    //rating = worst_rating(rating, PEP_rating_reliable);
    2.40 +                    rating = PEP_rating_reliable; /*KG - really???*/
    2.41                  }
    2.42              }
    2.43              else{
    2.44 @@ -1930,7 +1936,7 @@
    2.45                          goto enomem;
    2.46                      status = get_trust(session, _from);
    2.47                      if (_from->comm_type != PEP_ct_unknown)
    2.48 -                        *rating = _rating(_from->comm_type, PEP_rating_undefined);
    2.49 +                        *rating = worst_rating(*rating, _rating(_from->comm_type, PEP_rating_undefined));
    2.50                      free_identity(_from);
    2.51                      if (status == PEP_CANNOT_FIND_IDENTITY)
    2.52                         status = PEP_STATUS_OK;
     3.1 --- a/test/apple_mail_test.cc	Mon Feb 27 17:44:12 2017 +0100
     3.2 +++ b/test/apple_mail_test.cc	Tue Feb 28 10:08:59 2017 +0100
     3.3 @@ -57,15 +57,14 @@
     3.4      pEp_identity * me = new_identity("pep.test.recip@kgrothoff.org", NULL, PEP_OWN_USERID, "pEp Test Recipient");    
     3.5      me->me = true;    
     3.6      PEP_STATUS status = update_identity(session, me);
     3.7 -
     3.8 +    trust_personal_key(session, me);
     3.9 +    
    3.10      pEp_identity * you = new_identity("pep.test.apple@pep-project.org", NULL, "TOFU_pep.test.apple@pep-project.org", "pEp Test Recipient");    
    3.11      you->me = false;    
    3.12      status = update_identity(session, you);
    3.13  
    3.14      trust_personal_key(session, you);
    3.15      
    3.16 -    status = update_identity(session, you);
    3.17 -    
    3.18      message* msg_ptr = nullptr;
    3.19      message* dest_msg = nullptr;
    3.20      message* final_ptr = nullptr;