handle pluto specific certificates under CRED_CERTIFICATE, not as own credential kind

This commit is contained in:
Martin Willi
2009-08-26 11:23:49 +02:00
parent f11a78f10a
commit cbb62e8f4c
11 changed files with 40 additions and 43 deletions
+4 -2
View File
@@ -27,6 +27,7 @@
#include <asn1/asn1.h>
#include <asn1/asn1_parser.h>
#include <asn1/oid.h>
#include <credentials/certificates/certificate.h>
#include "ac.h"
#include "x509.h"
@@ -821,8 +822,9 @@ void load_acerts(void)
{
x509acert_t *ac;
ac = lib->creds->create(lib->creds, CRED_PLUTO_CERT, CRED_TYPE_AC,
BUILD_FROM_FILE, filelist[n]->d_name, BUILD_END);
ac = lib->creds->create(lib->creds, CRED_CERTIFICATE,
CERT_PLUTO_AC, BUILD_FROM_FILE, filelist[n]->d_name,
BUILD_END);
if (ac)
{
add_acert(ac);
+10 -5
View File
@@ -23,7 +23,8 @@
#include <freeswan.h>
#include "library.h"
#include <library.h>
#include <credentials/certificates/certificate.h>
#include "constants.h"
#include "defs.h"
@@ -206,13 +207,13 @@ static builder_t *builder(credential_type_t type, int subtype)
switch (subtype)
{
case CRED_TYPE_CERTIFICATE:
case CERT_PLUTO_CERT:
this->public.add = (void(*)(builder_t *this, builder_part_t part, ...))cert_add;
break;
case CRED_TYPE_AC:
case CERT_PLUTO_AC:
this->public.add = (void(*)(builder_t *this, builder_part_t part, ...))ac_add;
break;
case CRED_TYPE_CRL:
case CERT_PLUTO_CRL:
this->public.add = (void(*)(builder_t *this, builder_part_t part, ...))crl_add;
break;
default:
@@ -227,7 +228,11 @@ static builder_t *builder(credential_type_t type, int subtype)
void init_builder(void)
{
lib->creds->add_builder(lib->creds, CRED_PLUTO_CERT, 0,
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT,
(builder_constructor_t)builder);
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_AC,
(builder_constructor_t)builder);
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL,
(builder_constructor_t)builder);
}
-10
View File
@@ -16,16 +16,6 @@
#ifndef _BUILDER_H
#define _BUILDER_H
/* types of pluto credentials */
typedef enum {
/* cert_t certificate, either x509 or PGP */
CRED_TYPE_CERTIFICATE,
/* x509crl_t certificate revocation list */
CRED_TYPE_CRL,
/* x509acert_t attribute certificate */
CRED_TYPE_AC,
} cred_type_t;
/* register credential builder hooks */
extern void init_builder();
/* unregister credential builder hooks */
+2 -1
View File
@@ -23,6 +23,7 @@
#include "library.h"
#include "asn1/asn1.h"
#include "credentials/certificates/certificate.h"
#include "constants.h"
#include "defs.h"
@@ -155,7 +156,7 @@ bool load_cert(char *filename, const char *label, cert_t *out)
{
cert_t *cert;
cert = lib->creds->create(lib->creds, CRED_PLUTO_CERT, CRED_TYPE_CERTIFICATE,
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CERT,
BUILD_FROM_FILE, filename, BUILD_END);
if (cert)
{
+3 -2
View File
@@ -28,6 +28,7 @@
#include <asn1/asn1_parser.h>
#include <asn1/oid.h>
#include <crypto/hashers/hasher.h>
#include <credentials/certificates/certificate.h>
#include "constants.h"
#include "defs.h"
@@ -343,8 +344,8 @@ void load_crls(void)
char *filename = filelist[n]->d_name;
x509crl_t *crl;
crl = lib->creds->create(lib->creds, CRED_PLUTO_CERT,
CRED_TYPE_CRL, BUILD_FROM_FILE, filename, BUILD_END);
crl = lib->creds->create(lib->creds, CRED_CERTIFICATE,
CERT_PLUTO_CRL, BUILD_FROM_FILE, filename, BUILD_END);
if (crl)
{
chunk_t crl_uri;
+2 -1
View File
@@ -28,6 +28,7 @@
#include <library.h>
#include <debug.h>
#include <asn1/asn1.h>
#include <credentials/certificates/certificate.h>
#include "constants.h"
#include "defs.h"
@@ -272,7 +273,7 @@ x509crl_t* fetch_crl(char *url)
DBG1("crl fetching failed");
return FALSE;
}
crl = lib->creds->create(lib->creds, CRED_PLUTO_CERT, CRED_TYPE_CRL,
crl = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_PLUTO_CRL,
BUILD_BLOB_PEM, blob, BUILD_END);
free(blob.ptr);
if (!crl)