Added some sanity checks
This commit is contained in:
Binary file not shown.
@@ -5,7 +5,7 @@
|
|||||||
include ("Console/Getopt.php");
|
include ("Console/Getopt.php");
|
||||||
|
|
||||||
$VERSION="1.1";
|
$VERSION="1.1";
|
||||||
$AUTHOR="(c) 2012 Jack-Benny Persson (jack-benny@cyberinfo.se)";
|
$AUTHOR="(c) 2013 Jack-Benny Persson (jack-benny@cyberinfo.se)";
|
||||||
|
|
||||||
// Exit codes
|
// Exit codes
|
||||||
$STATE_OK=0;
|
$STATE_OK=0;
|
||||||
@@ -73,6 +73,7 @@ if(sizeof($opts) > 0)
|
|||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
print_help();
|
print_help();
|
||||||
|
exit ($STATE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
@@ -95,6 +96,17 @@ if(sizeof($opts) > 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($filename))
|
||||||
|
{
|
||||||
|
fwrite(STDERR,"A filename is requierd\n");
|
||||||
|
exit($STATE_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($md5))
|
||||||
|
{
|
||||||
|
fwrite(STDERR,"You need to enter an MD5 checksum\n");
|
||||||
|
exit($STATE_UNKNOWN);
|
||||||
|
}
|
||||||
$file = md5_file($filename);
|
$file = md5_file($filename);
|
||||||
|
|
||||||
if ($file == $md5)
|
if ($file == $md5)
|
||||||
|
Reference in New Issue
Block a user