ENGINE-522: removed all unqualified hard-coded instances of PEP_OWN_USERID (those that remain are for first-use instances where no extant own-id is in the DB, and any new own ids coming from the app after there use will be aliased to it, so they are ok)
1.1 --- a/src/keymanagement.c Wed Mar 20 15:26:06 2019 +0100
1.2 +++ b/src/keymanagement.c Wed Mar 27 15:34:17 2019 +0100
1.3 @@ -2020,6 +2020,7 @@
1.4 thing = _pgp_thing_next(thing);
1.5 switch (thing) {
1.6 case _pgp_fpr:
1.7 + // PEP_OWN_USERID is ok here because this is only run on first use!
1.8 identity = new_identity(NULL, NULL, PEP_OWN_USERID, NULL);
1.9 if (!identity)
1.10 status = PEP_OUT_OF_MEMORY;
2.1 --- a/src/message_api.c Wed Mar 20 15:26:06 2019 +0100
2.2 +++ b/src/message_api.c Wed Mar 27 15:34:17 2019 +0100
2.3 @@ -4234,10 +4234,21 @@
2.4 // Find own identity corresponding to given account address.
2.5 // In that case we want default key attached to own identity
2.6 pEp_identity *stored_identity = NULL;
2.7 +
2.8 + char* own_id = NULL;
2.9 + status = get_default_own_userid(session, &own_id);
2.10 +
2.11 + if (!(status == PEP_STATUS_OK && own_id)) {
2.12 + free(own_id);
2.13 + return PEP_CANNOT_FIND_IDENTITY;
2.14 + }
2.15 +
2.16 status = get_identity(session,
2.17 received_by->address,
2.18 - PEP_OWN_USERID,
2.19 + own_id,
2.20 &stored_identity);
2.21 + free(own_id);
2.22 + own_id = NULL;
2.23
2.24 if (status != PEP_STATUS_OK) {
2.25 free_identity(stored_identity);