summaryrefslogtreecommitdiff
path: root/src/sessions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sessions.c')
-rw-r--r--src/sessions.c15
1 files changed, 14 insertions, 1 deletions
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;
}