From cc15db0a4428bd41218fd1870529b87df1aafb31 Mon Sep 17 00:00:00 2001 From: "drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Wed, 29 Aug 2007 21:45:06 +0000 Subject: BUILD : 1.7.19 (1290) BUGS : 723 NOTES : Anope now can except users from Session limit based on their IP. git-svn-id: svn://svn.anope.org/anope/trunk@1290 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1008 5417fbe8-f217-4b02-8779-1006273d7864 --- src/sessions.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sessions.c b/src/sessions.c index 88600e304..4b665e1bc 100644 --- a/src/sessions.c +++ b/src/sessions.c @@ -351,14 +351,27 @@ void expire_exceptions(void) Exception *find_host_exception(const char *host) { + char *ipbuf = NULL; + char *myhost = NULL; int i; + /* we try to resolve the hostname to an IP in case + * the exception was added by IP instead of hostname - DrStein */ + if (host) + myhost = sstrdup(host); + ipbuf = host_resolve(myhost); + for (i = 0; i < nexceptions; i++) { - if (match_wild_nocase(exceptions[i].mask, host)) { + if ((match_wild_nocase(exceptions[i].mask, host)) + || ((ipbuf != NULL) + && match_wild_nocase(exceptions[i].mask, ipbuf))) { + Anope_Free(myhost); return &exceptions[i]; } } + Anope_Free(myhost); + return NULL; } -- cgit