From a93b549b59ba7edf588468a9144bd969bc594e92 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 10 Aug 2020 13:40:41 -0400 Subject: Refactor clientCA and clientSTS as clientCaps --- client.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'client.c') 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", -- cgit 1.4.1