/** Hostname of connection.
* This should be valid as per RFC1035.
*/
- char host[65];
+ std::string host;
/** Stats counter for bytes inbound
*/
/* 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)
}
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;
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
* 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
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;
}
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++)
{
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);
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);
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
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;
}
}
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
{
}
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;
}
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;
}
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;
}
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);
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;
{
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();
{
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;
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;
}
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;
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;
}
}
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");
}
}
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])
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);
{
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;
}
}
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;
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();
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());
}
}
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");
{
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();
{
/* 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
{
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;
}
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);
}
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;
}
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());
}
};
/* 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;
}
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);
/** 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.
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
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);
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;
{
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;
{
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);
}
}
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);
}
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;
}
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;
}
(*(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);
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);
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();
}
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;
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)
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();
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;
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;
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);
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());
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(), "", "");
}