diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-31 00:30:04 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-08-31 00:30:04 +0000 |
commit | 5e2eaff8b76f4ecf395b78484fac6b93f1afefe7 (patch) | |
tree | 1f1a4e0a1698876fe806aa86259d3b90ad20c958 /src | |
parent | 42aadffd87e1323b67860ace23cd5e16a6d9bb97 (diff) |
Add <connect:useident> as part of m_ident, original suggestion from various people, including satmd.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10357 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_ident.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 835250607..ba766319e 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -77,12 +77,10 @@ class IdentRequestSocket : public EventHandler { private: - - User *user; /* User we are attached to */ - InspIRCd* ServerInstance; /* Server instance */ - bool done; /* True if lookup is finished */ - std::string result; /* Holds the ident string if done */ - + User *user; /* User we are attached to */ + InspIRCd* ServerInstance; /* Server instance */ + bool done; /* True if lookup is finished */ + std::string result; /* Holds the ident string if done */ public: IdentRequestSocket(InspIRCd *Server, User* u, const std::string &bindip) : user(u), ServerInstance(Server), result(u->ident) @@ -339,32 +337,51 @@ class ModuleIdent : public Module { private: int RequestTimeout; + ConfigReader *Conf; public: - ModuleIdent(InspIRCd *Me) - : Module(Me) + ModuleIdent(InspIRCd *Me) : Module(Me) { + Conf = new ConfigReader(ServerInstance); OnRehash(NULL, ""); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); } + ~ModuleIdent() + { + delete Conf; + } + virtual Version GetVersion() { return Version("$Id$", VF_VENDOR, API_VERSION); } - virtual void OnRehash(User *user, const std::string ¶m) { - ConfigReader MyConf(ServerInstance); + delete Conf; + Conf = new ConfigReader(ServerInstance); - RequestTimeout = MyConf.ReadInteger("ident", "timeout", 0, true); + RequestTimeout = Conf->ReadInteger("ident", "timeout", 0, true); if (!RequestTimeout) RequestTimeout = 5; } virtual int OnUserRegister(User *user) { + for (int j = 0; j < Conf->Enumerate("connect"); j++) + { + std::string hostn = Conf->ReadValue("connect","allow",j); + /* XXX: Fixme: does not respect port, limit, etc */ + if ((InspIRCd::MatchCIDR(user->GetIPString(),hostn)) || (InspIRCd::Match(user->host,hostn))) + { + bool useident = Conf->ReadFlag("connect", "useident", j); + + if (!useident) + return 0; + } + } + /* User::ident is currently the username field from USER; with m_ident loaded, that * should be preceded by a ~. The field is actually IdentMax+2 characters wide. */ if (user->ident.length() > ServerInstance->Config->Limits.IdentMax + 1) |