2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Merge pull request #5390 from ryanbowen/patch-2

Add check for leading zeroes in ip address when running makedns
This commit is contained in:
Yuan Bai 2018-07-11 13:10:37 +08:00 committed by GitHub
commit 59fe200184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,6 +437,10 @@ sub process_request {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
next;
}
if ($addr =~ /(?:^|\.)0+(?=\d)/ and $addr !~ /^[abcdef0123456789:]+$/) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, ip address octets can not contain leading zeroes.", $callback);
next;
}
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
next;