Author: Mark
Date: Fri Mar 18 06:22:41 2005
New Revision: 2363
Modified:
trunk/ChangeLog
trunk/include/exclude.h
trunk/include/neostats.h
trunk/modules/extauth/extauth.c
trunk/src/exclude.c
trunk/src/ns_help.c
Log:
Add host mask exclude ability
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Fri Mar 18 06:22:41 2005
@@ -4,6 +4,7 @@
Fish (F), Mark (M), DeadNotBuried (D)
===============================================================================
* NeoStats * Version 3.0.a3-dev
+ - Add ability to exclude nick!user@host masks. (M)
- Add nick!user@host and nick!user@vhost mask generation to core. (M)
- DBA layer will now pass size of data fetched in FetchRows. (M)
- Add support to ircd layer for processing ERROR messages from the uplink. (M)
Modified: trunk/include/exclude.h
==============================================================================
--- trunk/include/exclude.h (original)
+++ trunk/include/exclude.h Fri Mar 18 06:22:41 2005
@@ -26,7 +26,7 @@
typedef struct Exclude {
NS_EXCLUDE type;
- char pattern[MAXHOST];
+ char pattern[USERHOSTLEN];
char addedby[MAXNICK];
char reason[MAXREASON];
time_t addedon;
Modified: trunk/include/neostats.h
==============================================================================
--- trunk/include/neostats.h (original)
+++ trunk/include/neostats.h Fri Mar 18 06:22:41 2005
@@ -459,6 +459,7 @@
NS_EXCLUDE_HOST = 0,
NS_EXCLUDE_SERVER,
NS_EXCLUDE_CHANNEL,
+ NS_EXCLUDE_USERHOST,
NS_EXCLUDE_MAX,
} NS_EXCLUDE;
Modified: trunk/modules/extauth/extauth.c
==============================================================================
--- trunk/modules/extauth/extauth.c (original)
+++ trunk/modules/extauth/extauth.c Fri Mar 18 06:22:41 2005
@@ -34,7 +34,7 @@
typedef struct AccessEntry
{
char nick[MAXNICK];
- char mask[MAXHOST];
+ char mask[USERHOSTLEN];
int level;
}AccessEntry;
@@ -158,7 +158,7 @@
}
access = ns_calloc( sizeof( AccessEntry) );
strlcpy( access->nick, cmdparams->av[1], MAXNICK );
- strlcpy( access->mask, cmdparams->av[2], MAXHOST );
+ strlcpy( access->mask, cmdparams->av[2], USERHOSTLEN );
access->level = level;
hnode_create_insert( accesshash, access, access->nick );
/* save the entry */
@@ -314,14 +314,14 @@
int ModAuthUser( Client *u )
{
- static char hostmask[MAXHOST];
+ static char hostmask[USERHOSTLEN];
AccessEntry *access;
dlog( DEBUG2, "ModAuthUser for %s", u->name );
access =( AccessEntry *)hnode_find( accesshash, u->name );
if( access)
{
- ircsnprintf( hostmask, MAXHOST, "%s@%s", u->user->username, u->user->hostname );
+ ircsnprintf( hostmask, USERHOSTLEN, "%s@%s", u->user->username, u->user->hostname );
if( match( access->mask, hostmask ) )
{
return access->level;
Modified: trunk/src/exclude.c
==============================================================================
--- trunk/src/exclude.c (original)
+++ trunk/src/exclude.c Fri Mar 18 06:22:41 2005
@@ -49,6 +49,7 @@
"Host",
"Server",
"Channel",
+ "Userhost"
};
bot_cmd mod_exclude_commands[]=
@@ -152,6 +153,12 @@
return NS_SUCCESS;
}
type = NS_EXCLUDE_SERVER;
+ } else if (!ircstrcasecmp("USERHOST", cmdparams->av[1])) {
+ if (!index(cmdparams->av[2], '!') || !index(cmdparams->av[2], '@')) {
+ irc_prefmsg (cmdparams->bot, cmdparams->source, "Invalid userhost mask");
+ return NS_SUCCESS;
+ }
+ type = NS_EXCLUDE_USERHOST;
} else {
irc_prefmsg (cmdparams->bot, cmdparams->source, "Invalid exclude type");
return NS_SUCCESS;
@@ -315,12 +322,20 @@
en = list_first(exclude_list);
while (en != NULL) {
e = lnode_get(en);
- if (e->type == NS_EXCLUDE_HOST) {
+ if (e->type == NS_EXCLUDE_HOST)
+ {
if (match(e->pattern, u->user->hostname)) {
u->flags |= NS_FLAG_EXCLUDED;
return;
}
}
+ else if (e->type == NS_EXCLUDE_USERHOST)
+ {
+ if (match(e->pattern, u->user->userhostmask)) {
+ u->flags |= NS_FLAG_EXCLUDED;
+ return;
+ }
+ }
en = list_next(exclude_list, en);
}
/* if we are here, there is no match */
Modified: trunk/src/ns_help.c
==============================================================================
--- trunk/src/ns_help.c (original)
+++ trunk/src/ns_help.c Fri Mar 18 06:22:41 2005
@@ -71,7 +71,7 @@
};
const char *ns_help_exclude[] = {
- "Syntax: \2EXCLUDE ADD <HOST|SERVER|CHANNEL> <pattern> <reason>\2",
+ "Syntax: \2EXCLUDE ADD <HOST|SERVER|CHANNEL|USERHOST> <pattern> <reason>\2",
" \2EXCLUDE DEL <pattern>\2",
" \2EXCLUDE LIST\2",
"",
@@ -79,8 +79,8 @@
"users and servers from certain scans and events.",
"",
"\2ADD\2 Add a new exclusion to the list of the requested type.",
- "<pattern> is the host, server or channel name and may include",
- "wildcards such as * and ?.",
+ "<pattern> is the userhost mask, host, server or channel name and",
+ "may include wildcards such as * and ?.",
"<reason> is the reason for the exclusion",
"",
"\2DEL\2 Delete an entry from the exclusion list.",
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.