From 7a9a9000b75088830651490b5945a00458977cf1 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 13 Sep 2013 22:29:26 +0200 Subject: [PATCH] Enable remote WHOWAS queries. On ircd-seven, this will allow remote opers to see certain hidden IPs. --- doc/technical/ts6-protocol.txt | 9 +++++++++ help/opers/whowas | 4 +++- modules/m_whowas.c | 13 ++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/doc/technical/ts6-protocol.txt b/doc/technical/ts6-protocol.txt index 8c90e182..df253420 100644 --- a/doc/technical/ts6-protocol.txt +++ b/doc/technical/ts6-protocol.txt @@ -1058,6 +1058,15 @@ parameters: hunted, target nick Remote WHOIS request. +WHOWAS +source: user +parameters: nickname, limit, hunted + +Remote WHOWAS request. Not implemented in all servers. + +Different from a local WHOWAS request, the limit is mandatory and servers should +apply a maximum to it. + XLINE 1. encap only diff --git a/help/opers/whowas b/help/opers/whowas index 0f3023c0..b277942f 100644 --- a/help/opers/whowas +++ b/help/opers/whowas @@ -1,4 +1,4 @@ -WHOWAS [limit] +WHOWAS [limit] [server|nick] WHOWAS will show you the last known host and whois information for the specified nick. Depending on the @@ -8,4 +8,6 @@ may be more than one listing for a specific user. If a limit is specified, WHOWAS will not show more than that many listings. +The third parameter allows querying another server. + The WHOWAS data will expire after time. diff --git a/modules/m_whowas.c b/modules/m_whowas.c index eb32ede2..c0f10b66 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.c @@ -45,7 +45,7 @@ static int m_whowas(struct Client *, struct Client *, int, const char **); struct Message whowas_msgtab = { "WHOWAS", 0, 0, 0, MFLG_SLOW, - {mg_unreg, {m_whowas, 2}, mg_ignore, mg_ignore, mg_ignore, {m_whowas, 2}} + {mg_unreg, {m_whowas, 2}, {m_whowas, 4}, mg_ignore, mg_ignore, {m_whowas, 2}} }; mapi_clist_av1 whowas_clist[] = { &whowas_msgtab, NULL }; @@ -68,9 +68,11 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char static time_t last_used = 0L; - if(!IsOper(source_p)) + if(MyClient(source_p) && !IsOper(source_p)) { - if((last_used + ConfigFileEntry.pace_wait_simple) > rb_current_time()) + if(last_used + (parc > 3 ? ConfigFileEntry.pace_wait : + ConfigFileEntry.pace_wait_simple + ) > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "WHOWAS"); @@ -86,11 +88,12 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char if(parc > 2) max = atoi(parv[2]); -#if 0 if(parc > 3) if(hunt_server(client_p, source_p, ":%s WHOWAS %s %s :%s", 3, parc, parv)) return 0; -#endif + + if(!MyClient(source_p) && (max <= 0 || max > 20)) + max = 20; if((p = strchr(parv[1], ','))) *p = '\0';