| 1 |
/*
|
| 2 |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
|
| 3 |
* spy_trace_notice.c: Sends a notice when someone uses TRACE or LTRACE
|
| 4 |
*
|
| 5 |
* Copyright (C) 2002 Hybrid Development Team
|
| 6 |
*
|
| 7 |
* This program is free software; you can redistribute it and/or modify
|
| 8 |
* it under the terms of the GNU General Public License as published by
|
| 9 |
* the Free Software Foundation; either version 2 of the License, or
|
| 10 |
* (at your option) any later version.
|
| 11 |
*
|
| 12 |
* This program is distributed in the hope that it will be useful,
|
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 |
* GNU General Public License for more details.
|
| 16 |
*
|
| 17 |
* You should have received a copy of the GNU General Public License
|
| 18 |
* along with this program; if not, write to the Free Software
|
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
| 20 |
* USA
|
| 21 |
*
|
| 22 |
* $Id: spy_trace_notice.c 677 2006-06-13 17:12:38Z adx $
|
| 23 |
*/
|
| 24 |
|
| 25 |
#include "stdinc.h"
|
| 26 |
#include "conf/modules.h"
|
| 27 |
#include "client.h"
|
| 28 |
#include "ircd.h"
|
| 29 |
#include "send.h"
|
| 30 |
|
| 31 |
static struct Callback *trace_cb = NULL;
|
| 32 |
static struct Callback *ctrace_cb = NULL, *etrace_cb = NULL;
|
| 33 |
static dlink_node *prev_trace, *prev_ctrace, *prev_etrace;
|
| 34 |
|
| 35 |
static void *show_trace(va_list);
|
| 36 |
static void *show_ctrace(va_list);
|
| 37 |
static void *show_etrace(va_list);
|
| 38 |
|
| 39 |
INIT_MODULE(spy_trace_notice, "$Revision: 677 $")
|
| 40 |
{
|
| 41 |
if ((trace_cb = find_callback("doing_trace")))
|
| 42 |
prev_trace = install_hook(trace_cb, show_trace);
|
| 43 |
|
| 44 |
if ((ctrace_cb = find_callback("doing_ctrace")))
|
| 45 |
prev_ctrace = install_hook(ctrace_cb, show_ctrace);
|
| 46 |
|
| 47 |
if ((etrace_cb = find_callback("doing_etrace")))
|
| 48 |
prev_etrace = install_hook(etrace_cb, show_etrace);
|
| 49 |
}
|
| 50 |
|
| 51 |
CLEANUP_MODULE
|
| 52 |
{
|
| 53 |
if (trace_cb)
|
| 54 |
uninstall_hook(trace_cb, show_trace);
|
| 55 |
|
| 56 |
if (ctrace_cb)
|
| 57 |
uninstall_hook(ctrace_cb, show_ctrace);
|
| 58 |
|
| 59 |
if (etrace_cb)
|
| 60 |
uninstall_hook(etrace_cb, show_etrace);
|
| 61 |
}
|
| 62 |
|
| 63 |
static void *
|
| 64 |
show_trace(va_list args)
|
| 65 |
{
|
| 66 |
struct Client *source_p = va_arg(args, struct Client *);
|
| 67 |
int parc = va_arg(args, int);
|
| 68 |
char **parv = va_arg(args, char **);
|
| 69 |
|
| 70 |
if (IsClient(source_p))
|
| 71 |
sendto_realops_flags(UMODE_SPY, L_ALL,
|
| 72 |
"trace requested by %s (%s@%s) [%s]",
|
| 73 |
source_p->name, source_p->username,
|
| 74 |
source_p->host, source_p->servptr->name);
|
| 75 |
|
| 76 |
return pass_callback(prev_trace, source_p, parc, parv);
|
| 77 |
}
|
| 78 |
|
| 79 |
static void *
|
| 80 |
show_ctrace(va_list args)
|
| 81 |
{
|
| 82 |
struct Client *source_p = va_arg(args, struct Client *);
|
| 83 |
int parc = va_arg(args, int);
|
| 84 |
char **parv = va_arg(args, char **);
|
| 85 |
|
| 86 |
if (IsClient(source_p))
|
| 87 |
sendto_realops_flags(UMODE_SPY, L_ALL,
|
| 88 |
"ctrace requested by %s (%s@%s) [%s]",
|
| 89 |
source_p->name, source_p->username,
|
| 90 |
source_p->host, source_p->servptr->name);
|
| 91 |
|
| 92 |
return pass_callback(prev_ctrace, source_p, parc, parv);
|
| 93 |
}
|
| 94 |
|
| 95 |
static void *
|
| 96 |
show_etrace(va_list args)
|
| 97 |
{
|
| 98 |
struct Client *source_p = va_arg(args, struct Client *);
|
| 99 |
int parc = va_arg(args, int);
|
| 100 |
char **parv = va_arg(args, char **);
|
| 101 |
|
| 102 |
if (IsClient(source_p))
|
| 103 |
sendto_realops_flags(UMODE_SPY, L_ALL,
|
| 104 |
"etrace requested by %s (%s@%s) [%s]",
|
| 105 |
source_p->name, source_p->username,
|
| 106 |
source_p->host, source_p->servptr->name);
|
| 107 |
|
| 108 |
return pass_callback(prev_etrace, source_p, parc, parv);
|
| 109 |
}
|