Merge with sync sequoia_windows
authorThomas
Fri, 31 May 2019 07:46:09 +0200
branchsequoia_windows
changeset 37925fc0cce01f07
parent 3787 9c8b6dd07b92
parent 3791 f32545eaeefc
child 3793 935bbb4282b3
Merge with sync
     1.1 --- a/sync/cond_act_sync.yml2	Thu May 30 13:15:16 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Fri May 31 07:46:09 2019 +0200
     1.3 @@ -239,22 +239,7 @@
     1.4       
     1.5      ||
     1.6      choose {
     1.7 -    when "$type = 'SYNC_NOTIFY_TIMEOUT' or $type = 'SYNC_NOTIFY_SOLE' or $type = 'SYNC_NOTIFY_IN_GROUP'"
     1.8 -    ||
     1.9 -        pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.10 -        pEp_identity *partner = new_identity(NULL, NULL, NULL, NULL);
    1.11 -        assert(me && partner);
    1.12 -        if (!(me && partner)) {
    1.13 -            free_identity(me);
    1.14 -            free_identity(partner);
    1.15 -            return PEP_OUT_OF_MEMORY;
    1.16 -        }
    1.17 -
    1.18 -        PEP_STATUS status = session->notifyHandshake(me, partner, «$type»);
    1.19 -        if (status)
    1.20 -            return status;
    1.21 -    ||
    1.22 -    otherwise
    1.23 +    when "$type = 'SYNC_NOTIFY_INIT_ADD_OUR_DEVICE' or $type = 'SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE' or $type = 'SYNC_NOTIFY_INIT_FORM_GROUP'"
    1.24      ||
    1.25          assert(session->sync_state.transport.from);
    1.26          if (!session->sync_state.transport.from)
    1.27 @@ -266,7 +251,8 @@
    1.28          assert(status == PEP_STATUS_OK);
    1.29          if (status)
    1.30              return status;
    1.31 -
    1.32 +        assert(strcmp(me->fpr, session->sync_state.comm_partner.sender_fpr) != 0);
    1.33 +        
    1.34          assert(me->fpr && me->fpr[0]);
    1.35          if (!(me->fpr && me->fpr[0])) {
    1.36              free_identity(me);
    1.37 @@ -283,6 +269,7 @@
    1.38          if (session->sync_state.comm_partner.sender_fpr) {
    1.39              free(partner->fpr);
    1.40              partner->fpr = strdup(session->sync_state.comm_partner.sender_fpr);
    1.41 +            assert(partner->fpr);
    1.42              if (!partner->fpr) {
    1.43                  free_identity(me);
    1.44                  free_identity(partner);
    1.45 @@ -299,10 +286,26 @@
    1.46              return PEP_OUT_OF_MEMORY;
    1.47          }
    1.48  
    1.49 +        assert(strcmp(me->fpr, partner->fpr) != 0);
    1.50          status = session->notifyHandshake(me, partner, «$type»);
    1.51          if (status)
    1.52              return status;
    1.53      ||
    1.54 +    otherwise
    1.55 +    ||
    1.56 +        pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.57 +        pEp_identity *partner = new_identity(NULL, NULL, NULL, NULL);
    1.58 +        assert(me && partner);
    1.59 +        if (!(me && partner)) {
    1.60 +            free_identity(me);
    1.61 +            free_identity(partner);
    1.62 +            return PEP_OUT_OF_MEMORY;
    1.63 +        }
    1.64 +
    1.65 +        PEP_STATUS status = session->notifyHandshake(me, partner, «$type»);
    1.66 +        if (status)
    1.67 +            return status;
    1.68 +    ||
    1.69      }
    1.70  }
    1.71  
    1.72 @@ -355,6 +358,11 @@
    1.73  
    1.74  action saveGroupKeys
    1.75  ||
    1.76 +    char *user_id = NULL;
    1.77 +    PEP_STATUS status = get_default_own_userid(session, &user_id);
    1.78 +    if (status)
    1.79 +        return status;
    1.80 +
    1.81      identity_list *il = IdentityList_to_identity_list(&session->sync_state.keysync.ownIdentities, NULL);
    1.82      if (!il)
    1.83          return PEP_OUT_OF_MEMORY;
    1.84 @@ -366,14 +374,7 @@
    1.85          pEp_identity *ident = _il->ident;
    1.86          bool is_own_already = false;
    1.87  
    1.88 -        PEP_STATUS status = is_own_address(session, ident->address, &is_own_already);
    1.89 -        if (status) {
    1.90 -            free_identity_list(il);
    1.91 -            return status;
    1.92 -        }
    1.93 -
    1.94 -        char *user_id = NULL;
    1.95 -        status = get_default_own_userid(session, &user_id);
    1.96 +        status = is_own_address(session, ident->address, &is_own_already);
    1.97          if (status) {
    1.98              free_identity_list(il);
    1.99              return status;
     2.1 --- a/sync/sync.fsm	Thu May 30 13:15:16 2019 +0200
     2.2 +++ b/sync/sync.fsm	Fri May 31 07:46:09 2019 +0200
     2.3 @@ -61,7 +61,6 @@
     2.4                          // this is our own NegotiationRequest; ignore
     2.5                      }
     2.6                      else {
     2.7 -                        // first is receiving NegotiationRequest
     2.8                          do storeNegotiation;
     2.9                          // first is sending NegotiationOpen
    2.10                          send NegotiationOpen;
    2.11 @@ -75,6 +74,7 @@
    2.12  
    2.13              on NegotiationOpen if sameNegotiationAndPartner {
    2.14                  // second is receiving NegotiationOpen
    2.15 +                do storeNegotiation;
    2.16                  go HandshakingNewSecond;
    2.17              }
    2.18          }
    2.19 @@ -235,7 +235,6 @@
    2.20  
    2.21              on OwnKeysSecond {
    2.22                  do saveGroupKeys;
    2.23 -
    2.24                  do receivedKeysAreGroupKeys;
    2.25                  do showGroupCreated;
    2.26                  go Grouped;
    2.27 @@ -278,8 +277,10 @@
    2.28                  do useOwnChallenge;
    2.29              }
    2.30  
    2.31 -            on NegotiationOpen if sameNegotiationAndPartner
    2.32 +            on NegotiationOpen if sameNegotiationAndPartner {
    2.33 +                do storeNegotiation;
    2.34                  go HandshakingGrouped;
    2.35 +            }
    2.36  
    2.37              on GroupTrustThisKey {
    2.38                  do trustThisKey;
    2.39 @@ -318,9 +319,6 @@
    2.40                  send CommitAccept;
    2.41                  go HandshakingJoinPhase1;
    2.42              }
    2.43 -
    2.44 -            on CommitAcceptForGroup if sameNegotiationAndPartner
    2.45 -                go HandshakingJoinPhase2;
    2.46          }
    2.47  
    2.48          state HandshakingJoinPhase1 {
    2.49 @@ -427,6 +425,7 @@
    2.50                  go Grouped;
    2.51  
    2.52              on CommitAccept if sameNegotiationAndPartner {
    2.53 +                do prepareOwnKeys;
    2.54                  send GroupKeys;
    2.55                  go Grouped;
    2.56              }
    2.57 @@ -435,12 +434,6 @@
    2.58                  do trustThisKey;
    2.59              }
    2.60  
    2.61 -            on CommitAcceptForGroup {
    2.62 -                do showDeviceAdded;
    2.63 -                if sameNegotiationAndPartner
    2.64 -                    go Grouped;
    2.65 -            }
    2.66 -
    2.67              on GroupKeys
    2.68                  do saveGroupKeys;
    2.69          }
    2.70 @@ -459,6 +452,7 @@
    2.71              on Accept {
    2.72                  do trustThisKey;
    2.73                  send GroupTrustThisKey;
    2.74 +                do prepareOwnKeys;
    2.75                  send GroupKeys;
    2.76                  go Grouped;
    2.77              }
    2.78 @@ -467,14 +461,6 @@
    2.79                  do trustThisKey;
    2.80              }
    2.81  
    2.82 -            on CommitAcceptForGroup {
    2.83 -                do showDeviceAdded;
    2.84 -                if sameNegotiationAndPartner {
    2.85 -                    do hideHandshakeDialog;
    2.86 -                    go Grouped;
    2.87 -                }
    2.88 -            }
    2.89 -
    2.90              on GroupKeys
    2.91                  do saveGroupKeys;
    2.92          }