summaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 11:50:03 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 11:50:03 +0000
commitda2ad810d29d16446adf5b88f8371704c1c88786 (patch)
treec2f34c7e5120ba9c22e06ae282d709e3005d3d91 /src/message.cpp
parentbaa9673d291b9b9a2d7ad0d3aab56487de434502 (diff)
Support for hostnames in <bind> tag (so long as the hostname resolves to a locally bindable ip)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3621 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/message.cpp b/src/message.cpp
index 29a4ae998..39c321f42 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -166,15 +166,24 @@ void NonBlocking(int s)
fcntl(s, F_SETFL, flags | O_NONBLOCK);
}
-int CleanAndResolve (char *resolvedHost, const char *unresolvedHost)
+int CleanAndResolve (char *resolvedHost, const char *unresolvedHost, bool forward)
{
+ int fd;
+ std::string ipaddr;
+
DNS d(Config->DNSServer);
- int fd = d.ReverseLookup(unresolvedHost);
+ if (forward)
+ fd = d.ForwardLookup(unresolvedHost);
+ else
+ fd = d.ReverseLookup(unresolvedHost);
if (fd < 0)
return 0;
time_t T = time(NULL)+1;
while ((!d.HasResult()) && (time(NULL)<T));
- std::string ipaddr = d.GetResult();
+ if (forward)
+ ipaddr = d.GetResultIP();
+ else
+ ipaddr = d.GetResult();
strlcpy(resolvedHost,ipaddr.c_str(),MAXBUF);
return (ipaddr != "");
}