From ba425b87dd0aee3f03df39a5f778f8cec0f3ec7a Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 5 Dec 2005 16:09:42 +0000 Subject: - kernel interface hacks, works partially - interface must be redefined --- Source/charon/utils/identification.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'Source/charon/utils/identification.c') 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); } -- cgit v1.2.3