make sure exclude handler for hosts also checks hostip

This commit is contained in:
Fish 2008-03-03 03:50:17 +00:00
parent f4dc0ce13d
commit e76ab48804
2 changed files with 10 additions and 0 deletions

View file

@ -493,6 +493,10 @@ static int ExcludeUserHandler( Exclude *exclude, void *v )
u->flags |= NS_FLAG_EXCLUDED; u->flags |= NS_FLAG_EXCLUDED;
return NS_TRUE; return NS_TRUE;
} }
if ( match( exclude->pattern, u->hostip ) ) {
u->flags |= NS_FLAG_EXCLUDED;
return NS_TRUE;
}
break; break;
case NS_EXCLUDE_USERHOST: case NS_EXCLUDE_USERHOST:
if( match( exclude->pattern, u->user->userhostmask ) ) 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 ); dlog( DEBUG1, "User %s is excluded by host entry %s", u->name, exclude->pattern );
return NS_TRUE; 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; break;
case NS_EXCLUDE_USERHOST: case NS_EXCLUDE_USERHOST:
dlog( DEBUG4, "Testing userhost %s against %s", u->user->userhostmask, exclude->pattern ); dlog( DEBUG4, "Testing userhost %s against %s", u->user->userhostmask, exclude->pattern );

View file

@ -120,6 +120,8 @@ static void lookupnickip( void *data, adns_answer *a )
strlcpy( u->hostip, inet_ntoa( u->ip ), HOSTIPLEN ); strlcpy( u->hostip, inet_ntoa( u->ip ), HOSTIPLEN );
if( u->ip.s_addr > 0 ) if( u->ip.s_addr > 0 )
{ {
/* check if the user is excluded */
ns_do_exclude_user( u );
cmdparams = ( CmdParams* ) ns_calloc( sizeof( CmdParams ) ); cmdparams = ( CmdParams* ) ns_calloc( sizeof( CmdParams ) );
cmdparams->source = u; cmdparams->source = u;
SendAllModuleEvent( EVENT_NICKIP, cmdparams ); SendAllModuleEvent( EVENT_NICKIP, cmdparams );