summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf_validation.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2018-09-20 15:27:08 +0300
committerValentin Bartenev <vbart@nginx.com>2018-09-20 15:27:08 +0300
commit8d844bc2aa78d5acc789c5865a62bedbeba76902 (patch)
treecbc6e225402434d5b14cb454a2b7c02cebc93bbf /src/nxt_conf_validation.c
parent2dfd8ffc2fa36712c8987afa870c355185d61af9 (diff)
downloadunit-8d844bc2aa78d5acc789c5865a62bedbeba76902.tar.gz
unit-8d844bc2aa78d5acc789c5865a62bedbeba76902.tar.bz2
Controller: certificates storage interface.
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r--src/nxt_conf_validation.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c
index d51ff0ef..ca7107cc 100644
--- a/src/nxt_conf_validation.c
+++ b/src/nxt_conf_validation.c
@@ -6,6 +6,7 @@
#include <nxt_main.h>
#include <nxt_conf.h>
+#include <nxt_cert.h>
#include <nxt_router.h>
@@ -49,6 +50,10 @@ static nxt_int_t nxt_conf_vldt_error(nxt_conf_validation_t *vldt,
static nxt_int_t nxt_conf_vldt_listener(nxt_conf_validation_t *vldt,
nxt_str_t *name, nxt_conf_value_t *value);
+#if (NXT_TLS)
+static nxt_int_t nxt_conf_vldt_certificate(nxt_conf_validation_t *vldt,
+ nxt_conf_value_t *value, void *data);
+#endif
static nxt_int_t nxt_conf_vldt_app_name(nxt_conf_validation_t *vldt,
nxt_conf_value_t *value, void *data);
static nxt_int_t nxt_conf_vldt_app(nxt_conf_validation_t *vldt,
@@ -138,12 +143,35 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_root_members[] = {
};
+#if (NXT_TLS)
+
+static nxt_conf_vldt_object_t nxt_conf_vldt_tls_members[] = {
+ { nxt_string("certificate"),
+ NXT_CONF_VLDT_STRING,
+ &nxt_conf_vldt_certificate,
+ NULL },
+
+ NXT_CONF_VLDT_END
+};
+
+#endif
+
+
static nxt_conf_vldt_object_t nxt_conf_vldt_listener_members[] = {
{ nxt_string("application"),
NXT_CONF_VLDT_STRING,
&nxt_conf_vldt_app_name,
NULL },
+#if (NXT_TLS)
+
+ { nxt_string("tls"),
+ NXT_CONF_VLDT_OBJECT,
+ &nxt_conf_vldt_object,
+ (void *) &nxt_conf_vldt_tls_members },
+
+#endif
+
NXT_CONF_VLDT_END
};
@@ -467,6 +495,30 @@ nxt_conf_vldt_listener(nxt_conf_validation_t *vldt, nxt_str_t *name,
}
+#if (NXT_TLS)
+
+static nxt_int_t
+nxt_conf_vldt_certificate(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
+ void *data)
+{
+ nxt_str_t name;
+ nxt_conf_value_t *cert;
+
+ nxt_conf_get_string(value, &name);
+
+ cert = nxt_cert_info_get(&name);
+
+ if (cert == NULL) {
+ return nxt_conf_vldt_error(vldt, "Certificate \"%V\" is not found.",
+ &name);
+ }
+
+ return NXT_OK;
+}
+
+#endif
+
+
static nxt_int_t
nxt_conf_vldt_app_name(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
void *data)