]> jfr.im git - solanum.git/blobdiff - modules/core/m_ban.c
BAN: Reject bans with insufficient non-wildcard characters.
[solanum.git] / modules / core / m_ban.c
index 8d4f2690d1fe33973014463d5f51c6db0b5bdd9e..f61ba0763fd0b55db1216ac5efbaba7b71bfffcf 100644 (file)
@@ -35,6 +35,7 @@
 #include "ircd.h"
 #include "match.h"
 #include "s_conf.h"
+#include "s_newconf.h"
 #include "msg.h"
 #include "modules.h"
 #include "hash.h"
@@ -160,7 +161,31 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p
                aconf->passwd = rb_strndup(parv[parc - 1], p - parv[parc - 1] + 1);
                aconf->spasswd = rb_strdup(p + 1);
        }
-       if (act && hold != created)
+       if (act && hold != created &&
+                       !(ntype == CONF_KILL ?
+                               valid_wild_card(aconf->user, aconf->host) :
+                               valid_wild_card_simple(aconf->host)))
+       {
+               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+                                      "Ignoring global %d min. %s from %s%s%s for [%s%s%s]: too few non-wildcard characters",
+                                      (hold - rb_current_time()) / 60,
+                                      stype,
+                                      IsServer(source_p) ? source_p->name : get_oper_name(source_p),
+                                      strcmp(parv[7], "*") ? " on behalf of " : "",
+                                      strcmp(parv[7], "*") ? parv[7] : "",
+                                      aconf->user ? aconf->user : "",
+                                      aconf->user ? "@" : "",
+                                      aconf->host);
+               if(IsPerson(source_p))
+                       sendto_one_notice(source_p,
+                                       ":Your %s [%s%s%s] has too few non-wildcard characters",
+                                       stype,
+                                       aconf->user ? aconf->user : "",
+                                       aconf->user ? "@" : "",
+                                       aconf->host);
+               /* Propagate it, but do not apply it locally. */
+       }
+       else if (act && hold != created)
        {
                /* Keep the notices in sync with modules/m_kline.c etc. */
                sendto_realops_snomask(SNO_GENERAL, L_ALL,