When checking if a nick resv or xline already exists, match exact not wild.

This is important because masks containing @ or # do not
match themselves.
This commit is contained in:
Jilles Tjoelker 2007-11-25 18:18:07 +01:00
parent c0bc9fe39a
commit 0fdb257090
5 changed files with 41 additions and 5 deletions

View 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 *);

View 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",

View 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;

View 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();

View 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