[Pkg-mozext-commits] [perspectives-extension] 05/12: Perspectives - Fix check for non-routed ips
David Prévot
taffit at alioth.debian.org
Sat Nov 9 14:23:54 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch debian
in repository perspectives-extension.
commit 6b097163a65366c9329b0f41d0e79c440b091eb5
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date: Fri Oct 25 21:01:07 2013 -0600
Perspectives - Fix check for non-routed ips
- Use 'for' instead of 'for in' so we don't have to filter out properties
- Convert regex strings to regex literals so the character escaping is easier
(fix a missing \ and ^ while we're at it)
---
plugin/chrome/content/notaries.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/plugin/chrome/content/notaries.js b/plugin/chrome/content/notaries.js
index c15c5bc..b66c36a 100644
--- a/plugin/chrome/content/notaries.js
+++ b/plugin/chrome/content/notaries.js
@@ -23,10 +23,13 @@ var Perspectives = {
strbundle : null, // this isn't loaded when things are intialized
+ // IP addresses that can't be queried by notary machines
+ // (unless the notary is specifically set up on a private network)
+ // so don't ask about them.
// FIXME: these regexes should be less generous
- nonrouted_ips : [ "^192\.168\.", "^10.", "^172\.1[6-9]\.",
- "^172\.2[0-9]\.", "172\.3[0-1]\.", "^169\.254\.",
- "^127\.0\.0\.1$"], // could add many more
+ nonrouted_ips : [ /^192\.168\./, /^10\./, /^172\.1[6-9]\./,
+ /^172\.2[0-9]\./, /^172\.3[0-1]\./, /^169\.254\./,
+ /^127\.0\.0\.1$/], // could add many more
// list of objects representing each notary server's name + port and public
// key this list is populated by fillNotaryList() based on a file shipped with the
@@ -95,8 +98,8 @@ var Perspectives = {
},
is_nonrouted_ip: function(ip_str) {
- for (regex in Perspectives.nonrouted_ips) {
- if(ip_str.match(RegExp(regex))) {
+ for (var i = 0; i < Perspectives.nonrouted_ips.length; i++) {
+ if (ip_str.match(Perspectives.nonrouted_ips[i])) {
return true;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git
More information about the Pkg-mozext-commits
mailing list