]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Merge pull request #1266 from Adam-/insp20+cloakip
authorAttila Molnar <attilamolnar@hush.com>
Sun, 5 Mar 2017 20:35:03 +0000 (21:35 +0100)
committerGitHub <noreply@github.com>
Sun, 5 Mar 2017 20:35:03 +0000 (21:35 +0100)
m_cloaking: fix host/ip comparisons #1249

12 files changed:
.travis.yml
configure
docs/conf/modules.conf.example
make/calcdep.pl
modulemanager
src/modules/m_dnsbl.cpp
src/modules/m_httpd_stats.cpp
src/modules/m_sasl.cpp
src/modules/m_spanningtree/protocolinterface.cpp
src/socketengines/socketengine_epoll.cpp
src/users.cpp
tools/travis-ci.sh

index 6318025264161fb6087d974fd0b5b75a49a4587f..bb82add9b681014f029101c3e75a69201a3d26d2 100644 (file)
@@ -1,12 +1,13 @@
 compiler:
-  - "clang"
-  - "gcc"
-language: "cpp"
+  - clang
+  - gcc
+dist: trusty
+env:
+  - PURE_STATIC=1
+  -
+language: cpp
 notifications:
   email: false
-os:
-  - "linux"
-  - "osx"
 script:
-  - "sh ./tools/travis-ci.sh"
+  - sh ./tools/travis-ci.sh
 sudo: required
index e8c3deb0d168dd60cae77ca41a228c5bd3f1de00..d3569d0d04c27943da490a5d4531a65d0c15ecea 100755 (executable)
--- a/configure
+++ b/configure
@@ -28,6 +28,7 @@
 
 BEGIN {
        require 5.8.0;
+       push @INC, '.';
 }
 
 use strict;
@@ -876,6 +877,10 @@ print FILEHANDLE "#define MAXBUF " . ($config{MAXBUF}+2) . "\n";
                }
                if ($config{OSNAME} !~ /DARWIN/i) {
                        print FILEHANDLE "#define HAS_CLOCK_GETTIME\n";
+               } else {
+                       print FILEHANDLE "#ifdef MAC_OS_X_VERSION_10_12\n";
+                       print FILEHANDLE "# define HAS_CLOCK_GETTIME\n";
+                       print FILEHANDLE "#endif\n";
                }
                my $use_hiperf = 0;
                if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
index 97d69da90477b77dac16bae68e3d2419d1bc0c5a..acafb327c44275efbff9b18db666eb80db165127 100644 (file)
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # Chanprotect module: Gives +q and +a channel modes.
+#
+# IMPORTANT: This module has been removed in the next major version of
+# InspIRCd. You should use m_customprefix instead.
 #<module name="m_chanprotect.so">
 
 <chanprotect
 # key3, key4; the values must be less than 0x80000000 and should be   #
 # picked at random. Prefix is mandatory, will default to network name #
 # if not specified, and will always have a "-" appended.              #
+#                                                                     #
+# IMPORTANT: The compat-host and compat-ip modes have been removed in #
+# the next major version of InspIRCd. You should ONLY use them if you #
+# need backwards compatibility with InspIRCd 1.2.                     #
 #
 #<cloak mode="half"
 #       key="secret"
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
 # Halfop module: Provides the +h (halfops) channel status mode.
+#
+# IMPORTANT: This module has been removed in the next major version of
+# InspIRCd. You should use m_customprefix instead.
 #<module name="m_halfop.so">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
index 4a759a24a163692ca19682cad0abb44ecc7ff11c..49506dd3be8fe35c05251bad55f477c582880e9b 100755 (executable)
@@ -160,7 +160,7 @@ END
 obj/ld-extra.cmd: $core_src
        \@\$(SOURCEPATH)/make/unit-cc.pl gen-ld\$(VERBOSE) \$\@ \$^ \$>
 
