Stop changing \s to spaces in masktrace and testmask,

match_esc() handles \s directly now.
This commit is contained in:
Jilles Tjoelker 2009-05-07 23:58:32 +02:00
parent 031c4b89d3
commit eb5e3f1520
2 changed files with 3 additions and 73 deletions

View File

@ -288,45 +288,7 @@ match_masktrace(struct Client *source_p, rb_dlink_list *list,
struct Client *target_p;
rb_dlink_node *ptr;
const char *sockhost;
char *mangle_gecos = NULL;
if(gecos != NULL)
{
if(strstr(gecos, "\\s"))
{
char *tmp = LOCAL_COPY(gecos);
char *orig = tmp;
char *new = tmp;
while(*orig)
{
if(*orig == '\\' && *(orig + 1) != '\0')
{
if(*(orig + 1) == 's')
{
*new++ = ' ';
orig += 2;
}
/* otherwise skip that and the escaped
* character after it, so we dont mistake
* \\s as \s --fl
*/
else
{
*new++ = *orig++;
*new++ = *orig++;
}
}
else
*new++ = *orig++;
}
*new = '\0';
mangle_gecos = LOCAL_COPY(tmp);
}
else
mangle_gecos = LOCAL_COPY(gecos);
}
RB_DLINK_FOREACH(ptr, list->head)
{
target_p = ptr->data;
@ -348,7 +310,7 @@ match_masktrace(struct Client *source_p, rb_dlink_list *list,
if(name != NULL && !match(name, target_p->name))
continue;
if(mangle_gecos != NULL && !match_esc(mangle_gecos, target_p->info))
if(gecos != NULL && !match_esc(gecos, target_p->info))
continue;
sendto_one(source_p, form_str(RPL_ETRACE),

View File

@ -71,7 +71,7 @@ mo_testmask(struct Client *client_p, struct Client *source_p,
int gcount = 0;
char *name, *username, *hostname;
const char *sockhost;
char *gecos = NULL, *mangle_gecos = NULL;
char *gecos = NULL;
rb_dlink_node *ptr;
name = LOCAL_COPY(parv[1]);
@ -105,38 +105,6 @@ mo_testmask(struct Client *client_p, struct Client *source_p,
{
gecos = LOCAL_COPY(parv[2]);
collapse_esc(gecos);
if(strstr(gecos, "\\s"))
{
char *tmp = LOCAL_COPY(gecos);
char *orig = tmp;
char *new = tmp;
while(*orig)
{
if(*orig == '\\' && *(orig + 1) != '\0')
{
if(*(orig + 1) == 's')
{
*new++ = ' ';
orig += 2;
}
/* otherwise skip that and the escaped
* character after it, so we dont mistake
* \\s as \s --fl
*/
else
{
*new++ = *orig++;
*new++ = *orig++;
}
}
else
*new++ = *orig++;
}
*new = '\0';
mangle_gecos = LOCAL_COPY(tmp);
} else
mangle_gecos = gecos;
}
RB_DLINK_FOREACH(ptr, global_client_list.head)
@ -161,7 +129,7 @@ mo_testmask(struct Client *client_p, struct Client *source_p,
if(name && !match(name, target_p->name))
continue;
if(mangle_gecos && !match_esc(mangle_gecos, target_p->info))
if(gecos && !match_esc(gecos, target_p->info))
continue;
if(MyClient(target_p))