Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions mod.cservice/CERTCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,10 @@ bool CERTCommand::Exec([[maybe_unused]] iClient* theClient,
std::stringstream theQuery;
theQuery << "INSERT INTO users_fingerprints (user_id, fingerprint, added_ts, added_by, "
"note) VALUES ("
<< theClient->getAccountID() << ", '" << fingerPrint
<< theClient->getAccountID() << ", '" << escapeSQLChars(fingerPrint)
<< "', date_part('epoch', CURRENT_TIMESTAMP)::int, '"
<< theClient->getRealNickUserHost() << "', '" << note << "')" << std::endl;
<< escapeSQLChars(theClient->getRealNickUserHost()) << "', '"
<< escapeSQLChars(note) << "')" << std::endl;

if (!bot->SQLDb->Exec(theQuery, true)) {
LOGSQL_ERROR(bot->SQLDb);
Expand Down
3 changes: 2 additions & 1 deletion mod.cservice/HELLOCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ bool HELLOCommand::Exec(iClient* theClient, const string& Message) {
* Ensure this e-mail address is not already used
*/
stringstream theQuery;
theQuery << "SELECT id FROM users WHERE lower(email) = '" << st[2] << "'" << ends;
theQuery << "SELECT id FROM users WHERE lower(email) = '" << escapeSQLChars(st[2]) << "'"
<< ends;
if (!bot->SQLDb->Exec(theQuery, true)) {
LOG(ERROR, "SQL error on HELLOCommand, matching e-mail address");
LOGSQL_ERROR(bot->SQLDb);
Expand Down
3 changes: 2 additions & 1 deletion mod.cservice/STATUSCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ bool STATUSCommand::Exec(iClient* theClient, const string& Message) {
}

#ifdef THERETURN_ENABLED
if (theChan->hasW()) {
if (theChan->hasW() &&
(bot->getConfigVar("THERETURN_INTEGRATION")->asInt() != 0 || admLevel >= 750)) {
bot->Notice(theClient, "The channel is also registered with %s.",
bot->getConfwNickName().c_str());
}
Expand Down
6 changes: 3 additions & 3 deletions mod.cservice/WCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ bool WCommand::Exec(iClient* theClient, const string& Message) {
/* Is W on the channel? */
if (!wChanUser) {
bot->Notice(theClient, bot->getResponse(theUser, language::cant_find_on_chan).c_str(),
wClient->getNickName().c_str());
wClient->getNickName().c_str(), theChan->getName().c_str());
return false;
}

Expand All @@ -223,7 +223,7 @@ bool WCommand::Exec(iClient* theClient, const string& Message) {
bot->Write(xQuery);

return true;
} else if (Command == "PURGE") {
} else if (Command == "XPURGE") {
/* Admin? */
if (admLevel < 750) {
bot->Notice(
Expand Down Expand Up @@ -251,7 +251,7 @@ bool WCommand::Exec(iClient* theClient, const string& Message) {
} else {
bot->Notice(theClient,
"%s is flagged as registered with %s in my records. To manually update my "
"records, use /msg X W PURGE %s -f to force unregistration. This should "
"records, use /msg X W XPURGE %s -f to force unregistration. This should "
"ONLY be used if %s is already purged with %s",
theChan->getName().c_str(), wClient->getNickName().c_str(),
theChan->getName().c_str(), theChan->getName().c_str(),
Expand Down
17 changes: 13 additions & 4 deletions mod.cservice/cservice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7962,9 +7962,11 @@ bool cservice::doXQSASL(iServer* theServer, const string& Routing, const string&
for (size_t i = 0; i < st2.size(); ++i) {
if (st2[i].rfind("n=", 0) == 0) {
StringTokenizer st3(st2[i].substr(2));
it->username = st3[0];
if (st3.size() > 1)
it->password = st3[1];
if (!st3.empty()) {
it->username = st3[0];
if (st3.size() > 1)
it->password = st3[1];
}
} else if (st2[i].rfind("r=", 0) == 0)
it->client_nonce = st2[i].substr(2);
}
Expand Down Expand Up @@ -8631,12 +8633,19 @@ bool cservice::doXROplist(iServer* /*theServer*/, const string& Routing, const s
LOG(TRACE, "XQ-OPLIST: Routing: {} Message: {}", Routing, Message);
StringTokenizer st(Message);

/* Need at least "OPLIST <chan> <field>" before inspecting st[1]/st[2]. */
if (st.size() < 3) {
LOG(ERROR, "OPLIST insufficient response parameters");
return false;
}

if (st[2] == "NO") {
LOG(TRACE, "NO oplist reported for channel {}", st[1]);
return true;
}

if (st.size() < 6) {
/* A full OPLIST reply is accessed up to st[8] below. */
if (st.size() < 9) {
LOG(ERROR, "OPLIST insufficient response parameters");
return false;
}
Expand Down