From e76ab48804c1a584247522ac31b89ad56aace224 Mon Sep 17 00:00:00 2001 From: Fish <> Date: Mon, 3 Mar 2008 03:50:17 +0000 Subject: [PATCH] make sure exclude handler for hosts also checks hostip --- src/exclude.c | 8 ++++++++ src/users.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/exclude.c b/src/exclude.c index 26cd026a..233294a9 100644 --- a/src/exclude.c +++ b/src/exclude.c @@ -493,6 +493,10 @@ static int ExcludeUserHandler( Exclude *exclude, void *v ) u->flags |= NS_FLAG_EXCLUDED; return NS_TRUE; } + if ( match( exclude->pattern, u->hostip ) ) { + u->flags |= NS_FLAG_EXCLUDED; + return NS_TRUE; + } break; case NS_EXCLUDE_USERHOST: if( match( exclude->pattern, u->user->userhostmask ) ) @@ -563,6 +567,10 @@ static int ModExcludeUserHandler( Exclude *exclude, void *v ) dlog( DEBUG1, "User %s is excluded by host entry %s", u->name, exclude->pattern ); return NS_TRUE; } + if ( match( exclude->pattern, u->hostip ) ) { + dlog( DEBUG1, "user %s is excluded by IP entry %s", u->name, exclude->pattern ); + return NS_TRUE; + } break; case NS_EXCLUDE_USERHOST: dlog( DEBUG4, "Testing userhost %s against %s", u->user->userhostmask, exclude->pattern ); diff --git a/src/users.c b/src/users.c index 1c173427..31e7dd5a 100644 --- a/src/users.c +++ b/src/users.c @@ -120,6 +120,8 @@ static void lookupnickip( void *data, adns_answer *a ) strlcpy( u->hostip, inet_ntoa( u->ip ), HOSTIPLEN ); if( u->ip.s_addr > 0 ) { + /* check if the user is excluded */ + ns_do_exclude_user( u ); cmdparams = ( CmdParams* ) ns_calloc( sizeof( CmdParams ) ); cmdparams->source = u; SendAllModuleEvent( EVENT_NICKIP, cmdparams );