-bin/inspircd: obj/ld-extra.cmd $core_mk
+bin/inspircd: $core_mk obj/ld-extra.cmd
        \@\$(SOURCEPATH)/make/unit-cc.pl static-ld\$(VERBOSE) \$\@ \$^ \$>
 
 inspircd: bin/inspircd
index af5bf113caa6f75b1d16b43bfbb5c8b74d193bb0..b107f2c1fad62032d1b07dd6fd60de7e8374859e 100755 (executable)
@@ -25,6 +25,7 @@ use warnings FATAL => qw(all);
 use make::configure;
 
 BEGIN {
+       push @INC, '.';
        unless (module_installed("LWP::Simple")) {
                die "Your system is missing the LWP::Simple Perl module!";
        }
index d4101686a03c1daaba9115da2a8244e2898838d0..3dea080cee59dd99474510ae5fe5567f4eda3b44 100644 (file)
@@ -70,8 +70,8 @@ class DNSBLResolver : public Resolver
                        int i = countExt.get(them);
                        if (i)
                                countExt.set(them, i - 1);
-                       // Now we calculate the bitmask: 256*(256*(256*a+b)+c)+d
-                       if(result.length())
+                       // All replies should be in 127.0.0.0/8
+                       if (result.compare(0, 4, "127.") == 0)
                        {
                                unsigned int bitmask = 0, record = 0;
                                bool match = false;
@@ -82,6 +82,7 @@ class DNSBLResolver : public Resolver
                                switch (ConfEntry->type)
                                {
                                        case DNSBLConfEntry::A_BITMASK:
+                                               // Now we calculate the bitmask: 256*(256*(256*a+b)+c)+d
                                                bitmask = resultip.s_addr >> 24; /* Last octet (network byte order) */
                                                bitmask &= ConfEntry->bitmask;
                                                match = (bitmask != 0);
@@ -196,7 +197,11 @@ class DNSBLResolver : public Resolver
                                        ConfEntry->stats_misses++;
                        }
                        else
+                       {
+                               if (!result.empty())
+                                       ServerInstance->SNO->WriteGlobalSno('a', "DNSBL: %s returned address outside of acceptable subnet 127.0.0.0/8: %s", ConfEntry->domain.c_str(), result.c_str());
                                ConfEntry->stats_misses++;
+                       }
                }
        }
 
index 2fc7ca7dea33656e4c79dfcf5c7723176daf75f1..e17bf514f0835d494e57f60074bd5e30b009a55a 100644 (file)
@@ -213,7 +213,7 @@ class ModuleHttpStats : public Module
                                        data << "<server>";
                                        data << "<servername>" << b->servername << "</servername>";
                                        data << "<parentname>" << b->parentname << "</parentname>";
-                                       data << "<gecos>" << b->gecos << "</gecos>";
+                                       data << "<gecos>" << Sanitize(b->gecos) << "</gecos>";
                                        data << "<usercount>" << b->usercount << "</usercount>";
 // This is currently not implemented, so, commented out.
 //                                     data << "<opercount>" << b->opercount << "</opercount>";
index 16a15357f57e9eef8720a34d1a3caf01a723324a..649c218098ad682fef9016c6e5bde70b5961e35f 100644 (file)
@@ -268,7 +268,7 @@ class ModuleSASL : public Module
        void init()
        {
                OnRehash(NULL);
-               Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnRehash };
+               Implementation eventlist[] = { I_OnEvent, I_OnUserConnect, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
 
                ServiceProvider* providelist[] = { &auth, &sasl, &authExt };
@@ -283,7 +283,7 @@ class ModuleSASL : public Module
                sasl_target = ServerInstance->Config->ConfValue("sasl")->getString("target", "*");
        }
 
-       ModResult OnUserRegister(LocalUser *user)
+       void OnUserConnect(LocalUser *user)
        {
                SaslAuthenticator *sasl_ = authExt.get(user);
                if (sasl_)
@@ -291,8 +291,6 @@ class ModuleSASL : public Module
                        sasl_->Abort();
                        authExt.unset(user);
                }
