Backed out changeset 7fe33611a1bb. "work around nasty side effects of brand new update_identity with_myself parameter"
authorEdouard Tisserant <edouard@pep-project.org>
Sat, 12 Nov 2016 00:28:28 +0100
changeset 13865547895c7a3f
parent 1385 5f54184b1e94
child 1387 cc339b22d690
Backed out changeset 7fe33611a1bb. "work around nasty side effects of brand new update_identity with_myself parameter"
src/sync_impl.c
     1.1 --- a/src/sync_impl.c	Sat Nov 12 00:24:14 2016 +0100
     1.2 +++ b/src/sync_impl.c	Sat Nov 12 00:28:28 2016 +0100
     1.3 @@ -567,8 +567,8 @@
     1.4      me = NULL;
     1.5  
     1.6      if (encrypted) {
     1.7 -        bool attach_own_private_keys = false;
     1.8 -        if (msg->payload.present == DeviceGroup_Protocol__payload_PR_groupKeys) {
     1.9 +        if (msg->payload.present == DeviceGroup_Protocol__payload_PR_groupKeys || 
    1.10 +            msg->payload.present == DeviceGroup_Protocol__payload_PR_groupUpdate) {
    1.11              PEP_rating rating = PEP_rating_undefined;
    1.12              status = outgoing_message_rating(session, _message, &rating);
    1.13              if (status != PEP_STATUS_OK)
    1.14 @@ -577,45 +577,7 @@
    1.15                  status = PEP_SYNC_NO_TRUST;
    1.16                  goto error;
    1.17              }
    1.18 -            attach_own_private_keys = true;
    1.19 -        }
    1.20 -
    1.21 -        // outgoing_message_rating doesn't work for msg->to being own identity 
    1.22 -        // we check that from and to are the same, and with good comm_type
    1.23 -        if (msg->payload.present == DeviceGroup_Protocol__payload_PR_groupUpdate) {
    1.24 -            if(_message->to != NULL && _message->to->ident != NULL && 
    1.25 -               _message->to->next == NULL && _message->from != NULL &&
    1.26 -               strcmp(_message->to->ident->address, _message->from->address) == 0 && 
    1.27 -               strcmp(_message->to->ident->user_id, PEP_OWN_USERID) == 0 && 
    1.28 -               strcmp(_message->from->user_id, PEP_OWN_USERID) == 0) 
    1.29 -            {
    1.30 -                pEp_identity *_identity = NULL;
    1.31 -                status = get_identity(session,
    1.32 -                                      _message->to->ident->address,
    1.33 -                                      _message->to->ident->user_id,
    1.34 -                                      &_identity);
    1.35 -                
    1.36 -                if (status != PEP_STATUS_OK)
    1.37 -                    goto error;
    1.38 -
    1.39 -                PEP_comm_type _comm_type = _identity->comm_type;
    1.40 -                free_identity(_identity);
    1.41 -
    1.42 -                if(_comm_type != PEP_ct_pEp)
    1.43 -                {
    1.44 -                    status = PEP_SYNC_NO_TRUST;
    1.45 -                    goto error;
    1.46 -                }
    1.47 -            }
    1.48 -            else 
    1.49 -            {
    1.50 -                status = PEP_ILLEGAL_VALUE;
    1.51 -                goto error;
    1.52 -            }
    1.53 -            attach_own_private_keys = true;
    1.54 -        }
    1.55 -
    1.56 -        if(attach_own_private_keys){
    1.57 +            
    1.58              stringlist_t *keylist = NULL;
    1.59              status = keys_retrieve_by_flag(session, PEP_kpf_own_key, &keylist);
    1.60              if (status != PEP_STATUS_OK)