only allow a-z A-Z 0-9 - _ [ ] # as channel name characters

This commit is contained in:
Alexey Rybalchenko 2019-06-13 10:41:53 +02:00 committed by Dennis Klein
parent 7bea2bc0e6
commit 3db32b03d4
2 changed files with 5 additions and 3 deletions

View File

@ -106,7 +106,6 @@ if(BUILD_FAIRMQ OR BUILD_SDK)
container container
program_options program_options
filesystem filesystem
regex
date_time date_time
regex regex

View File

@ -11,6 +11,7 @@
#include <boost/algorithm/string.hpp> // join/split #include <boost/algorithm/string.hpp> // join/split
#include <regex>
#include <set> #include <set>
#include <random> #include <random>
@ -480,9 +481,11 @@ try {
} }
// validate channel name // validate channel name
if (fName.find(".") != string::npos) { smatch m;
if (regex_search(fName, m, regex("[^a-zA-Z0-9\\-_\\[\\]#]"))) {
ss << "INVALID"; ss << "INVALID";
LOG(error) << "channel name must not contain '.'"; LOG(debug) << ss.str();
LOG(error) << "channel name contains illegal character: '" << m.str(0) << "', allowed characters are: a-z, A-Z, 0-9, -, _, [, ], #";
return false; return false;
} }