From 2380a84ba5d304861cd21eb3a2e57d76e32536a0 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 23 Sep 2015 19:08:18 +0200 Subject: Make sure the user-provided username does not contain spaces --- src/xmpp/biboumi_adhoc_commands.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/xmpp') 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 +#include + 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()) -- cgit v1.2.3