diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-27 23:36:03 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-27 14:54:02 -0300 |
commit | 6b7ae4af2590906c243851584afb84c3793d0ca4 (patch) | |
tree | 70ce1e2b1fb96361f25085c8b26e2103adc5612f /etc | |
parent | afa0d32af71fbc2b9bd03b6c5c4536ce795f50e4 (diff) | |
download | pfsense-6b7ae4af2590906c243851584afb84c3793d0ca4.zip pfsense-6b7ae4af2590906c243851584afb84c3793d0ca4.tar.gz |
Strip any \r when parsing URL table ports file
If the URL table ports file at the URL specified has lines separated by "\r\n" rather than just "\n", then the code here ends up with ports that look like "80\r" "443\r" ... and group_ports() does not match any of those and the final file ends up empty. That seems a shame just because the file was made in some editor that put "\r\n" line breaks. I messed about for a while trying to make my URL table ports alias work until I realized this.
This change first strips out any "\r" from the string, thus making it work with files that have either pure "\n" line breaks or "\r\n" line breaks.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 19edcf2..49eeb01 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2190,7 +2190,7 @@ function process_alias_urltable($name, $url, $freq, $forceupdate=false) { if (download_file($url, $urltable_filename . ".tmp", $verify_ssl)) { mwexec("/usr/bin/sed -E 's/\;.*//g; /^[[:space:]]*($|#)/d' ". escapeshellarg($urltable_filename . ".tmp") . " > " . escapeshellarg($urltable_filename)); if (alias_get_type($name) == "urltable_ports") { - $ports = explode("\n", file_get_contents($urltable_filename)); + $ports = explode("\n", str_replace("\r", "", file_get_contents($urltable_filename))); $ports = group_ports($ports); file_put_contents($urltable_filename, implode("\n", $ports)); } |