add_key_notification
Volker Birk 3 years ago
parent f9aca64aba
commit 72ee5f8f6f

@ -1898,13 +1898,13 @@ DYNAMIC_API PEP_STATUS set_own_key(
assert(!EMPTYSTR(me->user_id));
assert(!EMPTYSTR(me->username));
// deliver a copy
assert(me->fpr != fpr);
if (!session || !me || EMPTYSTR(fpr) || EMPTYSTR(me->address) ||
EMPTYSTR(me->user_id) || EMPTYSTR(me->username) || me->fpr == fpr)
EMPTYSTR(me->user_id) || EMPTYSTR(me->username))
return PEP_ILLEGAL_VALUE;
if (me->fpr == fpr)
me->fpr = NULL;
status = _myself(session, me, false, true, false);
// we do not need a valid key but dislike other errors
if (status != PEP_STATUS_OK && status != PEP_GET_KEY_FAILED && status != PEP_KEY_UNSUITABLE)

@ -399,13 +399,9 @@ action saveGroupKeys
}
identity_list *oil = session->sync_state.own.identities;
char *fpr = NULL;
// BUG: this should be a transaction and been rolled back completely on error
for (identity_list *_il = il; _il && _il->ident; _il = _il->next) {
if (fpr)
free(fpr);
bool found = false;
status = _have_identity_in(oil, _il->ident, &found);
if (status)
@ -414,20 +410,12 @@ action saveGroupKeys
if (!found) {
_il->ident->me = true;
fpr = strdup(_il->ident->fpr);
assert(fpr);
if (!fpr) {
status = PEP_OUT_OF_MEMORY;
break;
}
status = set_own_key(session, _il->ident, fpr);
status = set_own_key(session, _il->ident, _il->ident->fpr);
if (status)
break;
}
}
free(fpr);
free(user_id);
free_identity_list(il);
||
@ -475,19 +463,7 @@ action receivedKeysAreDefaultKeys
}
for (identity_list *_il = il; _il && _il->ident ; _il = _il->next) {
// replace partner's user_id with own user_id
free(_il->ident->user_id);
_il->ident->user_id = strdup(user_id);
assert(_il->ident->user_id);
if (!_il->ident->user_id) {
free_identity_list(il);
free(user_id);
return PEP_OUT_OF_MEMORY;
}
const char *own_key = _il->ident->fpr;
_il->ident->fpr = NULL;
status = set_own_key(session, _il->ident, own_key);
status = set_own_key(session, _il->ident, _il->ident->fpr);
if (status) {
free_identity_list(il);
free(user_id);

Loading…
Cancel
Save