2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
|
|
|
|
* m_etrace.c: Gives local opers a trace output with added info.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002-2003 Lee Hardy <lee@leeh.co.uk>
|
|
|
|
* Copyright (C) 2002-2005 ircd-ratbox development team
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* 1.Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* 2.Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3.The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
|
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char etrace_desc[] =
|
|
|
|
"Provides enhanced tracing facilities to opers (ETRACE, CHANTRACE, and MASKTRACE)";
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
static void mo_etrace(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void me_etrace(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void m_chantrace(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void mo_masktrace(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
struct Message etrace_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"ETRACE", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_ignore, mg_not_oper, mg_ignore, mg_ignore, {me_etrace, 0}, {mo_etrace, 0}}
|
|
|
|
};
|
|
|
|
struct Message chantrace_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"CHANTRACE", 0, 0, 0, 0,
|
2008-11-08 01:28:16 +01:00
|
|
|
{mg_ignore, {m_chantrace, 2}, mg_ignore, mg_ignore, mg_ignore, {m_chantrace, 2}}
|
2007-01-25 07:40:21 +01:00
|
|
|
};
|
|
|
|
struct Message masktrace_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"MASKTRACE", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_ignore, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_masktrace, 2}}
|
|
|
|
};
|
|
|
|
|
2015-12-27 05:41:09 +01:00
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
2016-08-25 09:59:58 +02:00
|
|
|
supported::add("ETRACE");
|
|
|
|
return 0;
|
2015-12-27 05:41:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2016-08-25 09:59:58 +02:00
|
|
|
supported::del("ETRACE");
|
2015-12-27 05:41:09 +01:00
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
mapi_clist_av1 etrace_clist[] = { &etrace_msgtab, &chantrace_msgtab, &masktrace_msgtab, NULL };
|
2016-03-07 08:59:08 +01:00
|
|
|
|
|
|
|
DECLARE_MODULE_AV2(etrace, _modinit, _moddeinit, etrace_clist, NULL, NULL, NULL, NULL, etrace_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
static void do_etrace(client::client &source, int ipv4, int ipv6);
|
|
|
|
static void do_etrace_full(client::client &source);
|
|
|
|
static void do_single_etrace(client::client &source, client::client *target_p);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static const char *empty_sockhost = "255.255.255.255";
|
|
|
|
static const char *spoofed_sockhost = "0";
|
|
|
|
|
|
|
|
/*
|
|
|
|
* m_etrace
|
|
|
|
* parv[1] = options [or target]
|
|
|
|
* parv[2] = [target]
|
|
|
|
*/
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
mo_etrace(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
if(parc > 1 && !EmptyString(parv[1]))
|
|
|
|
{
|
|
|
|
if(!irccmp(parv[1], "-full"))
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace_full(source);
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2007-01-25 07:40:21 +01:00
|
|
|
else if(!irccmp(parv[1], "-v6"))
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace(source, 0, 1);
|
2007-01-25 07:40:21 +01:00
|
|
|
else if(!irccmp(parv[1], "-v4"))
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace(source, 1, 0);
|
2007-01-25 07:40:21 +01:00
|
|
|
#endif
|
|
|
|
else
|
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *target_p = client::find_named_person(parv[1]);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(target_p)
|
|
|
|
{
|
2016-08-23 04:33:36 +02:00
|
|
|
if(!my(*target_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
sendto_one(target_p, ":%s ENCAP %s ETRACE %s",
|
2016-08-23 02:37:07 +02:00
|
|
|
get_id(&source, target_p),
|
2007-11-20 13:36:55 +01:00
|
|
|
target_p->servptr->name,
|
2007-01-25 07:40:21 +01:00
|
|
|
get_id(target_p, target_p));
|
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
do_single_etrace(source, target_p);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHNICK,
|
2007-01-25 07:40:21 +01:00
|
|
|
form_str(ERR_NOSUCHNICK), parv[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace(source, 1, 1);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
me_etrace(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *target_p;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
if(!is(source, umode::OPER) || parc < 2 || EmptyString(parv[1]))
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* we cant etrace remote clients.. we shouldnt even get sent them */
|
2016-08-23 04:33:36 +02:00
|
|
|
if((target_p = client::find_person(parv[1])) && my(*target_p))
|
2016-08-23 02:37:07 +02:00
|
|
|
do_single_etrace(source, target_p);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE),
|
2007-01-25 07:40:21 +01:00
|
|
|
target_p ? target_p->name : parv[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace(client::client &source, int ipv4, int ipv6)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *target_p;
|
2008-04-01 22:18:48 +02:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* report all direct connections */
|
2008-04-01 22:18:48 +02:00
|
|
|
RB_DLINK_FOREACH(ptr, lclient_list.head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
target_p = (client::client *)ptr->data;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-05 18:57:30 +02:00
|
|
|
#ifdef RB_IPV6
|
2016-03-20 10:46:50 +01:00
|
|
|
if((!ipv4 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET) ||
|
|
|
|
(!ipv6 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6))
|
2007-01-25 07:40:21 +01:00
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_ETRACE),
|
|
|
|
me.name, source.name,
|
2016-08-24 00:25:09 +02:00
|
|
|
is(*target_p, umode::OPER) ? "Oper" : "User",
|
2007-01-25 07:40:21 +01:00
|
|
|
get_client_class(target_p),
|
|
|
|
target_p->name, target_p->username, target_p->host,
|
2016-08-23 02:37:07 +02:00
|
|
|
show_ip(&source, target_p) ? target_p->sockhost : "255.255.255.255",
|
2007-01-25 07:40:21 +01:00
|
|
|
target_p->info);
|
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
do_etrace_full(client::client &source)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2008-04-01 22:18:48 +02:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-01 22:18:48 +02:00
|
|
|
RB_DLINK_FOREACH(ptr, lclient_list.head)
|
2016-08-23 02:37:07 +02:00
|
|
|
do_single_etrace(source, (client::client *)ptr->data);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* do_single_etrace - searches local clients and displays those matching
|
|
|
|
* a pattern
|
|
|
|
* input - source client, target client
|
|
|
|
* output - etrace results
|
|
|
|
* side effects - etrace results are displayed
|
|
|
|
*/
|
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
do_single_etrace(client::client &source, client::client *target_p)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
/* note, we hide fullcaps for spoofed users, as mirc can often
|
|
|
|
* advertise its internal ip address in the field --fl
|
|
|
|
*/
|
2016-08-23 02:37:07 +02:00
|
|
|
if(!show_ip(&source, target_p))
|
|
|
|
sendto_one(&source, form_str(RPL_ETRACEFULL),
|
|
|
|
me.name, source.name,
|
2016-08-24 00:25:09 +02:00
|
|
|
is(*target_p, umode::OPER) ? "Oper" : "User",
|
2007-01-25 07:40:21 +01:00
|
|
|
get_client_class(target_p),
|
2014-03-03 05:25:47 +01:00
|
|
|
target_p->name, target_p->username, target_p->host,
|
2007-01-25 07:40:21 +01:00
|
|
|
"255.255.255.255", "<hidden> <hidden>", target_p->info);
|
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_ETRACEFULL),
|
|
|
|
me.name, source.name,
|
2016-08-24 00:25:09 +02:00
|
|
|
is(*target_p, umode::OPER) ? "Oper" : "User",
|
2007-01-25 07:40:21 +01:00
|
|
|
get_client_class(target_p),
|
2014-03-03 05:25:47 +01:00
|
|
|
target_p->name, target_p->username,
|
2007-01-25 07:40:21 +01:00
|
|
|
target_p->host, target_p->sockhost,
|
|
|
|
target_p->localClient->fullcaps, target_p->info);
|
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
m_chantrace(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *target_p;
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
const char *sockhost;
|
|
|
|
const char *name;
|
2008-04-01 22:18:48 +02:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
int operspy = 0;
|
|
|
|
|
|
|
|
name = parv[1];
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
if(IsOperSpy(&source) && parv[1][0] == '!')
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
name++;
|
|
|
|
operspy = 1;
|
|
|
|
|
|
|
|
if(EmptyString(name))
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(ERR_NEEDMOREPARAMS),
|
|
|
|
me.name, source.name, "CHANTRACE");
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
if((chptr = chan::get(name, std::nothrow)) == NULL)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL),
|
2007-01-25 07:40:21 +01:00
|
|
|
name);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dont report operspys for nonexistant channels. */
|
|
|
|
if(operspy)
|
2016-08-23 02:37:07 +02:00
|
|
|
report_operspy(&source, "CHANTRACE", chptr->name.c_str());
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
if(!operspy && !is_member(chptr, &client))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL),
|
2016-08-18 07:33:38 +02:00
|
|
|
chptr->name.c_str());
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-20 02:32:26 +02:00
|
|
|
for(const auto &pit : chptr->members.global)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-20 02:32:26 +02:00
|
|
|
auto &target_p(pit.first);
|
|
|
|
auto &member(pit.second);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(EmptyString(target_p->sockhost))
|
|
|
|
sockhost = empty_sockhost;
|
2016-08-23 02:37:07 +02:00
|
|
|
else if(!show_ip(&source, target_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
sockhost = spoofed_sockhost;
|
|
|
|
else
|
|
|
|
sockhost = target_p->sockhost;
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_ETRACE),
|
|
|
|
me.name, source.name,
|
2016-08-24 00:25:09 +02:00
|
|
|
is(*target_p, umode::OPER) ? "Oper" : "User",
|
2007-01-25 07:40:21 +01:00
|
|
|
/* class field -- pretend its server.. */
|
|
|
|
target_p->servptr->name,
|
|
|
|
target_p->name, target_p->username, target_p->host,
|
|
|
|
sockhost, target_p->info);
|
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
match_masktrace(client::client &source, rb_dlink_list *list,
|
2007-01-25 07:40:21 +01:00
|
|
|
const char *username, const char *hostname, const char *name,
|
|
|
|
const char *gecos)
|
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *target_p;
|
2008-04-01 22:18:48 +02:00
|
|
|
rb_dlink_node *ptr;
|
2014-03-03 05:25:47 +01:00
|
|
|
const char *sockhost;
|
|
|
|
|
2008-04-01 22:18:48 +02:00
|
|
|
RB_DLINK_FOREACH(ptr, list->head)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
target_p = (client::client *)ptr->data;
|
2016-08-23 04:33:36 +02:00
|
|
|
if(!is_person(*target_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
continue;
|
2014-03-03 05:25:47 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if(EmptyString(target_p->sockhost))
|
|
|
|
sockhost = empty_sockhost;
|
2016-08-23 02:37:07 +02:00
|
|
|
else if(!show_ip(&source, target_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
sockhost = spoofed_sockhost;
|
|
|
|
else
|
|
|
|
sockhost = target_p->sockhost;
|
|
|
|
|
|
|
|
if(match(username, target_p->username) &&
|
|
|
|
(match(hostname, target_p->host) ||
|
|
|
|
match(hostname, target_p->orighost) ||
|
|
|
|
match(hostname, sockhost) || match_ips(hostname, sockhost)))
|
|
|
|
{
|
|
|
|
if(name != NULL && !match(name, target_p->name))
|
|
|
|
continue;
|
|
|
|
|
2009-05-07 23:58:32 +02:00
|
|
|
if(gecos != NULL && !match_esc(gecos, target_p->info))
|
2007-01-25 07:40:21 +01:00
|
|
|
continue;
|
2014-03-03 05:25:47 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_ETRACE),
|
|
|
|
me.name, source.name,
|
2016-08-24 00:25:09 +02:00
|
|
|
is(*target_p, umode::OPER) ? "Oper" : "User",
|
2007-01-25 07:40:21 +01:00
|
|
|
/* class field -- pretend its server.. */
|
|
|
|
target_p->servptr->name,
|
|
|
|
target_p->name, target_p->username, target_p->host,
|
|
|
|
sockhost, target_p->info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
mo_masktrace(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc,
|
2007-01-25 07:40:21 +01:00
|
|
|
const char *parv[])
|
|
|
|
{
|
|
|
|
char *name, *username, *hostname, *gecos;
|
|
|
|
const char *mask;
|
|
|
|
int operspy = 0;
|
|
|
|
|
2014-03-03 05:25:47 +01:00
|
|
|
mask = parv[1];
|
|
|
|
name = LOCAL_COPY(parv[1]);
|
2007-01-25 07:40:21 +01:00
|
|
|
collapse(name);
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
if(IsOperSpy(&source) && parv[1][0] == '!')
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
name++;
|
|
|
|
mask++;
|
|
|
|
operspy = 1;
|
2014-03-03 05:25:47 +01:00
|
|
|
}
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if(parc > 2 && !EmptyString(parv[2]))
|
|
|
|
{
|
|
|
|
gecos = LOCAL_COPY(parv[2]);
|
|
|
|
collapse_esc(gecos);
|
|
|
|
} else
|
|
|
|
gecos = NULL;
|
2014-03-03 05:25:47 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if((hostname = strchr(name, '@')) == NULL)
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_notice(&source, ":Invalid parameters");
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
*hostname++ = '\0';
|
2014-03-03 05:25:47 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if((username = strchr(name, '!')) == NULL)
|
|
|
|
{
|
|
|
|
username = name;
|
|
|
|
name = NULL;
|
|
|
|
} else
|
|
|
|
*username++ = '\0';
|
|
|
|
|
|
|
|
if(EmptyString(username) || EmptyString(hostname))
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_notice(&source, ":Invalid parameters");
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
2014-03-03 05:25:47 +01:00
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
if(operspy) {
|
|
|
|
if (!ConfigFileEntry.operspy_dont_care_user_info)
|
|
|
|
{
|
|
|
|
char buf[512];
|
2008-04-20 06:40:40 +02:00
|
|
|
rb_strlcpy(buf, mask, sizeof(buf));
|
2007-01-25 07:40:21 +01:00
|
|
|
if(!EmptyString(gecos)) {
|
2008-04-20 06:44:04 +02:00
|
|
|
rb_strlcat(buf, " ", sizeof(buf));
|
|
|
|
rb_strlcat(buf, gecos, sizeof(buf));
|
2014-03-03 05:25:47 +01:00
|
|
|
}
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
report_operspy(&source, "MASKTRACE", buf);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
2016-08-23 02:37:07 +02:00
|
|
|
match_masktrace(source, &global_client_list, username, hostname, name, gecos);
|
2007-01-25 07:40:21 +01:00
|
|
|
} else
|
2016-08-23 02:37:07 +02:00
|
|
|
match_masktrace(source, &lclient_list, username, hostname, name, gecos);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|