Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
233de852
Commit
233de852
authored
Jul 22, 2003
by
Robert Ricci
Browse files
Add a check for mal-formed IP addresses, and fix an unitialized value
warning for reverse subnets that have no hosts.
parent
52607ea8
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/named_setup.in
View file @
233de852
...
...
@@ -180,9 +180,13 @@ if ($db_result->numrows > 0) {
# Put it into a map so we can generate the reverse zone file later
#
$IP
=~
/(\d+\.\d+\.\d+)\.(\d+)/
;
my
$subnet
=
$
1
;
my
$host
=
$
2
;
push
@
{
$reverse
{
$subnet
}},
[
$host
,
$node_id
];
if
(
$
1
&&
$
2
)
{
my
$subnet
=
$
1
;
my
$host
=
$
2
;
push
@
{
$reverse
{
$subnet
}},
[
$host
,
$node_id
];
}
else
{
warn
"
Poorly formed IP address
$IP
\n
";
}
}
}
print
MAP
"
\n
";
...
...
@@ -314,9 +318,11 @@ while (my $dirent = readdir(DIR)) {
my
$filename
=
"
$reversedir
/
$basename
.tail
";
open
MAP
,
"
>
$filename
"
||
fatal
("
Couldn't open
$filename
: $!
\n
");
foreach
my
$aref
(
sort
{
$$a
[
0
]
<=>
$$b
[
0
]}
@
{
$reverse
{
$subnet
}})
{
my
(
$host
,
$name
)
=
@$aref
;
printf
MAP
"
$host
\t
IN
\t
PTR
\t
$name
.
$OURDOMAIN
.
\n
";
if
(
$reverse
{
$subnet
})
{
foreach
my
$aref
(
sort
{
$$a
[
0
]
<=>
$$b
[
0
]}
@
{
$reverse
{
$subnet
}})
{
my
(
$host
,
$name
)
=
@$aref
;
printf
MAP
"
$host
\t
IN
\t
PTR
\t
$name
.
$OURDOMAIN
.
\n
";
}
}
close
MAP
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment