diff options
author | Robby- <robby@chat.be> | 2013-11-13 21:01:24 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-05-28 13:39:23 +0200 |
commit | 9baeec44d07dd7894fbbdb85913337e418deff93 (patch) | |
tree | 61c92336b0e9a4bce55f3ab2969275a59e33f5fa | |
parent | add79a98c6bfa0edeaf2739aedce0d71d9414977 (diff) |
m_ident: Add an option to allow idents of users to still be prefixed with a '~' for connect classes which have disabled ident lookups through the <connect:useident> setting.
Fixes #683.
Some changes by @attilamolnar, original PR #684
-rw-r--r-- | docs/conf/modules.conf.example | 2 | ||||
-rw-r--r-- | src/modules/m_ident.cpp | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 851c69f12..b759f8d5d 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -898,7 +898,7 @@ # the user in a 'connecting' state until the lookup is complete. # # The bind value indicates which IP to bind outbound requests to. # # -#<ident timeout="5"> +#<ident timeout="5" nolookupprefix="no"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Invite exception module: Adds support for channel invite exceptions diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 1e01806b8..ae21c6940 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -268,6 +268,7 @@ class IdentRequestSocket : public EventHandler class ModuleIdent : public Module { int RequestTimeout; + bool NoLookupPrefix; SimpleExtItem<IdentRequestSocket, stdalgo::culldeleter> ext; public: ModuleIdent() : ext("ident_socket", this) @@ -281,9 +282,11 @@ class ModuleIdent : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - RequestTimeout = ServerInstance->Config->ConfValue("ident")->getInt("timeout", 5); + ConfigTag* tag = ServerInstance->Config->ConfValue("ident"); + RequestTimeout = tag->getInt("timeout", 5); if (!RequestTimeout) RequestTimeout = 5; + NoLookupPrefix = tag->getBool("nolookupprefix", false); } void OnUserInit(LocalUser *user) CXX11_OVERRIDE @@ -314,7 +317,11 @@ class ModuleIdent : public Module /* Does user have an ident socket attached at all? */ IdentRequestSocket *isock = ext.get(user); if (!isock) + { + if ((NoLookupPrefix) && (user->ident[0] != '~')) + user->ident.insert(user->ident.begin(), 1, '~'); return MOD_RES_PASSTHRU; + } time_t compare = isock->age; compare += RequestTimeout; |