From cc169c9476fd56be283bd07410a44f29d6657155 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 8 May 2009 14:27:30 +0200 Subject: [PATCH] Disallow the sequence '",' in perm xlines, it would cause problems with xline.conf. --- modules/m_xline.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/m_xline.c b/modules/m_xline.c index d0fe3ed67..f542ebd7f 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -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,