]> jfr.im git - solanum.git/commitdiff
When checking if a nick resv or xline already exists, match exact not wild.
authorJilles Tjoelker <redacted>
Sun, 25 Nov 2007 17:18:07 +0000 (18:18 +0100)
committerJilles Tjoelker <redacted>
Sun, 25 Nov 2007 17:18:07 +0000 (18:18 +0100)
This is important because masks containing @ or # do not
match themselves.

include/s_newconf.h
modules/m_resv.c
modules/m_xline.c
src/kdparse.c
src/s_newconf.c

index 61795351fd4e8c063d562ffbeeda5dbf5c0b5fba..ee25ac99d8158a22f9ea1f833d0637864e16dd4a 100644 (file)
@@ -237,7 +237,9 @@ extern void set_server_conf_autoconn(struct Client *source_p, char *name,
 
 
 extern struct ConfItem *find_xline(const char *, int);
+extern struct ConfItem *find_xline_mask(const char *);
 extern struct ConfItem *find_nick_resv(const char *name);
+extern struct ConfItem *find_nick_resv_mask(const char *name);
 
 extern int valid_wild_card_simple(const char *);
 extern int clean_resv_nick(const char *);
index 515d3166b5ec137beded17b2a312254d8232949b..aad02c5bee6cda9e45a9f6ac103d51b5b4d0abb9 100644 (file)
@@ -264,7 +264,7 @@ parse_resv(struct Client *source_p, const char *name,
                        return;
                }
 
-               if(find_nick_resv(name))
+               if(find_nick_resv_mask(name))
                {
                        sendto_one_notice(source_p,
                                           ":A RESV has already been placed on nick: %s",
index 7056137b194f1bdb4c61a6c9f95a217dd023ea65..1c7913df6ae9b9ecc31eec76756ed8fe3fd788dd 100644 (file)
@@ -156,7 +156,7 @@ mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char
        else if(dlink_list_length(&cluster_conf_list) > 0)
                cluster_xline(source_p, temp_time, name, reason);
 
-       if((aconf = find_xline(name, 0)) != NULL)
+       if((aconf = find_xline_mask(name)) != NULL)
        {
                sendto_one(source_p, ":%s NOTICE %s :[%s] already X-Lined by [%s] - %s",
                           me.name, source_p->name, parv[1], aconf->name, aconf->passwd);
@@ -220,7 +220,7 @@ handle_remote_xline(struct Client *source_p, int temp_time,
                return;
 
        /* already xlined */
-       if((aconf = find_xline(name, 0)) != NULL)
+       if((aconf = find_xline_mask(name)) != NULL)
        {
                sendto_one_notice(source_p, ":[%s] already X-Lined by [%s] - %s", name, aconf->name, aconf->passwd);
                return;
index 258b666f5e8666e0f949f07deca36ba15a2bc21f..ee95d39c5222f25679b591e9e749624f066e07bb 100644 (file)
@@ -177,7 +177,7 @@ parse_x_file(FILE * file)
                        continue;
 
                /* sanity checking */
-               if((find_xline(gecos_field, 0) != NULL) ||
+               if((find_xline_mask(gecos_field) != NULL) ||
                   (strchr(reason_field, ':') != NULL))
                        continue;
 
@@ -231,7 +231,7 @@ parse_resv_file(FILE * file)
                }
                else if(clean_resv_nick(host_field))
                {
-                       if(find_nick_resv(host_field))
+                       if(find_nick_resv_mask(host_field))
                                continue;
 
                        aconf = make_conf();
index 4b5e1e087bf0df46067b82eb991338dffdeaa1b9..dc0474d56a5c4f96001297fd058a625e34a45a4a 100644 (file)
@@ -528,6 +528,23 @@ find_xline(const char *gecos, int counter)
        return NULL;
 }
 
+struct ConfItem *
+find_xline_mask(const char *gecos)
+{
+       struct ConfItem *aconf;
+       dlink_node *ptr;
+
+       DLINK_FOREACH(ptr, xline_conf_list.head)
+       {
+               aconf = ptr->data;
+
+               if(!irccmp(aconf->name, gecos))
+                       return aconf;
+       }
+
+       return NULL;
+}
+
 struct ConfItem *
 find_nick_resv(const char *name)
 {
@@ -548,6 +565,23 @@ find_nick_resv(const char *name)
        return NULL;
 }
 
+struct ConfItem *
+find_nick_resv_mask(const char *name)
+{
+       struct ConfItem *aconf;
+       dlink_node *ptr;
+
+       DLINK_FOREACH(ptr, resv_conf_list.head)
+       {
+               aconf = ptr->data;
+
+               if(!irccmp(aconf->name, name))
+                       return aconf;
+       }
+
+       return NULL;
+}
+
 /* clean_resv_nick()
  *
  * inputs      - nick