summary refs log tree commit diff
path: root/chat.c
diff options
context:
space:
mode:
authorC. McEnroe2021-01-09 19:11:57 -0500
committerC. McEnroe2021-01-09 19:11:57 -0500
commite42b3aa08e3706ecb87ca76254fbab51cccf3390 (patch)
treeab0232c0962f1f7ca6649ff1b0767b5c2f2ee120 /chat.c
parenta324795b8610b7c3e5626ac72d202ce6207066d7 (diff)
Add -o and -t options to trust self-signed certificates
Diffstat (limited to 'chat.c')
-rw-r--r--chat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/chat.c b/chat.c
index fd2b89a..a9c204d 100644
--- a/chat.c
+++ b/chat.c
@@ -140,6 +140,8 @@ int main(int argc, char *argv[]) {
 	const char *bind = NULL;
 	const char *host = NULL;
 	const char *port = "6697";
+	const char *chain = NULL;
+	const char *trust = NULL;
 	const char *cert = NULL;
 	const char *priv = NULL;
 
@@ -167,9 +169,11 @@ int main(int argc, char *argv[]) {
 		{ .val = 'k', .name = "priv", required_argument },
 		{ .val = 'l', .name = "log", no_argument },
 		{ .val = 'n', .name = "nick", required_argument },
+		{ .val = 'o', .name = "write-chain", required_argument },
 		{ .val = 'p', .name = "port", required_argument },
 		{ .val = 'r', .name = "real", required_argument },
 		{ .val = 's', .name = "save", required_argument },
+		{ .val = 't', .name = "trust", required_argument },
 		{ .val = 'u', .name = "user", required_argument },
 		{ .val = 'v', .name = "debug", no_argument },
 		{ .val = 'w', .name = "pass", required_argument },
@@ -200,9 +204,11 @@ int main(int argc, char *argv[]) {
 			break; case 'k': priv = optarg;
 			break; case 'l': logEnable = true;
 			break; case 'n': nick = optarg;
+			break; case 'o': insecure = true; chain = optarg;
 			break; case 'p': port = optarg;
 			break; case 'r': real = optarg;
 			break; case 's': save = optarg;
+			break; case 't': trust = optarg;
 			break; case 'u': user = optarg;
 			break; case 'v': self.debug = true;
 			break; case 'w': pass = optarg;
@@ -231,7 +237,7 @@ int main(int argc, char *argv[]) {
 	editCompleteAdd();
 	commandCompleteAdd();
 
-	ircConfig(insecure, cert, priv);
+	ircConfig(insecure, trust, cert, priv);
 
 	uiInitEarly();
 	if (save) {
@@ -249,6 +255,7 @@ int main(int argc, char *argv[]) {
 	uiDraw();
 	
 	int irc = ircConnect(bind, host, port);
+	if (chain) ircWriteChain(chain);
 	if (pass) ircFormat("PASS :%s\r\n", pass);
 	if (sasl) ircFormat("CAP REQ :sasl\r\n");
 	ircFormat("CAP LS\r\n");