summaryrefslogtreecommitdiff
path: root/src/libcharon/encoding
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-08-09 08:09:54 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-08-09 08:09:54 +0000
commitb8064f4099997a9e2179f3ad4ace605f5ccac3a1 (patch)
tree81778e976b476374c48b4fe83d084b986b890421 /src/libcharon/encoding
parent1ac70afcc1f7d6d2738a34308810719b0976d29f (diff)
downloadvyos-strongswan-b8064f4099997a9e2179f3ad4ace605f5ccac3a1.tar.gz
vyos-strongswan-b8064f4099997a9e2179f3ad4ace605f5ccac3a1.zip
[svn-upgrade] new version strongswan (4.4.1)
Diffstat (limited to 'src/libcharon/encoding')
-rw-r--r--src/libcharon/encoding/message.c34
-rw-r--r--src/libcharon/encoding/payloads/cert_payload.c7
2 files changed, 40 insertions, 1 deletions
diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c
index acfc0fd44..ee49a6686 100644
--- a/src/libcharon/encoding/message.c
+++ b/src/libcharon/encoding/message.c
@@ -31,6 +31,7 @@
#include <encoding/payloads/payload.h>
#include <encoding/payloads/encryption_payload.h>
#include <encoding/payloads/unknown_payload.h>
+#include <encoding/payloads/cp_payload.h>
/**
* Max number of notify payloads per IKEv2 Message
@@ -975,6 +976,39 @@ static char* get_string(private_message_t *this, char *buf, int len)
pos += written;
len -= written;
}
+ if (payload->get_type(payload) == CONFIGURATION)
+ {
+ cp_payload_t *cp = (cp_payload_t*)payload;
+ enumerator_t *attributes;
+ configuration_attribute_t *attribute;
+ bool first = TRUE;
+
+ attributes = cp->create_attribute_enumerator(cp);
+ while (attributes->enumerate(attributes, &attribute))
+ {
+ written = snprintf(pos, len, "%s%N", first ? "(" : " ",
+ configuration_attribute_type_short_names,
+ attribute->get_type(attribute));
+ if (written >= len || written < 0)
+ {
+ return buf;
+ }
+ pos += written;
+ len -= written;
+ first = FALSE;
+ }
+ attributes->destroy(attributes);
+ if (!first)
+ {
+ written = snprintf(pos, len, ")");
+ if (written >= len || written < 0)
+ {
+ return buf;
+ }
+ pos += written;
+ len -= written;
+ }
+ }
}
enumerator->destroy(enumerator);
diff --git a/src/libcharon/encoding/payloads/cert_payload.c b/src/libcharon/encoding/payloads/cert_payload.c
index 6dd3141f0..80239f654 100644
--- a/src/libcharon/encoding/payloads/cert_payload.c
+++ b/src/libcharon/encoding/payloads/cert_payload.c
@@ -320,7 +320,12 @@ cert_payload_t *cert_payload_create_from_cert(certificate_t *cert)
free(this);
return NULL;
}
- this->data = cert->get_encoding(cert);
+ if (!cert->get_encoding(cert, CERT_ASN1_DER, &this->data))
+ {
+ DBG1(DBG_ENC, "encoding certificate for cert payload failed");
+ free(this);
+ return NULL;
+ }
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
return &this->public;
}