diff options
author | Martin Willi <martin@strongswan.org> | 2009-08-12 15:34:14 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-08-26 11:23:49 +0200 |
commit | 4d15129160c71cf36c931b17e02c6a047609fa33 (patch) | |
tree | 3eee1ffbfb72e180e605f31211b26ec996d799eb | |
parent | 280469923d931cfcdefee0e2097a0991713454e8 (diff) | |
download | strongswan-4d15129160c71cf36c931b17e02c6a047609fa33.tar.bz2 strongswan-4d15129160c71cf36c931b17e02c6a047609fa33.tar.xz |
pass along X509 flags when loading PEM encoded data
-rw-r--r-- | src/libstrongswan/plugins/pem/pem_builder.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index dd335cca3..72cc8a301 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -58,6 +58,8 @@ struct private_builder_t { chunk_t (*cb)(void *data, int try); /** user data to callback */ void *data; + /** X509 flags to pass along */ + int flags; }; /** @@ -296,7 +298,7 @@ status_t pem_to_bin(chunk_t *blob, private_builder_t *this, bool *pgp) } else { - DBG1(" encryption algorithm '%.s' not supported", + DBG1(" encryption algorithm '%.*s' not supported", dek.len, dek.ptr); return NOT_SUPPORTED; } @@ -391,7 +393,8 @@ static void *build_from_blob(private_builder_t *this, chunk_t blob) } cred = lib->creds->create(lib->creds, this->type, this->subtype, pgp ? BUILD_BLOB_PGP : BUILD_BLOB_ASN1_DER, blob, - BUILD_END); + this->flags ? BUILD_X509_FLAG : BUILD_END, + this->flags, BUILD_END); chunk_clear(&blob); return cred; } @@ -501,6 +504,11 @@ static void add(private_builder_t *this, builder_part_t part, ...) this->data = va_arg(args, void*); va_end(args); break; + case BUILD_X509_FLAG: + va_start(args, part); + this->flags = va_arg(args, int); + va_end(args); + break; default: builder_cancel(&this->public); break; @@ -524,6 +532,7 @@ static builder_t *pem_builder(credential_type_t type, int subtype) this->passphrase = chunk_empty; this->cb = NULL; this->data = NULL; + this->flags = 0; return &this->public; } |