1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 10:43:13 +02:00

- m_sasl: take over cap_sasl implementation

This commit is contained in:
William Pitcock
2013-05-20 17:33:06 +00:00
parent c00350b760
commit 5b32e5fa79
2 changed files with 17 additions and 12 deletions
-12
View File
@@ -76,11 +76,6 @@ static ClientCapability cap_multi_prefix = {
.cap = PROTO_NAMESX,
};
static ClientCapability cap_sasl = {
.name = "sasl",
.cap = PROTO_SASL,
};
static ClientCapability cap_uhnames = {
.name = "userhost-in-names",
.cap = PROTO_UHNAMES,
@@ -96,7 +91,6 @@ static struct list_head *clicap_build_list(void)
clicap_append(&clicap_list, &cap_account_notify);
clicap_append(&clicap_list, &cap_away_notify);
clicap_append(&clicap_list, &cap_multi_prefix);
clicap_append(&clicap_list, &cap_sasl);
clicap_append(&clicap_list, &cap_uhnames);
RunHook(HOOKTYPE_CAPLIST, &clicap_list);
@@ -146,9 +140,6 @@ static ClientCapability *clicap_find(const char *data, int *negate, int *finishe
if((s = strchr(p, ' ')))
*s++ = '\0';
if (!strcmp(p, "sasl") && (!SASL_SERVER || !find_server(SASL_SERVER, NULL)))
return NULL; /* hack: if SASL is disabled or server not online, then pretend it does not exist. -- Syzop */
list_for_each_entry(cap, clicap_list, caplist_node)
{
if (!stricmp(cap->name, p))
@@ -182,9 +173,6 @@ static void clicap_generate(aClient *sptr, const char *subcmd, int flags, int cl
list_for_each_entry(cap, clicap_list, caplist_node)
{
if ((cap->cap == PROTO_SASL) && (!SASL_SERVER || !find_server(SASL_SERVER, NULL)))
continue; /* if SASL is disabled or server not online, then pretend it does not exist. -- Syzop */
if (flags)
{
if (!CHECKPROTO(sptr, cap->cap))
+17
View File
@@ -44,6 +44,7 @@
#ifdef _WIN32
#include "version.h"
#endif
#include "m_cap.h"
#define MSG_AUTHENTICATE "AUTHENTICATE"
@@ -304,6 +305,20 @@ static int abort_sasl(struct Client *cptr)
return 0;
}
static ClientCapability cap_sasl = {
.name = "sasl",
.cap = PROTO_SASL,
};
static void m_sasl_caplist(struct list_head *head)
{
/* if SASL is disabled or server not online, then pretend it does not exist. -- Syzop */
if (!SASL_SERVER || !find_server(SASL_SERVER, NULL))
return;
clicap_append(head, &cap_sasl);
}
/* This is called on module init, before Server Ready */
DLLFUNC int MOD_INIT(m_sasl)(ModuleInfo *modinfo)
{
@@ -316,6 +331,8 @@ DLLFUNC int MOD_INIT(m_sasl)(ModuleInfo *modinfo)
HookAddEx(modinfo->handle, HOOKTYPE_LOCAL_CONNECT, abort_sasl);
HookAddEx(modinfo->handle, HOOKTYPE_LOCAL_QUIT, abort_sasl);
HookAddVoidEx(modinfo->handle, HOOKTYPE_CAPLIST, m_sasl_caplist);
return MOD_SUCCESS;
}