-
-               return MOD_RES_PASSTHRU;
        }
 
        Version GetVersion()
index 3ab5dae9df0c9aa5b54fed4fc8c53e4f244bb10d..ca4147fea254807ad7006001bf98a3e357c76bb9 100644 (file)
@@ -137,9 +137,6 @@ void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string
 
 void SpanningTreeProtocolInterface::SendChannel(Channel* target, char status, const std::string &text)
 {
-       std::string cname = target->name;
-       if (status)
-               cname = status + cname;
        TreeServerList list;
        CUList exempt_list;
        Utils->GetListOfServersForChannel(target,list,status,exempt_list);
@@ -154,12 +151,20 @@ void SpanningTreeProtocolInterface::SendChannel(Channel* target, char status, co
 
 void SpanningTreeProtocolInterface::SendChannelPrivmsg(Channel* target, char status, const std::string &text)
 {
-       SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" PRIVMSG "+target->name+" :"+text);
+       std::string cname = target->name;
+       if (status)
+               cname.insert(0, 1, status);
+
+       SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" PRIVMSG "+cname+" :"+text);
 }
 
 void SpanningTreeProtocolInterface::SendChannelNotice(Channel* target, char status, const std::string &text)
 {
-       SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" NOTICE "+target->name+" :"+text);
+       std::string cname = target->name;
+       if (status)
+               cname.insert(0, 1, status);
+
+       SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" NOTICE "+cname+" :"+text);
 }
 
 void SpanningTreeProtocolInterface::SendUserPrivmsg(User* target, const std::string &text)
index f2837777ad7ec7a3ac11e6116be84bc70ca9ca0e..d5f01734782e568d29fbf69457ed7224d1fb25bd 100644 (file)
@@ -25,7 +25,7 @@
 #include "exitcodes.h"
 #include "socketengine.h"
 #include <sys/epoll.h>
-#include <ulimit.h>
+#include <sys/resource.h>
 #include <iostream>
 #define EP_DELAY 5
 
@@ -55,10 +55,11 @@ public:
 EPollEngine::EPollEngine()
 {
        CurrentSetSize = 0;
-       int max = ulimit(4, 0);
-       if (max > 0)
+
+       struct rlimit limit;
+       if (!getrlimit(RLIMIT_NOFILE, &limit))
        {
-               MAX_DESCRIPTORS = max;
+               MAX_DESCRIPTORS = limit.rlim_cur;
        }
        else
        {
index 418f2c9aa3557f187e45eb189c892a07b154970c..af0e15f6549443972e8fe581d10bb37f8d105ca8 100644 (file)
@@ -1398,6 +1398,8 @@ void User::DoHostCycle(const std::string &quitline)
 
        FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions));
 
+       // Users shouldn't see themselves quitting when host cycling
+       exceptions.erase(this);
        for (std::map<User*,bool>::iterator i = exceptions.begin(); i != exceptions.end(); ++i)
        {
                LocalUser* u = IS_LOCAL(i->first);
index 6dbc823008449e4581d91818804ff2d2027b68f4..42b07fa251a37003384dba0059896d76bee3a8aa 100755 (executable)
@@ -4,11 +4,6 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]
 then
        sudo apt-get update --assume-yes
        sudo apt-get install --assume-yes libgeoip-dev libgnutls-dev libldap2-dev libmysqlclient-dev libpcre3-dev libpq-dev libsqlite3-dev libssl-dev libtre-dev
-elif [ "$TRAVIS_OS_NAME" = "osx" ]
-then
-       brew update
-       brew install geoip gnutls mysql-connector-c openssl pcre postgresql sqlite3 tre
-       brew link sqlite3 --force
 else
        >&2 echo "'$TRAVIS_OS_NAME' is an unknown Travis CI environment!"
        exit 1