update_identity: ignore input fpr. _myself: ignore input fpr *earlier*; fix myself header comment

By fdik, attempting to fix QA-176, QA-177, QA-180 and at least implementing
correct behaviour.

There is a change perfectly analogous to this on Release_2.1 (with a mistake in
the commit message: the header comment change is about myself, not about
_update_identity).
pull/70/head
positron 1 year ago
parent 874ec3f126
commit 5c5078c509

@ -636,6 +636,11 @@ DYNAMIC_API PEP_STATUS update_identity(
if (!(session && identity && !EMPTYSTR(identity->address)))
return PEP_ILLEGAL_VALUE;
/* The fpr field is output only: in case it was set, unset it before doing
anything else. */
free(identity->fpr);
identity->fpr = NULL;
//
// Record some information about the input identity so that we don't keep
// evaluating it
@ -1019,6 +1024,13 @@ PEP_STATUS _myself(PEP_SESSION session,
if (!session || !identity || EMPTYSTR(identity->address))
return PEP_ILLEGAL_VALUE;
// ignore input fpr
if (identity->fpr) {
free(identity->fpr);
identity->fpr = NULL;
}
// this leads to crashes otherwise
if (EMPTYSTR(identity->user_id)) {
@ -1118,13 +1130,6 @@ PEP_STATUS _myself(PEP_SESSION session,
}
}
// ignore input fpr
if (identity->fpr) {
free(identity->fpr);
identity->fpr = NULL;
}
// check stored identity
if (stored_identity) {
if (!EMPTYSTR(stored_identity->fpr)) {

@ -93,10 +93,8 @@ DYNAMIC_API PEP_STATUS update_identity(
* @param[in] session session to use
* @param[in,out] identity identity of local user
* both .address and .user_id must be set.
* if .fpr is set, an attempt will be made to make
* that the default key for this identity after key
* validation
* if .fpr is not set, key retrieval is performed
* The .fpr field is output-only, and any value set at
* input is ignored; it is set by key retrieval.
* If .username is set, it will be used to set or patch
* the username record for this identity.
*

Loading…
Cancel
Save