diff --git a/include/client.h b/include/client.h index c54ea2b9..171ddd47 100644 --- a/include/client.h +++ b/include/client.h @@ -448,6 +448,7 @@ struct ListClient #define CLICAP_EXTENDED_JOIN 0x0008 #define CLICAP_AWAY_NOTIFY 0x0010 #define CLICAP_TLS 0x0020 +#define CLICAP_SASL_REAUTH 0x0040 /* * flags macros. diff --git a/modules/m_cap.c b/modules/m_cap.c index 967c1b7e..a17016df 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -72,6 +72,7 @@ static struct clicap } clicap_list[] = { _CLICAP("multi-prefix", CLICAP_MULTI_PREFIX, 0, 0, 0), _CLICAP("sasl", CLICAP_SASL, 0, 0, 0), + _CLICAP("sasl-reauth", CLICAP_SASL_REAUTH, 0, CLICAP_SASL, 0), _CLICAP("account-notify", CLICAP_ACCOUNT_NOTIFY, 0, 0, 0), _CLICAP("extended-join", CLICAP_EXTENDED_JOIN, 0, 0, 0), _CLICAP("away-notify", CLICAP_AWAY_NOTIFY, 0, 0, 0), diff --git a/modules/m_sasl.c b/modules/m_sasl.c index 9b139951..852a88e0 100644 --- a/modules/m_sasl.c +++ b/modules/m_sasl.c @@ -43,7 +43,7 @@ #include "s_newconf.h" #include "s_conf.h" -static int mr_authenticate(struct Client *, struct Client *, int, const char **); +static int m_authenticate(struct Client *, struct Client *, int, const char **); static int me_sasl(struct Client *, struct Client *, int, const char **); static void abort_sasl(struct Client *); @@ -51,7 +51,7 @@ static void abort_sasl_exit(hook_data_client_exit *); struct Message authenticate_msgtab = { "AUTHENTICATE", 0, 0, 0, MFLG_SLOW, - {{mr_authenticate, 2}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg} + {{m_authenticate, 2}, {m_authenticate, 2}, mg_ignore, mg_ignore, mg_ignore, {m_authenticate, 2}} }; struct Message sasl_msgtab = { "SASL", 0, 0, 0, MFLG_SLOW, @@ -70,7 +70,7 @@ mapi_hfn_list_av1 sasl_hfnlist[] = { DECLARE_MODULE_AV1(sasl, NULL, NULL, sasl_clist, NULL, sasl_hfnlist, "$Revision: 1409 $"); static int -mr_authenticate(struct Client *client_p, struct Client *source_p, +m_authenticate(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *agent_p = NULL; @@ -80,6 +80,12 @@ mr_authenticate(struct Client *client_p, struct Client *source_p, if(!IsCapable(source_p, CLICAP_SASL)) return 0; + if(IsRegisteredUser(source_p) && !IsCapable(source_p, CLICAP_SASL_REAUTH)) + { + sendto_one(source_p, form_str(ERR_ALREADYREGISTRED), me.name, source_p->name); + return 0; + } + if (strlen(client_p->id) == 3) { exit_client(client_p, client_p, client_p, "Mixing client and server protocol");