summaryrefslogtreecommitdiff
path: root/src/modules/m_cloaking.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-27 20:17:05 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-27 20:17:05 +0000
commitcac4bef53dcef911e9133705748ab3584dbf9ae1 (patch)
tree11f5a737442763bcfe969916cb351b04258a186b /src/modules/m_cloaking.cpp
parent6dc0b83a416ef200ef7eba04ee6dc7e69842f5cc (diff)
Fix typo in spanningtree (who put this colon here?)
Allow for safer cloaking of hosts > 64 (backport from stable) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3782 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cloaking.cpp')
-rw-r--r--src/modules/m_cloaking.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index cddf2778d..92ae1af6c 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -368,16 +368,22 @@ class ModuleCloaking : public Module
this->GenHash(dest->host,ra);
std::string b = "";
in_addr testaddr;
- if (!inet_aton(dest->host,&testaddr))
- {
- // if they have a hostname, make something appropriate
- b = prefix + "-" + std::string(ra) + a;
- }
- else
- {
- // else, they have an ip
- b = std::string(ra) + "." + prefix + ".cloak";
- }
+ std::string hostcloak = prefix + "-" + std::string(ra) + a;
+ /* Fix by brain - if the cloaked host is > the max length of a host (64 bytes
+ * according to the DNS RFC) then tough titty, they get cloaked as an IP.
+ * Their ISP shouldnt go to town on subdomains, or they shouldnt have a kiddie
+ * vhost.
+ */
+ if ((!inet_aton(dest->host,&testaddr)) && (hostcloak.length() < 64))
+ {
+ // if they have a hostname, make something appropriate
+ b = hostcloak;
+ }
+ else
+ {
+ // else, they have an ip
+ b = std::string(ra) + "." + prefix + ".cloak";
+ }
Srv->Log(DEBUG,"cloak: allocated "+b);
Srv->ChangeHost(dest,b);
}