Project

General

Profile

« Previous | Next » 

Revision 4aa0979f

Added by Ermal LUÇI over 13 years ago

Prevent ruleset breaking from grep putting garbage on urltable files and as a result creating unparsable files breaking rulesets

View differences:

etc/inc/pfsense-utils.inc
1846 1846
		// Use fetch to grab data since these may be large files, we don't want to process them through PHP if we can help it.
1847 1847
		mwexec("/usr/bin/fetch -T 5 -q -o " . escapeshellarg($urltable_filename . ".tmp") . " " . escapeshellarg($url));
1848 1848
		// Remove comments. Might need some grep-fu to only allow lines that look like IPs/subnets
1849
		mwexec("/usr/bin/grep -v '^#' " . escapeshellarg($urltable_filename . ".tmp") . " > " . escapeshellarg($urltable_filename));
1850
		unlink_if_exists($urltable_filename . ".tmp");
1849
		if (file_exists($urltable_filename . ".tmp")) {
1850
			mwexec("/usr/bin/grep -v '^#' " . escapeshellarg($urltable_filename . ".tmp") . " > " . escapeshellarg($urltable_filename));
1851
			unlink_if_exists($urltable_filename . ".tmp");
1852
		} else
1853
			mwexec("/usr/bin/touch {$urltable_filename}");
1851 1854
		conf_mount_ro();
1852 1855
		if (filesize($urltable_filename)) {
1853 1856
			return true;

Also available in: Unified diff