0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

m_cap: do not allow sasl CAP when the agent is offline

This commit is contained in:
Max Teufel 2015-03-01 09:59:27 +01:00 committed by William Pitcock
parent 9f09e25b63
commit bbce62d2aa

View file

@ -42,6 +42,7 @@
#include "s_serv.h"
#include "s_user.h"
#include "send.h"
#include "s_conf.h"
typedef int (*bqcmp)(const void *, const void *);
@ -210,6 +211,18 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea
continue;
}
if (clicap_list[i].cap_serv == CLICAP_SASL)
{
struct Client *agent_p = NULL;
if (!ConfigFileEntry.sasl_service)
continue;
agent_p = find_named_client(ConfigFileEntry.sasl_service);
if (agent_p == NULL || !IsService(agent_p))
continue;
}
/* \r\n\0, possible "-~=", space, " *" */
if(buflen + clicap_list[i].namelen >= BUFSIZE - 10)
{
@ -411,6 +424,24 @@ cap_req(struct Client *source_p, const char *arg)
break;
}
if (cap->cap_serv == CLICAP_SASL)
{
struct Client *agent_p = NULL;
if (!ConfigFileEntry.sasl_service)
{
finished = 0;
break;
}
agent_p = find_named_client(ConfigFileEntry.sasl_service);
if (agent_p == NULL || !IsService(agent_p))
{
finished = 0;
break;
}
}
if(cap->flags & CLICAP_FLAGS_STICKY)
{
strcat(pbuf[i], "=");