summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_alias.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 55241c278..4e32f2856 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -144,7 +144,13 @@ class ModuleAlias : public Module
std::string compare = original_line.substr(command.length());
while (*(compare.c_str()) == ' ')
compare.erase(compare.begin());
-
+
+ std::string safe(original_line);
+
+ /* Escape out any $ symbols in the user provided text */
+
+ SearchAndReplace(safe, "$", "\r");
+
for (unsigned int i = 0; i < Aliases.size(); i++)
{
if (Aliases[i].text == c)
@@ -184,7 +190,7 @@ class ModuleAlias : public Module
if (crlf == std::string::npos)
{
ServerInstance->Log(DEBUG,"Single line alias: '%s'", Aliases[i].replace_with.c_str());
- DoCommand(Aliases[i].replace_with, user, original_line);
+ DoCommand(Aliases[i].replace_with, user, safe);
return 1;
}
else
@@ -195,7 +201,7 @@ class ModuleAlias : public Module
while ((command = commands.GetToken()) != "")
{
ServerInstance->Log(DEBUG,"Execute: '%s'", command.c_str());
- DoCommand(command, user, original_line);
+ DoCommand(command, user, safe);
}
return 1;
}
@@ -238,6 +244,9 @@ class ModuleAlias : public Module
SearchAndReplace(newline, "$host", user->host);
SearchAndReplace(newline, "$vhost", user->dhost);
+ /* Unescape any variable names in the user text before sending */
+ SearchAndReplace(newline, "\r", "$");
+
irc::tokenstream ss(newline);
const char* parv[127];
int x = 0;