Disallow the sequence '",' in perm xlines,

it would cause problems with xline.conf.
This commit is contained in:
Jilles Tjoelker 2009-05-08 14:27:30 +02:00
parent 395935d103
commit cc169c9476

View file

@ -70,7 +70,7 @@ struct Message unxline_msgtab = {
mapi_clist_av1 xline_clist[] = { &xline_msgtab, &unxline_msgtab, NULL };
DECLARE_MODULE_AV1(xline, NULL, NULL, xline_clist, NULL, NULL, "$Revision: 3161 $");
static int valid_xline(struct Client *, const char *, const char *);
static int valid_xline(struct Client *, const char *, const char *, int);
static void apply_xline(struct Client *client_p, const char *name,
const char *reason, int temp_time);
static void write_xline(struct Client *source_p, struct ConfItem *aconf);
@ -161,7 +161,7 @@ mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char
return 0;
}
if(!valid_xline(source_p, name, reason))
if(!valid_xline(source_p, name, reason, temp_time))
return 0;
apply_xline(source_p, name, reason, temp_time);
@ -214,7 +214,7 @@ handle_remote_xline(struct Client *source_p, int temp_time,
(temp_time > 0) ? SHARED_TXLINE : SHARED_PXLINE))
return;
if(!valid_xline(source_p, name, reason))
if(!valid_xline(source_p, name, reason, temp_time))
return;
/* already xlined */
@ -229,13 +229,13 @@ handle_remote_xline(struct Client *source_p, int temp_time,
/* valid_xline()
*
* inputs - client xlining, gecos, reason and whether to warn
* inputs - client xlining, gecos, reason and temp time
* outputs -
* side effects - checks the xline for validity, erroring if needed
*/
static int
valid_xline(struct Client *source_p, const char *gecos,
const char *reason)
const char *reason, int temp_time)
{
if(EmptyString(reason))
{
@ -245,6 +245,13 @@ valid_xline(struct Client *source_p, const char *gecos,
return 0;
}
if(temp_time == 0 && strstr(gecos, "\",") != NULL)
{
sendto_one_notice(source_p,
":Invalid character sequence '\",' in xline, please replace with '\"\\,'");
return 0;
}
if(strchr(reason, ':') != NULL)
{
sendto_one_notice(source_p,