summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:43 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:43 +0000
commit5397d0ebad0fd4e47aa52ca54d346985dae7fda9 (patch)
tree0f8e2aa7c94a01e7fdadd5e6160f70049dbf0a00 /etc
parent2106861ba9caaccba567de1b8b6148ae15ea36cc (diff)
downloadpfsense-5397d0ebad0fd4e47aa52ca54d346985dae7fda9.zip
pfsense-5397d0ebad0fd4e47aa52ca54d346985dae7fda9.tar.gz
Close STDIN ($fp) handle before returning back to shell. Major doh's.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.initial.defaults3
-rwxr-xr-xetc/rc.initial.halt5
-rwxr-xr-xetc/rc.initial.password2
-rwxr-xr-xetc/rc.initial.ping3
-rwxr-xr-xetc/rc.initial.reboot3
-rw-r--r--etc/rc.initial_firmware_update16
6 files changed, 29 insertions, 3 deletions
diff --git a/etc/rc.initial.defaults b/etc/rc.initial.defaults
index 8938892..97b03eb 100755
--- a/etc/rc.initial.defaults
+++ b/etc/rc.initial.defaults
@@ -59,4 +59,7 @@ EOD;
system_reboot_sync();
}
+
+ fclose($fp);
+
?>
diff --git a/etc/rc.initial.halt b/etc/rc.initial.halt
index 444ddb2..1d1a784 100755
--- a/etc/rc.initial.halt
+++ b/etc/rc.initial.halt
@@ -55,4 +55,7 @@ EOD;
system_halt();
}
-?>
+
+ fclose($fp);
+
+?> \ No newline at end of file
diff --git a/etc/rc.initial.password b/etc/rc.initial.password
index 6e7e6ce..d944546 100755
--- a/etc/rc.initial.password
+++ b/etc/rc.initial.password
@@ -68,4 +68,6 @@ EOD;
sync_webgui_passwords();
+ fclose($fp);
+
?> \ No newline at end of file
diff --git a/etc/rc.initial.ping b/etc/rc.initial.ping
index dcbf154..1f96d88 100755
--- a/etc/rc.initial.ping
+++ b/etc/rc.initial.ping
@@ -45,4 +45,7 @@
echo "\nPress ENTER to continue.\n";
fgets($fp);
}
+
+ fclose($fp);
+
?>
diff --git a/etc/rc.initial.reboot b/etc/rc.initial.reboot
index 1dfabfc..aeed301 100755
--- a/etc/rc.initial.reboot
+++ b/etc/rc.initial.reboot
@@ -53,4 +53,7 @@ EOD;
system_reboot_sync();
}
+
+ fclose($fp);
+
?>
diff --git a/etc/rc.initial_firmware_update b/etc/rc.initial_firmware_update
index eb731ad..210872d 100644
--- a/etc/rc.initial_firmware_update
+++ b/etc/rc.initial_firmware_update
@@ -31,13 +31,16 @@ switch ($command) {
case "q":
case "quit":
echo "\n";
+ fclose($fp);
die;
break;
case "1":
echo "\nEnter the URL to the .tgz update file:\n> ";
$url = chop(fgets($fp));
- if(!$url)
+ if(!$url) {
+ fclose($fp);
die;
+ }
$status = does_url_exist($url);
if($status) {
conf_mount_rw();
@@ -49,10 +52,12 @@ switch ($command) {
exec("fetch -1 -w15 -a -v -o /root/firmware.tgz \"$url\"");
if($file_size <> filesize("/root/firmware.tgz")) {
echo "\nFile size mismatch. Upgrade cancelled.\n\n";
+ fclose($fp);
die;
}
if(!file_exists("/root/firmware.tgz")) {
echo "Something went wrong during file transfer. Exiting.\n\n";
+ fclose($fp);
die;
}
$status = does_url_exist("$url.md5");
@@ -71,6 +76,7 @@ switch ($command) {
echo "Downloaded file MD5: $file_md5\n";
if($source_md5 <> $file_md5) {
echo "\n\nMD5 checksum does not match. Cancelling upgrade.\n\n";
+ fclose($fp);
die -1;
}
echo "\nMD5 checksum matches.\n";
@@ -79,21 +85,27 @@ switch ($command) {
do_upgrade("/root/firmware.tgz");
} else {
echo "\nCould not download update.\n\n";
+ fclose($fp);
die -1;
}
case "2":
echo "\nEnter the complete path to the .tgz update file: ";
$path = chop(fgets($fp));
- if(!$path)
+ if(!$path) {
+ fclose($fp);
die;
+ }
if(file_exists($path)) {
do_upgrade($path);
} else {
echo "\nCould not find file.\n\n";
+ fclose($fp);
die -1;
}
}
+fclose($fp);
+
function do_upgrade($path) {
echo "\nOne moment please... Invoking firmware upgrade...\n";
exec("/etc/rc.firmware pfSenseupgrade $path");
OpenPOWER on IntegriCloud