]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_cloaking.cpp
kick_channel -> chanrec::KickUser(), server_kick_channel -> chanrec::ServerKickUser()
[user/henk/code/inspircd.git] / src / modules / m_cloaking.cpp
index ab13708ea583d181cd03c5b2dfc9e6179b2d4590..1e1826b4199c0e3a0eb5b7f9e4e4beb5f28575d2 100644 (file)
@@ -290,7 +290,13 @@ class CloakUser : public ModeHandler
                /* Only opers can change other users modes */
                if ((source != dest) && (!*source->oper))
                        return MODEACTION_DENY;
-               
+
+               /* For remote clients, we dont take any action, we just allow it.
+                * The local server where they are will set their cloak instead.
+                */
+               if (!IS_LOCAL(dest))
+                       return MODEACTION_ALLOW;
+
                if (adding)
                {
                        if(!dest->IsModeSet('x'))
@@ -304,20 +310,24 @@ class CloakUser : public ModeHandler
                                 * are connecting via localhost) -- this doesnt matter much.
                                 */
                        
-                               if (strchr(dest->host,'.'))
+                               if (strchr(dest->host,'.') || strchr(dest->host,':'))
                                {
                                        /* InspIRCd users have two hostnames; A displayed
                                         * hostname which can be modified by modules (e.g.
                                         * to create vhosts, implement chghost, etc) and a
                                         * 'real' hostname which you shouldnt write to.
                                         */
-                               
-                                       std::string a = strstr(dest->host,".");
+
+                                       char* n = strstr(dest->host,".");
+                                       if (!n)
+                                               n = strstr(dest->host,":");
+
+                                       std::string a = n;
                                        
                                        char ra[64];
                                        this->GenHash(dest->host,ra);
                                        std::string b = "";
-                                       in_addr testaddr;
+                                       insp_inaddr testaddr;
                                        std::string hostcloak = prefix + "-" + std::string(ra) + a;
                                
                                        /* Fix by brain - if the cloaked host is > the max length of a host (64 bytes
@@ -325,8 +335,8 @@ class CloakUser : public ModeHandler
                                         * 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 ((insp_aton(dest->host,&testaddr) < 1) && (hostcloak.length() < 64))
                                        {
                                                // if they have a hostname, make something appropriate
                                                b = hostcloak;