aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/ssl_privsep.c
diff options
context:
space:
mode:
Diffstat (limited to 'smtpd/ssl_privsep.c')
-rw-r--r--smtpd/ssl_privsep.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/smtpd/ssl_privsep.c b/smtpd/ssl_privsep.c
index d7601054..20c02cfe 100644
--- a/smtpd/ssl_privsep.c
+++ b/smtpd/ssl_privsep.c
@@ -83,15 +83,15 @@ int ssl_by_mem_ctrl(X509_LOOKUP *, int, const char *, long, char **);
X509_LOOKUP_METHOD x509_mem_lookup = {
"Load cert from memory",
- NULL, /* new */
- NULL, /* free */
- NULL, /* init */
- NULL, /* shutdown */
- ssl_by_mem_ctrl, /* ctrl */
- NULL, /* get_by_subject */
- NULL, /* get_by_issuer_serial */
- NULL, /* get_by_fingerprint */
- NULL, /* get_by_alias */
+ NULL, /* new */
+ NULL, /* free */
+ NULL, /* init */
+ NULL, /* shutdown */
+ ssl_by_mem_ctrl, /* ctrl */
+ NULL, /* get_by_subject */
+ NULL, /* get_by_issuer_serial */
+ NULL, /* get_by_fingerprint */
+ NULL, /* get_by_alias */
};
#define X509_L_ADD_MEM 3
@@ -131,18 +131,18 @@ ssl_ctx_load_verify_memory(SSL_CTX *ctx, char *buf, off_t len)
{
X509_LOOKUP *lu;
struct iovec iov;
-
+
if ((lu = X509_STORE_add_lookup(ctx->cert_store,
&x509_mem_lookup)) == NULL)
return (0);
-
+
iov.iov_base = buf;
iov.iov_len = len;
-
+
if (!ssl_by_mem_ctrl(lu, X509_L_ADD_MEM,
(const char *)&iov, X509_FILETYPE_PEM, NULL))
return (0);
-
+
return (1);
}
@@ -155,35 +155,35 @@ ssl_by_mem_ctrl(X509_LOOKUP *lu, int cmd, const char *buf,
X509_INFO *itmp;
BIO *in = NULL;
int i, count = 0;
-
+
iov = (const struct iovec *)buf;
-
+
if (type != X509_FILETYPE_PEM)
goto done;
-
+
if ((in = BIO_new_mem_buf(iov->iov_base, iov->iov_len)) == NULL)
goto done;
-
+
if ((inf = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL)) == NULL)
goto done;
-
- for(i = 0; i < sk_X509_INFO_num(inf); i++) {
+
+ for (i = 0; i < sk_X509_INFO_num(inf); i++) {
itmp = sk_X509_INFO_value(inf, i);
- if(itmp->x509) {
+ if (itmp->x509) {
X509_STORE_add_cert(lu->store_ctx, itmp->x509);
count++;
}
- if(itmp->crl) {
+ if (itmp->crl) {
X509_STORE_add_crl(lu->store_ctx, itmp->crl);
count++;
}
}
sk_X509_INFO_pop_free(inf, X509_INFO_free);
-
+
done:
if (!count)
X509err(X509_F_X509_LOAD_CERT_CRL_FILE,ERR_R_PEM_LIB);
-
+
if (in != NULL)
BIO_free(in);
return (count);