summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-09-23 19:08:18 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-09-23 19:08:18 +0200
commit2380a84ba5d304861cd21eb3a2e57d76e32536a0 (patch)
tree0f31b5eeaea281286c7e4b00f5d2514ba3fc6d9d /src
parentf904d57940699e332f75a77062912431c6e51188 (diff)
downloadbiboumi-2380a84ba5d304861cd21eb3a2e57d76e32536a0.tar.gz
biboumi-2380a84ba5d304861cd21eb3a2e57d76e32536a0.tar.bz2
biboumi-2380a84ba5d304861cd21eb3a2e57d76e32536a0.tar.xz
biboumi-2380a84ba5d304861cd21eb3a2e57d76e32536a0.zip
Make sure the user-provided username does not contain spaces
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/biboumi_adhoc_commands.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp
index 10951cd..d9162d7 100644
--- a/src/xmpp/biboumi_adhoc_commands.cpp
+++ b/src/xmpp/biboumi_adhoc_commands.cpp
@@ -13,6 +13,8 @@
#include <louloulibs.h>
+#include <algorithm>
+
using namespace std::string_literals;
void DisconnectUserStep1(XmppComponent* xmpp_component, AdhocSession&, XmlNode& command_node)
@@ -259,7 +261,13 @@ void ConfigureIrcServerStep2(XmppComponent*, AdhocSession& session, XmlNode& com
else if (field->get_tag("var") == "username" &&
value && !value->get_inner().empty())
- options.username = value->get_inner();
+ {
+ auto username = value->get_inner();
+ // The username must not contain spaces
+ std::replace(&username[0], &username[username.size() - 1],
+ ' ', '_');
+ options.username = username;
+ }
else if (field->get_tag("var") == "realname" &&
value && !value->get_inner().empty())