fix ENGINE-964: it turns out that the new behaviour was already intended, but there was a bug

myself behaved differently when value of identity->username was "", rather than NULL.
ENGINE-964
positron 1 year ago
parent d3328ec683
commit 268d987365

@ -1028,9 +1028,10 @@ PEP_STATUS _myself(PEP_SESSION session,
return PEP_OUT_OF_MEMORY;
}
// Cache the input username, if there is one and it's not read_only
// Cache the input username, if there is one and it's not read_only; NULL
// otherwise. cached_input_username is never a pointer to an empty string.
char* cached_input_username = NULL;
if (!read_only && identity->username) {
if (!read_only && ! EMPTYSTR(identity->username)) {
cached_input_username = strdup(identity->username);
if (!cached_input_username)
return PEP_OUT_OF_MEMORY;

@ -118,6 +118,13 @@ DYNAMIC_API PEP_STATUS update_identity(
* if you need to do this asynchronous, you need to return an identity
* with retrieve_next_identity() where pEp_identity.me is true
*
* @warning If the identity has no .username but the person with the same
* address has one, copy it into the identity's .username.
* Applications should in general *not* rely on this feature, which
* can break privacy by revealing a username to a third party. It is
* provided for compatibility in the case of email, where a header
* such as "From: johndoe@example.com" is accepted even if no longer
* technically standard.
*/
DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity);

Loading…
Cancel
Save