summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:30 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-06-02 22:05:30 +0000
commit3121018425bc40fea6936f76048eae9fb62707aa (patch)
treebf8f240a64084def0b25efd76b7162763d217628 /etc
parented4b63b09785b89f5dcbd2517ff0bfd20632be85 (diff)
downloadpfsense-3121018425bc40fea6936f76048eae9fb62707aa.zip
pfsense-3121018425bc40fea6936f76048eae9fb62707aa.tar.gz
Close STDIN ($fp) handle before returning back to shell. Major doh's.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.initial.defaults4
-rwxr-xr-xetc/rc.initial.firmware_update16
-rwxr-xr-xetc/rc.initial.halt3
-rwxr-xr-xetc/rc.initial.password5
-rwxr-xr-xetc/rc.initial.ping2
-rwxr-xr-xetc/rc.initial.reboot2
6 files changed, 27 insertions, 5 deletions
diff --git a/etc/rc.initial.defaults b/etc/rc.initial.defaults
index 8938892..0bfeec2 100755
--- a/etc/rc.initial.defaults
+++ b/etc/rc.initial.defaults
@@ -59,4 +59,6 @@ EOD;
system_reboot_sync();
}
-?>
+
+ fclose($fp);
+?> \ No newline at end of file
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
index eb731ad..210872d 100755
--- 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");
diff --git a/etc/rc.initial.halt b/etc/rc.initial.halt
index 444ddb2..c1fbaa9 100755
--- a/etc/rc.initial.halt
+++ b/etc/rc.initial.halt
@@ -55,4 +55,7 @@ EOD;
system_halt();
}
+
+ fclose($fp);
+
?>
diff --git a/etc/rc.initial.password b/etc/rc.initial.password
index 6e7e6ce..9afc90b 100755
--- a/etc/rc.initial.password
+++ b/etc/rc.initial.password
@@ -66,6 +66,7 @@ EOD;
fgets($fp);
}
- sync_webgui_passwords();
-
+ 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..d9e39c8 100755
--- a/etc/rc.initial.ping
+++ b/etc/rc.initial.ping
@@ -45,4 +45,6 @@
echo "\nPress ENTER to continue.\n";
fgets($fp);
}
+
+ fclose($fp);
?>
diff --git a/etc/rc.initial.reboot b/etc/rc.initial.reboot
index 1dfabfc..26804a1 100755
--- a/etc/rc.initial.reboot
+++ b/etc/rc.initial.reboot
@@ -53,4 +53,6 @@ EOD;
system_reboot_sync();
}
+
+ fclose($fp);
?>
OpenPOWER on IntegriCloud