Prevent assertion when username is not given for own identity, and doing keygen
authorEdouard Tisserant <edouard@pep-project.org>
Wed, 14 Dec 2016 17:08:28 +0100
changeset 148816829200236d
parent 1482 dae999ee1a41
child 1489 e1a35c0169c0
Prevent assertion when username is not given for own identity, and doing keygen
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Tue Dec 13 13:11:06 2016 +0100
     1.2 +++ b/src/keymanagement.c	Wed Dec 14 17:08:28 2016 +0100
     1.3 @@ -438,6 +438,15 @@
     1.4              return PEP_OUT_OF_MEMORY;
     1.5      }
     1.6  
     1.7 +    if (EMPTYSTR(identity->username))
     1.8 +    {
     1.9 +        free(identity->username);
    1.10 +        identity->username = strdup("anonymous");
    1.11 +        assert(identity->username);
    1.12 +        if (identity->username == NULL)
    1.13 +            return PEP_OUT_OF_MEMORY;
    1.14 +    }
    1.15 +
    1.16      DEBUG_LOG("myself", "debug", identity->address);
    1.17   
    1.18      status = get_identity(session,