From 0416a2cc8619979cf2104fb3dd6a6d4ba3463c50 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 27 Feb 2016 01:45:40 -0600 Subject: [PATCH] starttls: take ownership of 'tls' capability --- include/s_serv.h | 2 -- ircd/s_serv.c | 2 -- modules/m_starttls.c | 21 ++++++++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/s_serv.h b/include/s_serv.h index 98bf56f9..62facc03 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -67,11 +67,9 @@ extern unsigned int CLICAP_SASL; extern unsigned int CLICAP_ACCOUNT_NOTIFY; extern unsigned int CLICAP_EXTENDED_JOIN; extern unsigned int CLICAP_AWAY_NOTIFY; -extern unsigned int CLICAP_TLS; extern unsigned int CLICAP_USERHOST_IN_NAMES; extern unsigned int CLICAP_CAP_NOTIFY; extern unsigned int CLICAP_CHGHOST; -extern unsigned int CLICAP_ACCOUNT_TAG; /* * XXX: this is kind of ugly, but this allows us to have backwards diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 26060eb3..9542249d 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -100,7 +100,6 @@ unsigned int CLICAP_SASL; unsigned int CLICAP_ACCOUNT_NOTIFY; unsigned int CLICAP_EXTENDED_JOIN; unsigned int CLICAP_AWAY_NOTIFY; -unsigned int CLICAP_TLS; unsigned int CLICAP_USERHOST_IN_NAMES; unsigned int CLICAP_CAP_NOTIFY; unsigned int CLICAP_CHGHOST; @@ -148,7 +147,6 @@ init_builtin_capabs(void) CLICAP_ACCOUNT_NOTIFY = capability_put(cli_capindex, "account-notify", NULL); CLICAP_EXTENDED_JOIN = capability_put(cli_capindex, "extended-join", NULL); CLICAP_AWAY_NOTIFY = capability_put(cli_capindex, "away-notify", NULL); - CLICAP_TLS = capability_put(cli_capindex, "tls", NULL); CLICAP_USERHOST_IN_NAMES = capability_put(cli_capindex, "userhost-in-names", NULL); CLICAP_CAP_NOTIFY = capability_put(cli_capindex, "cap-notify", NULL); CLICAP_CHGHOST = capability_put(cli_capindex, "chghost", NULL); diff --git a/modules/m_starttls.c b/modules/m_starttls.c index ed62db5c..d1e043ab 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -41,7 +41,26 @@ struct Message starttls_msgtab = { mapi_clist_av1 starttls_clist[] = { &starttls_msgtab, NULL }; -DECLARE_MODULE_AV1(starttls, NULL, NULL, starttls_clist, NULL, NULL, "$Revision$"); +unsigned int CLICAP_TLS = 0; + +static int +_modinit(void) +{ +#ifdef HAVE_LIBCRYPTO + CLICAP_TLS = capability_put(cli_capindex, "tls", NULL); +#endif + return 0; +} + +static void +_moddeinit(void) +{ +#ifdef HAVE_LIBCRYPTO + capability_orphan(cli_capindex, "tls"); +#endif +} + +DECLARE_MODULE_AV1(starttls, _modinit, _moddeinit, starttls_clist, NULL, NULL, "$Revision$"); static int mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])