From 86f6d93943210ae415594520b41ce4389c3234f8 Mon Sep 17 00:00:00 2001
From: "Thierry FOURNIER / OZON.IO" <thierry.fournier@ozon.io>
Date: Sun, 27 Nov 2016 01:03:16 +0100
Subject: [PATCH 3/4] wip

---
 src/ssl_sock.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 76b5b79..162f019 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -6273,6 +6273,64 @@ static int cli_parse_set_ocspresponse(char **args, struct appctx *appctx, void *
 
 }
 
+/* This cli function expects a valid binf identifier. */
+static int ssl_cli_new_parse(char **args, struct appctx *appctx, void *private)
+{
+	return 0;
+}
+
+static int ssl_cli_new_iohandler(struct appctx *appctx)
+{
+	return 1;
+}
+
+static void ssl_cli_new_release(struct appctx *appctx)
+{
+}
+
+static int ssl_cli_setcert_parse(char **args, struct appctx *appctx, void *private)
+{
+	return 0;
+}
+
+static int ssl_cli_setcert_iohandler(struct appctx *appctx)
+{
+	// struct cert_key_and_chain certs_and_keys[SSL_SOCK_NUM_KEYTYPES] = { {0} };
+	return 1;
+}
+
+static void ssl_cli_setcert_release(struct appctx *appctx)
+{
+}
+
+static int ssl_cli_setfilter_parse(char **args, struct appctx *appctx, void *private)
+{
+	return 0;
+}
+
+static int ssl_cli_setfilter_iohandler(struct appctx *appctx)
+{
+	return 1;
+}
+
+static void ssl_cli_setfilter_release(struct appctx *appctx)
+{
+}
+
+static int ssl_cli_commit_parse(char **args, struct appctx *appctx, void *private)
+{
+	return 0;
+}
+
+static int ssl_cli_commit_iohandler(struct appctx *appctx)
+{
+	return 1;
+}
+
+static void ssl_cli_commit_release(struct appctx *appctx)
+{
+}
+
 /* register cli keywords */
 static struct cli_kw_list cli_kws = {{ },{
 #if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0)
@@ -6280,6 +6338,34 @@ static struct cli_kw_list cli_kws = {{ },{
 	{ { "set", "ssl", "tls-keys", NULL }, NULL, cli_parse_set_tlskeys, NULL },
 	{ { "set", "ssl", "ocsp-response", NULL }, NULL, cli_parse_set_ocspresponse, NULL },
 #endif
+	{
+		{ "new", "ssl", "cert", NULL },
+		"ssl new cert   : Start the pload of new certificates",
+		ssl_cli_new_parse,
+		ssl_cli_new_iohandler,
+		ssl_cli_new_release,
+	},
+	{
+		{ "set", "ssl", "cert", NULL },
+		"ssl set cert   : Upload SSL certificates in order to add or replace old one",
+		ssl_cli_setcert_parse,
+		ssl_cli_setcert_iohandler,
+		ssl_cli_setcert_release,
+	},
+	{
+		{ "set", "ssl", "filter", NULL },
+		"ssl set filter : Set filter to the current certificate",
+		ssl_cli_setfilter_parse,
+		ssl_cli_setfilter_iohandler,
+		ssl_cli_setfilter_release,
+	},
+	{
+		{ "set", "ssl", "commit", NULL },
+		"ssl set commit : Add the uploaded certificates on the SSL termination",
+		ssl_cli_commit_parse,
+		ssl_cli_commit_iohandler,
+		ssl_cli_commit_release,
+	},
 	{ { NULL }, NULL, NULL, NULL }
 }};
 
-- 
2.9.5

