[svn] - rework spy_whois_notice as a snomask-implementing module, snomask +W.

This commit is contained in:
nenolod 2007-05-23 20:58:27 -07:00
parent 88a2a1484b
commit 9e6feafe29
5 changed files with 75 additions and 59 deletions

View File

@ -1,3 +1,12 @@
jilles 2007/05/19 23:36:51 UTC (20070519-3466)
Log:
Prevent too wide klines with CIDR masks.
Changes: Modified:
+17 -5 trunk/modules/m_kline.c (File Modified)
jilles 2007/05/19 22:21:10 UTC (20070519-3464)
Log:
Exempt klines with a fixed user@ (no */?) from min_nonwildcard checks.

View File

@ -1,7 +1,7 @@
#
# Makefile.in for ircd/contrib
#
# $Id: Makefile.in 1849 2006-08-23 12:40:21Z jilles $
# $Id: Makefile.in 3468 2007-05-24 03:58:27Z nenolod $
#
CC = @CC@
RM = @RM@
@ -40,6 +40,7 @@ SRCS = \
sno_farconnect.c \
sno_globalkline.c \
sno_globaloper.c \
sno_whois.c \
m_42.c \
m_findforwards.c \
m_identify.c \
@ -58,7 +59,6 @@ SRCS = \
spy_stats_notice.c \
spy_stats_p_notice.c \
spy_trace_notice.c \
spy_whois_notice.c \
spy_whois_notice_global.c \
example_module.c

63
extensions/sno_whois.c Normal file
View File

@ -0,0 +1,63 @@
/*
* +W snomask: Displays if a local user has done a WHOIS request on you.
* derived from spy_whois_notice.c.
*
* If #define OPERONLY is removed, then any user can use this snomask.
*
* $Id: sno_whois.c 3468 2007-05-24 03:58:27Z nenolod $
*/
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
/* undefine this to allow anyone to receive whois notifications */
#define OPERONLY
void show_whois(hook_data_client *);
mapi_hfn_list_av1 whois_hfnlist[] = {
{"doing_whois", (hookfn) show_whois},
{NULL, NULL}
};
static int
init(void)
{
snomask_modes['W'] = find_snomask_slot();
return 0;
}
static void
fini(void)
{
snomask_modes['W'] = find_snomask_slot();
}
DECLARE_MODULE_AV1(sno_whois, init, fini, NULL, NULL, whois_hfnlist, "$Revision: 3468 $");
void
show_whois(hook_data_client *data)
{
struct Client *source_p = data->client;
struct Client *target_p = data->target;
/* source being MyConnect() is implicit here from m_whois.c --fl */
if(MyClient(target_p) &&
#ifdef OPERONLY
IsOper(target_p) &&
#endif
(source_p != target_p) &&
(target_p->snomask & snomask_modes['W']))
{
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
source_p->name,
source_p->username, source_p->host,
source_p->user->server);
}
}

View File

@ -1,56 +0,0 @@
/*
* ircd-ratbox: A slightly useful ircd.
* spy_whois_notice.c: Sends a notice when someone uses WHOIS.
*
* Copyright (C) 2002 by the past and present ircd coders, and others.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: spy_whois_notice.c 3161 2007-01-25 07:23:01Z nenolod $
*/
#include "stdinc.h"
#include "modules.h"
#include "hook.h"
#include "client.h"
#include "ircd.h"
#include "send.h"
void show_whois(hook_data_client *);
mapi_hfn_list_av1 whois_hfnlist[] = {
{"doing_whois", (hookfn) show_whois},
{NULL, NULL}
};
DECLARE_MODULE_AV1(whois_spy, NULL, NULL, NULL, NULL, whois_hfnlist, "$Revision: 3161 $");
void
show_whois(hook_data_client *data)
{
struct Client *source_p = data->client;
struct Client *target_p = data->target;
/* source being MyConnect() is implicit here from m_whois.c --fl */
if(MyClient(target_p) && IsOper(target_p) && (source_p != target_p) &&
(target_p->snomask & SNO_SPY))
{
sendto_one_notice(target_p,
":*** Notice -- %s (%s@%s) is doing a whois on you [%s]",
source_p->name,
source_p->username, source_p->host,
source_p->user->server);
}
}

View File

@ -1 +1 @@
#define SERNO "20070519-3464"
#define SERNO "20070519-3466"