src/map_asn1.c
changeset 640 65840a4ac45a
parent 639 0a2411d3d55a
child 645 0bb373719dce
     1.1 --- a/src/map_asn1.c	Tue May 17 09:07:50 2016 +0200
     1.2 +++ b/src/map_asn1.c	Tue May 17 12:55:55 2016 +0200
     1.3 @@ -48,7 +48,7 @@
     1.4          if (!result->lang)
     1.5              goto enomem;
     1.6      }
     1.7 -    
     1.8 +
     1.9      return result;
    1.10  
    1.11  enomem:
    1.12 @@ -62,6 +62,49 @@
    1.13      if (!result)
    1.14          return NULL;
    1.15  
    1.16 +    if (ident->address) {
    1.17 +        result->address = strndup((char *) ident->address->buf,
    1.18 +                ident->address->size);
    1.19 +        assert(result->address);
    1.20 +        if (!result->address)
    1.21 +            goto enomem;
    1.22 +    }
    1.23 +
    1.24 +    result->fpr = strndup((char *) ident->fpr.buf, ident->fpr.size);
    1.25 +    assert(result->fpr);
    1.26 +    if (!result->fpr)
    1.27 +        goto enomem;
    1.28 +
    1.29      return result;
    1.30 +
    1.31 +    if (ident->user_id) {
    1.32 +        result->user_id = strndup((char *) ident->user_id->buf,
    1.33 +                ident->user_id->size);
    1.34 +        assert(result->user_id);
    1.35 +        if (!result->user_id)
    1.36 +            goto enomem;
    1.37 +    }
    1.38 +
    1.39 +    if (ident->username) {
    1.40 +        result->username = strndup((char *) ident->username->buf,
    1.41 +                ident->username->size);
    1.42 +        assert(result->username);
    1.43 +        if (!result->username)
    1.44 +            goto enomem;
    1.45 +    }
    1.46 +
    1.47 +    if (ident->comm_type)
    1.48 +        result->comm_type = (PEP_comm_type) *ident->comm_type;
    1.49 +
    1.50 +    if (ident->lang) {
    1.51 +        result->lang[0] = ident->lang->buf[0];
    1.52 +        result->lang[1] = ident->lang->buf[1];
    1.53 +    }
    1.54 +
    1.55 +    return result;
    1.56 +
    1.57 +enomem:
    1.58 +    free_identity(result);
    1.59 +    return NULL;
    1.60  }
    1.61