diff options
author | Martin Willi <martin@strongswan.org> | 2005-12-05 16:09:42 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2005-12-05 16:09:42 +0000 |
commit | ba425b87dd0aee3f03df39a5f778f8cec0f3ec7a (patch) | |
tree | d1f5617b287f97c0ac860f3cfe325a6325dda391 /Source/charon/utils/identification.c | |
parent | e70c7feb028e20913af092fbe204ec648bbeda65 (diff) | |
download | strongswan-ba425b87dd0aee3f03df39a5f778f8cec0f3ec7a.tar.bz2 strongswan-ba425b87dd0aee3f03df39a5f778f8cec0f3ec7a.tar.xz |
- kernel interface hacks, works partially
- interface must be redefined
Diffstat (limited to 'Source/charon/utils/identification.c')
-rw-r--r-- | Source/charon/utils/identification.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/charon/utils/identification.c b/Source/charon/utils/identification.c index 50826cb3e..2e594dd7f 100644 --- a/Source/charon/utils/identification.c +++ b/Source/charon/utils/identification.c @@ -191,6 +191,7 @@ identification_t *identification_create_from_string(id_type_t type, char *string */ identification_t *identification_create_from_encoding(id_type_t type, chunk_t encoded) { + char *string; private_identification_t *this = identification_create(); this->encoded = allocator_clone_chunk(encoded); @@ -200,48 +201,48 @@ identification_t *identification_create_from_encoding(id_type_t type, chunk_t en { case ID_IPV4_ADDR: { - char *tmp; - tmp = inet_ntoa(*((struct in_addr*)(encoded.ptr))); - /* build string, must be cloned */ - this->string = allocator_alloc(strlen(tmp)+1); - strcpy(this->string, tmp); + string = inet_ntoa(*((struct in_addr*)(encoded.ptr))); break; } case ID_IPV6_ADDR: { - this->string = "[ID_IPV6_ADDR]"; + string = "[ID_IPV6_ADDR]"; break; } case ID_FQDN: { - this->string = "[ID_FQDN]"; + string = "[ID_FQDN]"; break; } case ID_RFC822_ADDR: { - this->string = "[ID_RFC822_ADDR]"; + string = "[ID_RFC822_ADDR]"; break; } case ID_DER_ASN1_DN: { - this->string = "[ID_DER_ASN1_DN]"; + string = "[ID_DER_ASN1_DN]"; break; } case ID_DER_ASN1_GN: { - this->string = "[ID_DER_ASN1_GN]"; + string = "[ID_DER_ASN1_GN]"; break; } case ID_KEY_ID: { - this->string = "[ID_KEY_ID]"; + string = "[ID_KEY_ID]"; break; } default: { - this->string = "[unknown id_type_t]"; + string = "[unknown id_type_t]"; } - } + } + + /* build string, must be cloned */ + this->string = allocator_alloc(strlen(string)+1); + strcpy(this->string, string); return &(this->public); } |