streamlined file loading labels

This commit is contained in:
Andreas Steffen 2009-08-26 22:02:00 +02:00
parent 289ce4ade6
commit 51a9db85f4
6 changed files with 15 additions and 12 deletions

View File

@ -820,13 +820,15 @@ void load_acerts(void)
{ {
while (n--) while (n--)
{ {
char *filename = filelist[n]->d_name;
x509acert_t *ac; x509acert_t *ac;
ac = lib->creds->create(lib->creds, CRED_CERTIFICATE, ac = lib->creds->create(lib->creds, CRED_CERTIFICATE,
CERT_PLUTO_AC, BUILD_FROM_FILE, filelist[n]->d_name, CERT_PLUTO_AC, BUILD_FROM_FILE, filename,
BUILD_END); BUILD_END);
if (ac) if (ac)
{ {
plog(" loaded attribute certificate from '%s'", filename);
add_acert(ac); add_acert(ac);
} }
free(filelist[n]); free(filelist[n]);

View File

@ -144,7 +144,7 @@ private_key_t* load_private_key(char* filename, prompt_pass_t *pass,
} }
if (key) if (key)
{ {
plog(" loaded private key from file '%s'", filename); plog(" loaded private key from '%s'", filename);
} }
else else
{ {
@ -165,7 +165,7 @@ bool load_cert(char *filename, const char *label, cert_t *out)
if (cert) if (cert)
{ {
/* the API passes an empty cert_t, we move over and free the built one */ /* the API passes an empty cert_t, we move over and free the built one */
plog(" loaded '%s' certificate from '%s'", label, filename); plog(" loaded %s certificate from '%s'", label, filename);
*out = *cert; *out = *cert;
free(cert); free(cert);
return TRUE; return TRUE;
@ -180,7 +180,7 @@ bool load_host_cert(char *filename, cert_t *cert)
{ {
char *path = concatenate_paths(HOST_CERT_PATH, filename); char *path = concatenate_paths(HOST_CERT_PATH, filename);
return load_cert(path, "host cert", cert); return load_cert(path, "host", cert);
} }
/** /**
@ -190,7 +190,7 @@ bool load_ca_cert(char *filename, cert_t *cert)
{ {
char *path = concatenate_paths(CA_CERT_PATH, filename); char *path = concatenate_paths(CA_CERT_PATH, filename);
return load_cert(path, "CA cert", cert); return load_cert(path, "CA", cert);
} }
/** /**

View File

@ -350,6 +350,7 @@ void load_crls(void)
{ {
chunk_t crl_uri; chunk_t crl_uri;
plog(" loaded crl from '%s'", filename);
crl_uri.len = 7 + sizeof(CRL_PATH) + strlen(filename); crl_uri.len = 7 + sizeof(CRL_PATH) + strlen(filename);
crl_uri.ptr = malloc(crl_uri.len + 1); crl_uri.ptr = malloc(crl_uri.len + 1);

View File

@ -717,11 +717,11 @@ int main(int argc, char **argv)
#endif /* CAPABILITIES */ #endif /* CAPABILITIES */
/* loading X.509 CA certificates */ /* loading X.509 CA certificates */
load_authcerts("CA cert", CA_CERT_PATH, AUTH_CA); load_authcerts("CA", CA_CERT_PATH, AUTH_CA);
/* loading X.509 AA certificates */ /* loading X.509 AA certificates */
load_authcerts("AA cert", AA_CERT_PATH, AUTH_AA); load_authcerts("AA", AA_CERT_PATH, AUTH_AA);
/* loading X.509 OCSP certificates */ /* loading X.509 OCSP certificates */
load_authcerts("OCSP cert", OCSP_CERT_PATH, AUTH_OCSP); load_authcerts("OCSP", OCSP_CERT_PATH, AUTH_OCSP);
/* loading X.509 CRLs */ /* loading X.509 CRLs */
load_crls(); load_crls();
/* loading attribute certificates (experimental) */ /* loading attribute certificates (experimental) */

View File

@ -1,5 +1,5 @@
moon::cat /var/log/auth.log::loaded crl file::YES moon::cat /var/log/auth.log::loaded crl from::YES
carol::cat /var/log/auth.log::loaded crl file::YES carol::cat /var/log/auth.log::loaded crl from::YES
moon::cat /var/log/auth.log::X.509 certificate rejected::NO moon::cat /var/log/auth.log::X.509 certificate rejected::NO
carol::cat /var/log/auth.log::X.509 certificate rejected::NO carol::cat /var/log/auth.log::X.509 certificate rejected::NO
moon::ipsec status::rw.*STATE_QUICK_R2.*IPsec SA established::YES moon::ipsec status::rw.*STATE_QUICK_R2.*IPsec SA established::YES

View File

@ -1,5 +1,5 @@
moon::cat /var/log/auth.log::loaded crl file::YES moon::cat /var/log/auth.log::loaded crl from::YES
carol::cat /var/log/auth.log::loaded crl file::YES carol::cat /var/log/auth.log::loaded crl from::YES
moon::cat /var/log/auth.log::crl update is overdue::YES moon::cat /var/log/auth.log::crl update is overdue::YES
carol::cat /var/log/auth.log::crl update is overdue::YES carol::cat /var/log/auth.log::crl update is overdue::YES
moon::cat /var/log/auth.log::X.509 certificate rejected::YES moon::cat /var/log/auth.log::X.509 certificate rejected::YES