summaryrefslogtreecommitdiff
path: root/hscript/meta.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-29 12:08:23 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-29 12:08:23 -0500
commita8230b7464e7fe71a551a0c987f5b994eab36e93 (patch)
tree2fdc57fd42ce0bc2b95f3a903dc758a0fb53e0fd /hscript/meta.cc
parentbad42ab94bb518b334521ac5394421e6513d55d8 (diff)
downloadhorizon-a8230b7464e7fe71a551a0c987f5b994eab36e93.tar.gz
horizon-a8230b7464e7fe71a551a0c987f5b994eab36e93.tar.bz2
horizon-a8230b7464e7fe71a551a0c987f5b994eab36e93.tar.xz
horizon-a8230b7464e7fe71a551a0c987f5b994eab36e93.zip
hscript: Use string instead of regex for hostname validation
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r--hscript/meta.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc
index d935ca4..3b3ee3d 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -26,8 +26,8 @@ using namespace Horizon::Keys;
Key *Hostname::parseFromData(const std::string &data, int lineno, int *errors,
int *) {
- std::regex valid_re("[A-Za-z0-9-_.]*");
- if(!std::regex_match(data, valid_re)) {
+ std::string valid_chars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.");
+ if(data.find_first_not_of(valid_chars) != std::string::npos) {
if(errors) *errors += 1;
output_error("installfile:" + std::to_string(lineno),
"hostname: expected machine or DNS name",