double check if this is an own key sync
authorVolker Birk <vb@pep-project.org>
Tue, 30 Apr 2019 22:58:32 +0200
branchsync
changeset 35935085ee740dda
parent 3592 34410422e806
child 3594 7f2ef2823948
double check if this is an own key
sync/cond_act_sync.yml2
sync/gen_statemachine.ysl2
     1.1 --- a/sync/cond_act_sync.yml2	Tue Apr 30 22:38:52 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Tue Apr 30 22:58:32 2019 +0200
     1.3 @@ -153,8 +153,6 @@
     1.4  ||
     1.5      memset(session->sync_state.keysync.negotiation.buf, 0,
     1.6              session->sync_state.keysync.negotiation.size);
     1.7 -    free(session->own_sync_state.signature_fpr);
     1.8 -    session->own_sync_state.signature_fpr = NULL;
     1.9  ||
    1.10  
    1.11  action storeTransaction {
     2.1 --- a/sync/gen_statemachine.ysl2	Tue Apr 30 22:38:52 2019 +0200
     2.2 +++ b/sync/gen_statemachine.ysl2	Tue Apr 30 22:58:32 2019 +0200
     2.3 @@ -349,6 +349,7 @@
     2.4  
     2.5                  «@name»_PR fsm = msg->present;
     2.6                  int event = 0;
     2.7 +                bool is_own_key = false;
     2.8  
     2.9                  switch (fsm) {
    2.10                      `` apply "fsm", 2, mode=signal_message
    2.11 @@ -554,7 +555,7 @@
    2.12                                  }
    2.13                                  free_identity(ident);
    2.14                              }
    2.15 -
    2.16 +                            
    2.17                              status = base_prepare_message(
    2.18                                      session,
    2.19                                      li->ident,
    2.20 @@ -870,6 +871,13 @@
    2.21                          status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    2.22                          goto the_end;
    2.23                      }
    2.24 +                    status = own_key_is_listed(session, signature_fpr, &is_own_key);
    2.25 +                    if (status)
    2.26 +                        goto the_end;
    2.27 +                    if (!is_own_key) {
    2.28 +                        status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    2.29 +                        goto the_end;
    2.30 +                    }
    2.31                      event = «@name»;
    2.32                      break;
    2.33