Commit 6ce55e34 authored by Mike Hibler's avatar Mike Hibler

Take care of some unchecked arguments.

parent 45e15aae
<?php <?php
# #
# Copyright (c) 2003-2013 University of Utah and the Flux Group. # Copyright (c) 2003-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -66,16 +66,35 @@ foreach ($_GET as $key => $value) { ...@@ -66,16 +66,35 @@ foreach ($_GET as $key => $value) {
} }
$interfaces[$ifacenum]["card"] = $ifacenum; $interfaces[$ifacenum]["card"] = $ifacenum;
} else { } else {
echo "Bad interface name $value!"; echo "Bad interface name ". CleanString($value). ", ignored!";
$interfaces[$ifacenum]["bad"] = 1;
continue; continue;
} }
} else if ($vartype == "driver") { } else if ($vartype == "driver") {
$interfaces[$ifacenum]["type"] = $value; if (preg_match("/^([a-z]+)$/i",$value,$matches)) {
$interfaces[$ifacenum]["type"] = $matches[1];
} else {
echo "Bad interface type ". CleanString($value). ", ignored!";
$interfaces[$ifacenum]["bad"] = 1;
continue;
}
} else { } else {
$interfaces[$ifacenum]["mac"] = $value; if (preg_match("/^([0-9a-f]+)$/i",$value,$matches)) {
$interfaces[$ifacenum]["mac"] = $matches[1];
} else {
echo "Bad interface MAC ". CleanString($value). ", ignored!";
$interfaces[$ifacenum]["bad"] = 1;
continue;
}
} }
} }
} }
# weed out bad ones
foreach ($interfaces as $i => $interface) {
if (isset($interface["bad"])) {
unset($interfaces[$i]);
}
}
# #
# Use one of the interfaces to see if this node seems to have already checked # Use one of the interfaces to see if this node seems to have already checked
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment