ENGINE-673, hopefully - ownership problem in saveGroupKeys.
1.1 --- a/sync/cond_act_sync.yml2 Tue Nov 26 14:51:42 2019 +0100
1.2 +++ b/sync/cond_act_sync.yml2 Thu Nov 28 15:48:41 2019 +0100
1.3 @@ -236,7 +236,7 @@
1.4 assert(session->notifyHandshake);
1.5 if (!session->notifyHandshake)
1.6 return PEP_SYNC_NO_NOTIFY_CALLBACK;
1.7 -
1.8 +
1.9 ||
1.10 choose {
1.11 when "$type = 'SYNC_NOTIFY_INIT_ADD_OUR_DEVICE' or $type = 'SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE' or $type = 'SYNC_NOTIFY_INIT_FORM_GROUP'"
1.12 @@ -252,7 +252,7 @@
1.13 if (status)
1.14 return status;
1.15 assert(strcmp(me->fpr, session->sync_state.comm_partner.sender_fpr) != 0);
1.16 -
1.17 +
1.18 assert(me->fpr && me->fpr[0]);
1.19 if (!(me->fpr && me->fpr[0])) {
1.20 free_identity(me);
1.21 @@ -373,7 +373,7 @@
1.22 free(user_id);
1.23 return status;
1.24 }
1.25 -
1.26 +
1.27 identity_list *oil = session->sync_state.own.identities;
1.28
1.29 // BUG: this should be a transaction and been rolled back completely on error
1.30 @@ -418,7 +418,9 @@
1.31 }
1.32
1.33 free(user_id);
1.34 - free_identity_list(il);
1.35 + // NO! This contains the references we add above and belongs to
1.36 + // session->sync_state.own.identities!
1.37 + // free_identity_list(il);
1.38 ||
1.39
1.40 action ownKeysAreDefaultKeys
1.41 @@ -441,7 +443,7 @@
1.42 // set flag for all keys
1.43 for (identity_list *il = session->sync_state.own.identities; il && il->ident ; il = il->next) {
1.44 if (!(il->ident->flags && PEP_idf_not_for_sync)) {
1.45 -
1.46 +
1.47 status = set_identity_flags(session, il->ident, PEP_idf_devicegroup);
1.48 if (status)
1.49 return status;
1.50 @@ -473,7 +475,7 @@
1.51 free(user_id);
1.52 return PEP_OUT_OF_MEMORY;
1.53 }
1.54 -
1.55 +
1.56 const char *own_key = _il->ident->fpr;
1.57 _il->ident->fpr = NULL;
1.58 status = set_own_key(session, _il->ident, own_key);