diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-19 19:12:43 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-05-19 19:12:43 +0000 |
commit | 12427e75fe175fe7a62f388281dd7ab5100c9dda (patch) | |
tree | dde95798e65c424b74e0ce9682ebda4dd1dfa419 /src | |
parent | 5865b900cd950755bee1f7001552951d99529d4d (diff) |
Convert connection::host
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9768 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
28 files changed, 71 insertions, 90 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 887ef0551..e98261e58 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -332,7 +332,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) /* command is disabled! */ user->WriteNumeric(421, "%s %s :This command has been disabled.",user->nick.c_str(),command.c_str()); ServerInstance->SNO->WriteToSnoMask('d', "%s denied for %s (%s@%s)", - command.c_str(), user->nick.c_str(), user->ident.c_str(), user->host); + command.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return do_more; } if (command_p.size() < cm->second->min_params) diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 342910094..6424584e3 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -39,8 +39,8 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User * } else { - ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->host); - ServerInstance->SNO->WriteToSnoMask('A', "Failed DIE Command from %s!%s@%s.",user->nick.c_str(),user->ident.c_str(),user->host); + ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Failed DIE Command from %s!%s@%s.",user->nick.c_str(),user->ident.c_str(),user->host.c_str()); return CMD_FAILURE; } return CMD_SUCCESS; diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 48e1ac84e..f656c5701 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -75,7 +75,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User if (!IS_LOCAL(u)) { // remote kill - ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host, parameters[1].c_str()); + ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host.c_str(), parameters[1].c_str()); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason)); } else @@ -85,7 +85,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User * XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill * snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t */ - ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host, parameters[1].c_str()); + ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick.c_str(), u->nick.c_str(), u->ident.c_str(), u->host.c_str(), parameters[1].c_str()); ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick.c_str(), ServerInstance->Config->ServerName, user->dhost.c_str(), user->nick.c_str(), parameters[1].c_str()); /* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show * hidekillsserver as source if possible diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index a83d0d800..72e3ff17e 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -94,7 +94,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User XLine* mq = ServerInstance->XLines->MatchesLine("Q",parameters[0]); if (mq) { - ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0].c_str(), user->nick.c_str(), user->ident.c_str(), user->host, mq->reason); + ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0].c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str(), mq->reason); user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick.c_str(), parameters[0].c_str(), mq->reason); return CMD_FAILURE; } diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 8a3303093..dc06d87ce 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -54,7 +54,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User bool match_pass = false; bool match_hosts = false; - snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host); + snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host.c_str()); snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString()); for (int i = 0; i < ServerInstance->Config->ConfValueEnum(ServerInstance->Config->config_data, "oper"); i++) @@ -84,7 +84,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User { user->WriteNumeric(491, "%s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick.c_str()); ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType); - ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick.c_str(),user->ident.c_str(),user->host); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return CMD_FAILURE; } ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF); @@ -107,7 +107,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User if (found) { /* correct oper credentials */ - ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick.c_str(),user->ident.c_str(),user->host,irc::Spacify(OperType),parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), irc::Spacify(OperType), parameters[0].c_str()); user->WriteNumeric(381, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType)); if (!user->IsModeSet('o')) user->Oper(OperType, LoginName); @@ -133,11 +133,11 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str()); user->IncreasePenalty(10); - snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick.c_str(),user->ident.c_str(),user->host, parameters[0].c_str(), fields.c_str()); + snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast)); ServerInstance->PI->SendSNONotice("o", std::string("OPER: ") + broadcast); - ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick.c_str(),user->ident.c_str(),user->host,parameters[0].c_str(),fields.c_str()); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); return CMD_FAILURE; } else @@ -148,7 +148,7 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User ServerInstance->SNO->WriteToSnoMask('o', std::string(broadcast)); - ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick.c_str(),user->ident.c_str(),user->host,parameters[0].c_str()); + ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index 7251b1fa6..d72b0f0de 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -24,7 +24,7 @@ CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, Us ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick.c_str()); if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash)) { - ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick.c_str(),user->ident.c_str(),user->host); + ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); try { @@ -38,7 +38,7 @@ CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, Us } else { - ServerInstance->SNO->WriteToSnoMask('A', "Failed RESTART Command from %s!%s@%s.",user->nick.c_str(),user->ident.c_str(),user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Failed RESTART Command from %s!%s@%s.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 093d46c6c..9da5f1aeb 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -53,7 +53,7 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str ServerInstance->SNO->WriteToSnoMask('t', "%s '%c' denied for %s (%s@%s)", (IS_LOCAL(user) ? "Stats" : "Remote stats"), - statschar, user->nick.c_str(), user->ident.c_str(), user->host); + statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str()); results.push_back(sn + " 481 " + user->nick + " :Permission denied - STATS " + statschar + " is oper-only"); return; } @@ -315,6 +315,6 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, str results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report"); ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)", - (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host); + (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return; } diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index 9858ff93a..8afc23525 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -29,7 +29,7 @@ void do_whois(InspIRCd* ServerInstance, User* user, User* dest,unsigned long sig ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str()); if (user == dest || IS_OPER(user)) { - ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host, dest->GetIPString()); + ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString()); } std::string cl = dest->ChannelList(user); diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index efd15e3d6..614598972 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -317,7 +317,7 @@ CommandWhowas::~CommandWhowas() WhoWasGroup::WhoWasGroup(User* user) : host(NULL), dhost(NULL), ident(NULL), server(NULL), gecos(NULL), signon(user->signon) { - this->host = strdup(user->host); + this->host = strdup(user->host.c_str()); this->dhost = strdup(user->dhost.c_str()); this->ident = strdup(user->ident.c_str()); this->server = user->server; diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 77451b47b..9d8bb3bae 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -104,14 +104,14 @@ int CullList::Apply() { if (!u->quietquit) { - ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]",u->nick.c_str(),u->ident.c_str(),u->host,oper_reason.c_str()); + ServerInstance->SNO->WriteToSnoMask('q',"Client exiting: %s!%s@%s [%s]", u->nick.c_str(), u->ident.c_str(), u->host.c_str(), oper_reason.c_str()); } } else { if ((!ServerInstance->SilentULine(u->server)) && (!u->quietquit)) { - ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]",u->server,u->nick.c_str(),u->ident.c_str(),u->host,oper_reason.c_str()); + ServerInstance->SNO->WriteToSnoMask('Q',"Client exiting on server %s: %s!%s@%s [%s]", u->server, u->nick.c_str(), u->ident.c_str(), u->host.c_str(), oper_reason.c_str()); } } u->AddToWhoWas(); diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 74e59c62a..93ca34ff2 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -144,7 +144,7 @@ public: { free(authpass); if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP bind failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host, ldap_err2string(res)); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP bind failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res)); ldap_unbind_ext(conn, NULL, NULL); conn = NULL; return false; @@ -156,20 +156,20 @@ public: if ((res = ldap_search_ext_s(conn, base.c_str(), searchscope, what.c_str(), NULL, 0, NULL, NULL, NULL, 0, &msg)) != LDAP_SUCCESS) { if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host, ldap_err2string(res)); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res)); return false; } if (ldap_count_entries(conn, msg) > 1) { if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search returned more than one result: %s)", user->nick.c_str(), user->ident.c_str(), user->host, ldap_err2string(res)); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search returned more than one result: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res)); ldap_msgfree(msg); return false; } if ((entry = ldap_first_entry(conn, msg)) == NULL) { if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search returned no results: %s)", user->nick.c_str(), user->ident.c_str(), user->host, ldap_err2string(res)); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (LDAP search returned no results: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res)); ldap_msgfree(msg); return false; } @@ -184,7 +184,7 @@ public: else { if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (%s)", user->nick.c_str(), user->ident.c_str(), user->host, ldap_err2string(res)); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (%s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), ldap_err2string(res)); ldap_msgfree(msg); user->Extend("ldapauth_failed"); return false; diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 9ca4473b8..18859d133 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -149,7 +149,7 @@ public: else { if (verbose) - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host, req.error.Str()); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), req.error.Str()); return false; } } @@ -175,13 +175,13 @@ public: else if (verbose) { /* No rows in result, this means there was no record matching the user */ - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick.c_str(), user->ident.c_str(), user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); user->Extend("sqlauth_failed"); } } else if (verbose) { - ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host, res->error.Str()); + ServerInstance->SNO->WriteToSnoMask('A', "Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), res->error.Str()); user->Extend("sqlauth_failed"); } } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 7073e8004..f3c32b140 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -306,7 +306,7 @@ public: if (operhost.size()) user->ChangeDisplayedHost(operhost.c_str()); - ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick.c_str(), user->ident.c_str(), user->host, type.c_str()); + ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), type.c_str()); user->WriteNumeric(381, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str())); if (!user->modes[UM_OPERATOR]) diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp index 3bbaa359e..c99dfa2e2 100644 --- a/src/modules/extra/m_ssl_oper_cert.cpp +++ b/src/modules/extra/m_ssl_oper_cert.cpp @@ -129,7 +129,7 @@ class ModuleOperSSLCert : public Module bool SSLOnly; char* dummy; - snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host); + snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(),user->host.c_str()); snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString()); HasCert = user->GetExt("ssl_cert",cert); @@ -169,7 +169,7 @@ class ModuleOperSSLCert : public Module { user->WriteNumeric(491, "%s :This oper login name requires a matching key fingerprint.",user->nick.c_str()); ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick.c_str()); - ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick.c_str(), user->ident.c_str(), user->host); + ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.", user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return 1; } } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 691c54184..6c99d9d35 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -75,7 +75,7 @@ class CommandWebirc : public Command user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); if (notify) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick.c_str(), user->host, parameters[2].c_str(), user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick.c_str(), user->host.c_str(), parameters[2].c_str(), user->host.c_str()); user->Extend("cgiirc_webirc_hostname", new std::string(parameters[2])); user->Extend("cgiirc_webirc_ip", new std::string(parameters[3])); return CMD_LOCALONLY; @@ -108,10 +108,10 @@ class CGIResolver : public Resolver if ((them) && (them == ServerInstance->SE->GetRef(theirfd))) { if (notify) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick.c_str(), them->host, result.c_str(), typ.c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick.c_str(), them->host.c_str(), result.c_str(), typ.c_str()); - strlcpy(them->host, result.c_str(), 63); - them->dhost.assign(result, 0, 63); + them->host.assign(result,0, 64); + them->dhost.assign(result, 0, 64); them->ident.assign("~cgiirc", 0, 8); them->InvalidateCache(); them->CheckLines(); @@ -123,7 +123,7 @@ class CGIResolver : public Resolver if ((them) && (them == ServerInstance->SE->GetRef(theirfd))) { if (notify) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved from their %s!", them->nick.c_str(), them->host, typ.c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but their host can't be resolved from their %s!", them->nick.c_str(), them->host.c_str(), typ.c_str()); } } @@ -302,8 +302,8 @@ public: std::string *webirc_hostname, *webirc_ip; if(user->GetExt("cgiirc_webirc_hostname", webirc_hostname)) { - strlcpy(user->host,webirc_hostname->c_str(),63); - user->dhost.assign(*webirc_hostname, 0, 63); + user->host.assign(*webirc_hostname, 0, 64); + user->dhost.assign(*webirc_hostname, 0, 64); delete webirc_hostname; user->InvalidateCache(); user->Shrink("cgiirc_webirc_hostname"); @@ -338,7 +338,7 @@ public: { user->Extend("cgiirc_realhost", new std::string(user->host)); user->Extend("cgiirc_realip", new std::string(user->GetIPString())); - strlcpy(user->host, user->password.c_str(), 64); + user->host.assign(user->password, 0, 64); user->dhost.assign(user->password, 0, 64); user->InvalidateCache(); @@ -361,7 +361,7 @@ public: { /* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */ if(NotifyOpers) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick.c_str(), user->host, user->password.c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick.c_str(), user->host.c_str(), user->password.c_str()); } else { @@ -376,15 +376,11 @@ public: catch (...) { if (NotifyOpers) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick.c_str(), user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick.c_str(), user->host.c_str()); } } user->password.clear(); - - /*if(NotifyOpers) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick, user->host, user->password);*/ - return true; } @@ -425,7 +421,7 @@ public: user->CheckClass(); try { - strlcpy(user->host, newip, 16); + user->host.assign(newip, 0, 16); user->dhost.assign(newip, 0, 16); user->ident.assign("~cgiirc", 0, 8); @@ -435,17 +431,14 @@ public: } catch (...) { - strlcpy(user->host, newip, 16); + user->host.assign(newip, 0, 16); user->dhost.assign(newip, 0, 16); user->ident.assign("~cgiirc", 0, 8); user->InvalidateCache(); if(NotifyOpers) - ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick.c_str(), user->host); + ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick.c_str(), user->host.c_str()); } - /*strlcpy(user->host, newip, 16); - strlcpy(user->dhost, newip, 16); - strlcpy(user->ident, "~cgiirc", 8);*/ return true; } diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index d1e17497c..3ce63567e 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -41,9 +41,7 @@ class ModuleChanCreate : public Module virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent) { if (channel->GetUserCounter() == 1) - { - ServerInstance->SNO->WriteToSnoMask('j', "Channel %s created by %s!%s@%s", channel->name, user->nick.c_str(), user->ident.c_str(), user->host); - } + ServerInstance->SNO->WriteToSnoMask('j', "Channel %s created by %s!%s@%s", channel->name, user->nick.c_str(), user->ident.c_str(), user->host.c_str()); } }; diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b5b677172..2cbd8fb99 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -117,7 +117,7 @@ class CloakUser : public ModeHandler /* User is removing the mode, so just restore their real host * and make it match the displayed one. */ - dest->ChangeDisplayedHost(dest->host); + dest->ChangeDisplayedHost(dest->host.c_str()); dest->SetMode('x',false); return MODEACTION_ALLOW; } @@ -361,10 +361,7 @@ class ModuleCloaking : public Module virtual void OnUserConnect(User* dest) { - char* n1 = strchr(dest->host,'.'); - char* n2 = strchr(dest->host,':'); - - if (n1 || n2) + if (dest->host.find('.') != std::string::npos || dest->host.find(':') != std::string::npos) { unsigned int iv[] = { cu->key1, cu->key2, cu->key3, cu->key4 }; std::string a = cu->LastTwoDomainParts(dest->host); @@ -384,10 +381,10 @@ class ModuleCloaking : public Module /** Reset the Hash module, and send it our IV and hex table */ HashResetRequest(this, cu->HashProvider).Send(); HashKeyRequest(this, cu->HashProvider, iv).Send(); - HashHexRequest(this, cu->HashProvider, cu->xtab[(*dest->host) % 4]); + HashHexRequest(this, cu->HashProvider, cu->xtab[(dest->host[0]) % 4]); /* Generate a cloak using specialized Hash */ - std::string hostcloak = cu->prefix + "-" + std::string(HashSumRequest(this, cu->HashProvider, dest->host).Send()).substr(0,8) + a; + std::string hostcloak = cu->prefix + "-" + std::string(HashSumRequest(this, cu->HashProvider, dest->host.c_str()).Send()).substr(0,8) + a; /* Fix by brain - if the cloaked host is > the max length of a host (64 bytes * according to the DNS RFC) then tough titty, they get cloaked as an IP. @@ -408,12 +405,12 @@ class ModuleCloaking : public Module b = ((!strchr(dest->host,':')) ? cu->Cloak4(dest->host) : cu->Cloak6(dest->host)); #else in_addr testaddr; - if ((inet_aton(dest->host,&testaddr) < 1) && (hostcloak.length() <= 64)) + if ((inet_aton(dest->host.c_str(),&testaddr) < 1) && (hostcloak.length() <= 64)) /* Invalid ipv4 address, and ipv4 user (resolved host) */ b = hostcloak; else /* Valid ipv4 address (not resolved) ipv4 user */ - b = cu->Cloak4(dest->host); + b = cu->Cloak4(dest->host.c_str()); #endif } else diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 07055f40a..b7e67b507 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -51,7 +51,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) char TheHost[MAXBUF]; char TheIP[MAXBUF]; - snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host); + snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host.c_str()); snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString()); ConfigReader Conf(ServerInstance); @@ -95,7 +95,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) if (!ServerInstance->ULine(user->server)) // Ulines also fail TITLEs silently - ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'",user->nick.c_str(),user->ident.c_str(),user->host,parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str()); user->WriteServ("NOTICE %s :Invalid title credentials",user->nick.c_str()); return CMD_SUCCESS; diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 2aef64d7a..e295d2183 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -47,13 +47,7 @@ class ModuleOperLog : public Module { Command* thiscommand = ServerInstance->Parser->GetHandler(command); if ((thiscommand) && (thiscommand->flags_needed == 'o')) - { - std::string plist; - for (int j = 0; j < (int)parameters.size(); j++) - plist.append(std::string(" ")+parameters[j]); - - ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick.c_str(), user->ident.c_str(), user->host, command.c_str(), plist.c_str()); - } + ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s %s",user->nick.c_str(), user->ident.c_str(), user->host.c_str(), command.c_str(), irc::stringjoiner(" ", parameters, 0, parameters.size() - 1).GetJoined().c_str()); } return 0; diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index c39649896..a66ea2f98 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -84,11 +84,11 @@ class ModuleShowwhois : public Module { if (IS_LOCAL(dest)) { - dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick.c_str(),source->nick.c_str(),source->ident.c_str(),source->host); + dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you.", dest->nick.c_str(), source->nick.c_str(), source->ident.c_str(), source->host.c_str()); } else { - std::string msg = std::string(":") + dest->server + " NOTICE " + dest->nick + " :*** " + source->nick + " (" + source->ident + "@" + source->host + ") did a /whois on you."; + std::string msg = std::string(":") + dest->server + " NOTICE " + dest->nick + " :*** " + source->nick + " (" + source->ident + "@" + source->host.c_str() + ") did a /whois on you."; ServerInstance->PI->PushToClient(dest, msg); } } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index b1f63c01b..3a28ca8a9 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -222,7 +222,7 @@ void TreeSocket::SendUsers(TreeServer* Current) if (theirserver) { snprintf(data,MAXBUF,":%s UID %s %lu %s %s %s %s +%s %s %lu :%s", theirserver->GetID().c_str(), u->second->uuid.c_str(), - (unsigned long)u->second->age, u->second->nick.c_str(), u->second->host, u->second->dhost.c_str(), + (unsigned long)u->second->age, u->second->nick.c_str(), u->second->host.c_str(), u->second->dhost.c_str(), u->second->ident.c_str(), u->second->FormatModes(), u->second->GetIPString(), (unsigned long)u->second->signon, u->second->fullname.c_str()); this->WriteLine(data); diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index a5bd07416..a2aff74f9 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -57,7 +57,7 @@ bool TreeSocket::OperType(const std::string &prefix, std::deque<std::string> &pa } if (dosend) - this->Instance->SNO->WriteToSnoMask('o',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(),u->host,irc::Spacify(opertype.c_str())); + this->Instance->SNO->WriteToSnoMask('o',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str())); } return true; } diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index 740694643..ab50f7656 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -72,7 +72,7 @@ int ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i].Name.c_str()); } results.push_back(std::string(ServerInstance->Config->ServerName)+" 219 "+user->nick+" "+statschar+" :End of /STATS report"); - ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",(!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"),statschar,user->nick.c_str(),user->ident.c_str(),user->host); + ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)", (!strcmp(user->server,ServerInstance->Config->ServerName) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return 1; } diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index f68da8a1c..e539e0b18 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -112,7 +112,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa (*(this->Instance->Users->clientlist))[tempnick] = _new; _new->SetFd(FD_MAGIC_NUMBER); _new->nick.assign(tempnick, NICKMAX - 1); - strlcpy(_new->host, params[3].c_str(),64); + _new->host.assign(params[3], 0, 64); _new->dhost.assign(params[4], 0, 64); _new->server = this->Instance->FindServerNamePtr(remoteserver->GetName().c_str()); _new->ident.assign(params[5], 0, IDENTMAX + 1); @@ -157,7 +157,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa dosend = false; if (dosend) - this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]",_new->server,_new->nick.c_str(),_new->ident.c_str(),_new->host, _new->GetIPString(), _new->fullname.c_str()); + this->Instance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s!%s@%s [%s] [%s]", _new->server, _new->nick.c_str(), _new->ident.c_str(), _new->host.c_str(), _new->GetIPString(), _new->fullname.c_str()); params[9] = ":" + params[9]; Utils->DoOneToAllButSender(source, "UID", params, source); diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index b962be781..8dec4c541 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -71,13 +71,13 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, if ((this->bound_user->registered != REG_ALL) && (!this->bound_user->dns_done)) { /* Hostnames starting with : are not a good thing (tm) */ - if (*(hostname.c_str()) == ':') + if (hostname[0] == ':') hostname.insert(0, "0"); this->bound_user->WriteServ("NOTICE Auth :*** Found your hostname (%s)%s", hostname.c_str(), (cached ? " -- cached" : "")); this->bound_user->dns_done = true; this->bound_user->dhost.assign(hostname, 0, 64); - strlcpy(this->bound_user->host, hostname.c_str(),64); + this->bound_user->host.assign(hostname, 0, 64); /* Invalidate cache */ this->bound_user->InvalidateCache(); } diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 834ff3e20..f18ea91d4 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -192,7 +192,7 @@ void UserManager::AddUser(InspIRCd* Instance, int socket, int port, bool iscache void UserManager::QuitUser(User *user, const std::string &quitreason, const char* operreason) { ServerInstance->Logs->Log("USERS", DEBUG,"QuitUser: %s '%s'", user->nick.c_str(), quitreason.c_str()); - user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident.c_str(), user->host, *operreason ? operreason : quitreason.c_str()); + user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident.c_str(), user->host.c_str(), *operreason ? operreason : quitreason.c_str()); user->quietquit = false; user->quitmsg = quitreason; diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 11fcfa59c..3dc3143de 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -21,10 +21,10 @@ void FloodQuitUserHandler::Call(User* current) { - Server->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident.c_str(), current->host); + Server->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident.c_str(), current->host.c_str()); Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s", current->registered == REG_ALL ? current->nick.c_str() : "", - current->registered == REG_ALL ? "!" : "", current->ident.c_str(), current->host); + current->registered == REG_ALL ? "!" : "", current->ident.c_str(), current->host.c_str()); Server->Users->QuitUser(current, "Excess flood"); if (current->registered != REG_ALL) diff --git a/src/users.cpp b/src/users.cpp index aa9d570ac..45052e8cb 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -185,7 +185,6 @@ void User::DecrementModes() User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance) { - *host = 0; server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName); reset_due = ServerInstance->Time(); age = ServerInstance->Time(); @@ -283,7 +282,7 @@ const std::string& User::MakeHost() for(const char* n = ident.c_str(); *n; n++) *t++ = *n; *t++ = '@'; - for(const char* n = host; *n; n++) + for(const char* n = host.c_str(); *n; n++) *t++ = *n; *t = 0; @@ -383,7 +382,7 @@ const std::string& User::GetFullRealHost() for(const char* n = ident.c_str(); *n; n++) *t++ = *n; *t++ = '@'; - for(char* n = host; *n; n++) + for(const char* n = host.c_str(); *n; n++) *t++ = *n; *t = 0; @@ -721,7 +720,7 @@ void User::Oper(const std::string &opertype, const std::string &opername) this->modes[UM_OPERATOR] = 1; this->WriteServ("MODE %s :+o", this->nick.c_str()); FOREACH_MOD(I_OnOper, OnOper(this, opertype)); - ServerInstance->Logs->Log("OPER", DEFAULT, "%s!%s@%s opered as type: %s", this->nick.c_str(), this->ident.c_str(), this->host, opertype.c_str()); + ServerInstance->Logs->Log("OPER", DEFAULT, "%s!%s@%s opered as type: %s", this->nick.c_str(), this->ident.c_str(), this->host.c_str(), opertype.c_str()); this->oper.assign(opertype, 0, NICKMAX - 1); ServerInstance->Users->all_opers.push_back(this); @@ -931,7 +930,7 @@ void User::FullConnect() CheckLines(); this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network); - this->WriteNumeric(001, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick.c_str(), ServerInstance->Config->Network, this->nick.c_str(), this->ident.c_str(), this->host); + this->WriteNumeric(001, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick.c_str(), ServerInstance->Config->Network, this->nick.c_str(), this->ident.c_str(), this->host.c_str()); this->WriteNumeric(002, "%s :Your host is %s, running version InspIRCd-1.2",this->nick.c_str(),ServerInstance->Config->ServerName); this->WriteNumeric(003, "%s :This server was created %s %s", this->nick.c_str(), __TIME__, __DATE__); this->WriteNumeric(004, "%s %s InspIRCd-1.2 %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str()); @@ -962,7 +961,7 @@ void User::FullConnect() FOREACH_MOD(I_OnPostConnect,OnPostConnect(this)); - ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d: %s!%s@%s [%s] [%s]", this->GetPort(), this->nick.c_str(), this->ident.c_str(), this->host, this->GetIPString(), this->fullname.c_str()); + ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d: %s!%s@%s [%s] [%s]", this->GetPort(), this->nick.c_str(), this->ident.c_str(), this->host.c_str(), this->GetIPString(), this->fullname.c_str()); ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding NEGATIVE hit for %s", this->GetIPString()); ServerInstance->BanCache->AddHit(this->GetIPString(), "", ""); } |