X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ident.cpp;h=f0ced1db79789ba313711dc97defae384f1dc8b1;hb=a5d110282a864fd2e91b51ce360a977cd0643657;hp=4d66a739ebf7af2fa2f53eff843fe7d88d490307;hpb=71d53e4883cdb83b50f43cd934ac9b4cd2b95383;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 4d66a739e..f0ced1db7 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -235,10 +235,16 @@ class IdentRequestSocket : public EventHandler */ ibuf[recvresult] = '\0'; std::string buf(ibuf); - std::string::size_type lastcolon = buf.rfind(':'); - if (lastcolon == std::string::npos) + + /* <2 colons: invalid + * 2 colons: reply is an error + * >3 colons: there is a colon in the ident + */ + if (std::count(buf.begin(), buf.end(), ':') != 3) return; + std::string::size_type lastcolon = buf.rfind(':'); + /* Truncate the ident at any characters we don't like, skip leading spaces */ for (std::string::const_iterator i = buf.begin()+lastcolon+1; i != buf.end(); ++i) { @@ -356,7 +362,7 @@ class ModuleIdent : public Module /* wooo, got a result (it will be good, or bad) */ if (isock->result.empty()) { - user->ident.insert(0, 1, '~'); + user->ident.insert(user->ident.begin(), 1, '~'); user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead.", user->ident.c_str()); } else @@ -365,6 +371,7 @@ class ModuleIdent : public Module user->WriteServ("NOTICE Auth :*** Found your ident, '%s'", user->ident.c_str()); } + user->InvalidateCache(); isock->Close(); ext.unset(user); return MOD_RES_PASSTHRU;