* name etc.
*/
if(strlen(mask) > IRCD_MIN(BANLEN, MODEBUFLEN - 5))
+ {
+ sendto_one_numeric(source_p, ERR_INVALIDBAN,
+ form_str(ERR_INVALIDBAN),
+ chptr->chname, c, raw_mask);
return;
+ }
/* Look for a $ after the first character.
* As the first character, it marks an extban; afterwards
if (*mask == '$' && MyClient(source_p))
{
if (!valid_extban(mask, source_p, chptr, mode_type))
- /* XXX perhaps return an error message here */
+ {
+ sendto_one_numeric(source_p, ERR_INVALIDBAN,
+ form_str(ERR_INVALIDBAN),
+ chptr->chname, c, raw_mask);
return;
+ }
}
/* For compatibility, only check the forward channel from
*/
if(forward != NULL && MyClient(source_p))
{
- if(!ConfigChannel.use_forward)
- return;
- if(!check_forward(source_p, chptr, forward))
- return;
/* For simplicity and future flexibility, do not
* allow '$' in forwarding targets.
*/
- if(strchr(forward, '$') != NULL)
+ if(!ConfigChannel.use_forward ||
+ strchr(forward, '$') != NULL)
+ {
+ sendto_one_numeric(source_p, ERR_INVALIDBAN,
+ form_str(ERR_INVALIDBAN),
+ chptr->chname, c, raw_mask);
+ return;
+ }
+ /* check_forward() sends its own error message */
+ if(!check_forward(source_p, chptr, forward))
return;
/* Forwards only make sense for bans. */
if(mode_type != CHFL_BAN)
+ {
+ sendto_one_numeric(source_p, ERR_INVALIDBAN,
+ form_str(ERR_INVALIDBAN),
+ chptr->chname, c, raw_mask);
return;
+ }
}
/* dont allow local clients to overflow the banlist, dont
}
if(removed && removed->forward)
- removed_mask_pos += rb_snprintf(buf, sizeof(buf), "%s$%s", removed->banstr, removed->forward);
+ removed_mask_pos += rb_snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1;
else
- removed_mask_pos += rb_strlcpy(buf, mask, sizeof(buf));
+ removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1;
if(removed)
{
free_ban(removed);