about summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-10 13:40:41 -0400
committerJune McEnroe <june@causal.agency>2020-08-10 13:40:41 -0400
commita93b549b59ba7edf588468a9144bd969bc594e92 (patch)
tree4144d69b0f5e6474ac4c2cc137d8ce7e521984d1 /client.c
parentUse system libcrypto and openssl bin on FreeBSD (diff)
downloadpounce-a93b549b59ba7edf588468a9144bd969bc594e92.tar.gz
pounce-a93b549b59ba7edf588468a9144bd969bc594e92.zip
Refactor clientCA and clientSTS as clientCaps
Diffstat (limited to 'client.c')
-rw-r--r--client.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/client.c b/client.c
index 4811867..9246085 100644
--- a/client.c
+++ b/client.c
@@ -41,8 +41,7 @@
 
 #include "bounce.h"
 
-bool clientCA;
-bool clientSTS = true;
+enum Cap clientCaps = CapServerTime | CapConsumer | CapPassive | CapSTS;
 char *clientPass;
 char *clientAway;
 
@@ -71,7 +70,7 @@ struct Client *clientAlloc(struct tls *tls) {
 	if (!client) err(EX_OSERR, "calloc");
 	client->tls = tls;
 	client->need = NeedNick | NeedUser | (clientPass ? NeedPass : 0);
-	if (clientCA && tls_peer_cert_provided(tls)) {
+	if ((clientCaps & CapSASL) && tls_peer_cert_provided(tls)) {
 		client->need &= ~NeedPass;
 	}
 	return client;
@@ -179,10 +178,7 @@ static void handlePass(struct Client *client, struct Message *msg) {
 static void handleCap(struct Client *client, struct Message *msg) {
 	if (!msg->params[0]) msg->params[0] = "";
 
-	enum Cap avail = (stateCaps & ~CapSASL)
-		| CapServerTime | CapConsumer | CapPassive
-		| (clientCA ? CapSASL : 0)
-		| (clientSTS ? CapSTS : 0);
+	enum Cap avail = clientCaps | (stateCaps & ~CapSASL);
 	const char *values[CapBits] = {
 		[CapSASLBit] = "EXTERNAL",
 		[CapSTSBit] = "duration=2147483647",