summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/modules.conf.example3
-rw-r--r--src/modules/m_ident.cpp39
2 files changed, 31 insertions, 11 deletions
diff --git a/conf/modules.conf.example b/conf/modules.conf.example
index 7d89163ba..f1173decd 100644
--- a/conf/modules.conf.example
+++ b/conf/modules.conf.example
@@ -748,6 +748,9 @@
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Ident: Provides RFC 1413 ident lookup support
+# When this module is loaded <connect:allow> tags may have an optional
+# useident="yes|no" boolean value, determining whether or not to lookup
+# ident on users matching that connect tag.
#<module name="m_ident.so">
#
#-#-#-#-#-#-#-#-#-#-#-#- IDENT CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#
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 &param)
{
- 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)