Allow for capabilities to be marked as "required".
If capability negotiation fails on these capabilities, then the server link is dropped.
This commit is contained in:
parent
16d8d9fc6d
commit
fde16193c4
|
@ -51,6 +51,7 @@ struct Capability
|
|||
{
|
||||
const char *name; /* name of capability */
|
||||
unsigned int cap; /* mask value */
|
||||
unsigned int required; /* 1 if required, 0 if not */
|
||||
};
|
||||
|
||||
#define CAP_CAP 0x00001 /* received a CAP to begin with */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ircd-ratbox: A slightly useful ircd.
|
||||
* m_away.c: Negotiates capabilities with a remote server.
|
||||
* m_capab.c: Negotiates capabilities with a remote server.
|
||||
*
|
||||
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
||||
* Copyright (C) 1996-2002 Hybrid Development Team
|
||||
|
@ -96,6 +96,23 @@ mr_capab(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
}
|
||||
}
|
||||
|
||||
/* check to ensure any "required" caps are set. --nenolod */
|
||||
for (cap = captab; cap->name; cap++)
|
||||
{
|
||||
if (!cap->required)
|
||||
continue;
|
||||
|
||||
if (!(client_p->localClient->caps & cap->cap))
|
||||
{
|
||||
char exitbuf[BUFSIZE];
|
||||
|
||||
rb_snprintf(exitbuf, BUFSIZE, "Missing required CAPAB [%s]", cap->cap);
|
||||
exit_client(client_p, client_p, client_p, exitbuf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue