diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-29 12:08:23 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-29 12:08:23 -0500 |
commit | a8230b7464e7fe71a551a0c987f5b994eab36e93 (patch) | |
tree | 2fdc57fd42ce0bc2b95f3a903dc758a0fb53e0fd /hscript | |
parent | bad42ab94bb518b334521ac5394421e6513d55d8 (diff) | |
download | horizon-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')
-rw-r--r-- | hscript/meta.cc | 4 |
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", |