aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/x509/x509_cert.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-05-15 18:15:55 +0200
committerMartin Willi <martin@strongswan.org>2009-05-18 10:42:16 +0200
commit24cd2ca6eeb5f16895569bfcfa629f985ea84e18 (patch)
treeff9172f618e1adb608b10e5d28bd46f9d6a4b96c /src/libstrongswan/plugins/x509/x509_cert.c
parent7736a4044892ccb91da0ba1c59686dfcbc11bb68 (diff)
downloadstrongswan-24cd2ca6eeb5f16895569bfcfa629f985ea84e18.tar.bz2
strongswan-24cd2ca6eeb5f16895569bfcfa629f985ea84e18.tar.xz
moved very stroke specific x509 flag handling out of core library
Diffstat (limited to 'src/libstrongswan/plugins/x509/x509_cert.c')
-rw-r--r--src/libstrongswan/plugins/x509/x509_cert.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/libstrongswan/plugins/x509/x509_cert.c b/src/libstrongswan/plugins/x509/x509_cert.c
index 860006f0b..746254486 100644
--- a/src/libstrongswan/plugins/x509/x509_cert.c
+++ b/src/libstrongswan/plugins/x509/x509_cert.c
@@ -1350,33 +1350,22 @@ static bool generate(private_builder_t *this)
static private_x509_cert_t *build(private_builder_t *this)
{
private_x509_cert_t *cert;
- x509_flag_t flags;
- if (this->cert && !this->cert->encoding.ptr)
+ if (this->cert)
{
- if (!this->sign_key || !this->cert ||
- !generate(this))
- {
- destroy(this->cert);
- free(this);
- return NULL;
+ this->cert->flags |= this->flags;
+ if (!this->cert->encoding.ptr)
+ { /* generate a new certificate */
+ if (!this->sign_key || !generate(this))
+ {
+ destroy(this->cert);
+ free(this);
+ return NULL;
+ }
}
}
cert = this->cert;
- flags = this->flags;
free(this);
- if (cert == NULL)
- {
- return NULL;
- }
-
- if ((flags & X509_CA) && !(cert->flags & X509_CA))
- {
- DBG1(" ca certificate must have ca basic constraint set, discarded");
- destroy(cert);
- return NULL;
- }
- cert->flags |= flags;
return cert;
}