2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 11:42:05 +00:00

Add check for leading zeroes in ip address when running makedns

This adds a check for the presence of leading zeroes in any octet of IPv4 addresses for which DNS entries will be created.
This commit is contained in:
Ryan Bowen 2018-07-10 12:14:08 -04:00 committed by GitHub
parent 297137e1be
commit a75baf8215
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;