summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim P <jim@pingle.org>2012-11-05 17:27:22 -0800
committerJim P <jim@pingle.org>2012-11-05 17:27:22 -0800
commitd153e9a38aaddb8b960c6b3ee0bebc7e73b33fb0 (patch)
tree8feb382fdc06255b7f80d2dfb2c832bc4925ac1b
parent1e1e1ec8b1bf4c7bc0737c1caa82ff4f0a6a922e (diff)
parent426fc7d389248df2a3c5cf135aa75f4acdef437a (diff)
downloadpfsense-d153e9a38aaddb8b960c6b3ee0bebc7e73b33fb0.zip
pfsense-d153e9a38aaddb8b960c6b3ee0bebc7e73b33fb0.tar.gz
Merge pull request #246 from PiBa-NL/master
sorting improvement 1.2.3.4:123 and *:1234 & update snapshot contents against .sha256
-rwxr-xr-xetc/rc.initial.firmware_update30
-rw-r--r--usr/local/www/javascript/sorttable.js59
2 files changed, 59 insertions, 30 deletions
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
index f4363c6..c53b115 100755
--- a/etc/rc.initial.firmware_update
+++ b/etc/rc.initial.firmware_update
@@ -87,28 +87,28 @@ switch ($command) {
fclose($fp);
die;
}
- $status = does_url_exist("$url.md5");
+ $status = does_url_exist("$url.sha256");
if($status) {
- echo "\nFetching MD5...\n";
- exec("fetch -1 -w15 -a -v -o /root/firmware.tgz.md5 \"$url.md5\"");
+ echo "\nFetching sha256...\n";
+ exec("fetch -1 -w15 -a -v -o /root/firmware.tgz.sha256 \"$url.sha256\"");
} else {
echo "\n\nWARNING.\n";
- echo "\nCould not locate a MD5 file. We cannot verify the download once completed.\n\n";
+ echo "\nCould not locate a sha256 file. We cannot verify the download once completed.\n\n";
sleep(15);
}
- if(file_exists("/root/firmware.tgz.md5")) {
- $source_md5 = trim(`cat /root/firmware.tgz.md5 | awk '{ print \$4 }'`,"\r");
- $file_md5 = trim(`md5 /root/firmware.tgz | awk '{ print \$4 }'`,"\r");
- echo "URL MD5: $source_md5\n";
- echo "Downloaded file MD5: $file_md5\n";
- if($source_md5 <> $file_md5) {
- echo "\n\nMD5 checksum does not match. Cancelling upgrade.\n\n";
- exec("rm -f /root/*.md5");
+ if(file_exists("/root/firmware.tgz.sha256")) {
+ $source_sha256 = trim(`cat /root/firmware.tgz.sha256 | awk '{ print \$4 }'`,"\r");
+ $file_sha256 = trim(`sha256 /root/firmware.tgz | awk '{ print \$4 }'`,"\r");
+ echo "URL sha256: $source_sha256\n";
+ echo "Downloaded file sha256: $file_sha256\n";
+ if($source_sha256 <> $file_sha256) {
+ echo "\n\nsha256 checksum does not match. Cancelling upgrade.\n\n";
+ exec("rm -f /root/*.sha256");
fclose($fp);
die -1;
}
- echo "\nMD5 checksum matches.\n";
- exec("rm -f /root/*.md5");
+ echo "\nsha256 checksum matches.\n";
+ exec("rm -f /root/*.sha256");
}
if(strstr($url,"bdiff")) {
echo "Binary DIFF upgrade file detected...\n";
@@ -224,7 +224,7 @@ function do_upgrade($path, $type) {
clear_subsystem_dirty('firmwarelock');
}
-exec("rm -f /root/*.md5");
+exec("rm -f /root/*.sha256");
fclose($fp);
?>
diff --git a/usr/local/www/javascript/sorttable.js b/usr/local/www/javascript/sorttable.js
index e86ba5d..ce2e68a 100644
--- a/usr/local/www/javascript/sorttable.js
+++ b/usr/local/www/javascript/sorttable.js
@@ -19,6 +19,7 @@
2012-09-15 Allow for multiple header rows, using "sortableHeaderRowIdentifier" class for the TR that has the column headers. (used in firewall-log)
2012-09-15 Allow sorting multiple dual/mutlti rows together, using sortablemultirow="2" attribute for the table
2012-09-15 Allow sorting of IP:Port texts, changed sort compare function
+ 2012-11-05 Allow sorting of IP:Port and *:port texts toghether also AAA_23 AAA_123 in 'numeric order' (used in Diagnostics\Sockets column LOCAL)
*/
@@ -341,11 +342,39 @@ sorttable = {
if (dt1<dt2) return -1;
return 1;
},
- sort_ipaddr: function(a,b) {
- if (ip2ulong(a[0]) == ip2ulong(b[0])) return 0;
- if (ip2ulong(a[0]) < ip2ulong(b[0])) return -1;
+ sortWithNumber: function(a,b) {
+ amatch = a[0].match(/.*?(?=[0-9])/);
+ bmatch = b[0].match(/.*?(?=[0-9])/);
+ if (amatch && bmatch && amatch[0] == bmatch[0])
+ {
+ anumber = a[0].substring(amatch.length+1);
+ bnumber = b[0].substring(bmatch.length+1);
+ a2match = parseInt(anumber.match(/[0-9]*/));
+ b2match = parseInt(bnumber.match(/[0-9]*/));
+ if (a2match > b2match) return 1;
+ if (a2match < b2match) return -1;
+ }
+ if (a[0] == b[0]) return 0;
+ if (a[0] < b[0]) return -1;
return 1;
},
+ sort_ipaddr: function(a,b) {
+ aip = ip2ulong(a[0]);
+ bip = ip2ulong(b[0]);
+ if (aip && bip)
+ {
+ if (aip == bip) return 0;
+ if (aip < bip) return -1;
+ return 1;
+ } else {
+ if (aip !== false || bip !== false)
+ return aip === false ? -1 : 1;
+ else
+ {
+ return sorttable.sortWithNumber(a,b);
+ }
+ }
+ },
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
@@ -386,25 +415,25 @@ sorttable = {
function ip2ulong(ip) {
ip += "";
var ulip = false;
- var octets = [];
- ipmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/);// IP only
- if (ipmatch) {
- ipmatch+="";
- octets = ipmatch.split('.');
+ var octets = [];
+ ipportmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:[0-9]{1,5}\b/);// IP:port
+ if (ipportmatch) {
+ ipportmatch += "";
+ ipport = ipportmatch.split(':');
+ octets = ipport[0].split('.');
for (i=0; i < 4; i++) {
ulip += octets[i] * Math.pow(256, (5-i));
}
+ ulip += parseInt(ipport[1]);
} else {
- ipportmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:[0-9]{1,5}\b/);// IP:port
- if (ipportmatch) {
- ipportmatch += "";
- ipport = ipportmatch.split(':');
- octets = ipport[0].split('.');
+ ipmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/);// IP only
+ if (ipmatch) {
+ ipmatch+="";
+ octets = ipmatch.split('.');
for (i=0; i < 4; i++) {
ulip += octets[i] * Math.pow(256, (5-i));
}
- ulip += parseInt(ipport[1]);
- }
+ }
}
return ulip;
}
OpenPOWER on IntegriCloud