Revision 43066106
Added by Scott Ullrich about 19 years ago
etc/inc/filter.inc | ||
---|---|---|
2264 | 2264 |
return $lines; |
2265 | 2265 |
} |
2266 | 2266 |
|
2267 |
function remove_special_characters($string) { |
|
2268 |
$match_array = ""; |
|
2269 |
preg_match_all("/[a-zA-Z0-9\_\-]+/",$string,$match_array); |
|
2270 |
$string = ""; |
|
2271 |
foreach($match_array[0] as $ma) { |
|
2272 |
if($string <> "") |
|
2273 |
$string .= " "; |
|
2274 |
$string .= $ma; |
|
2275 |
} |
|
2276 |
return $string; |
|
2277 |
} |
|
2278 |
|
|
2267 | 2279 |
function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsense.restore_config_section') { |
2268 | 2280 |
global $config, $g; |
2269 | 2281 |
|
... | ... | |
2272 | 2284 |
|
2273 | 2285 |
update_filter_reload_status("Syncing CARP data to {$url}"); |
2274 | 2286 |
|
2287 |
/* make a copy of config */ |
|
2275 | 2288 |
$config_copy = $config; |
2276 | 2289 |
|
2277 | 2290 |
/* strip out nosync items */ |
2278 | 2291 |
for($x=0; $x<count($config_copy['nat']['advancedoutbound']['rule']); $x++) { |
2279 | 2292 |
if(isset($config_copy['nat']['advancedoutbound']['rule'][$x]['nosync'])) |
2280 | 2293 |
unset($config_copy['nat']['advancedoutbound']['rule'][$x]); |
2294 |
$config_copy['nat']['advancedoutbound']['rule'][$x]['descr'] = remove_special_characters($config_copy['nat']['advancedoutbound']['rule'][$x]['descr']); |
|
2281 | 2295 |
} |
2282 | 2296 |
for($x=0; $x<count($config_copy['nat']['rule']); $x++) { |
2283 | 2297 |
if(isset($config_copy['nat']['rule'][$x]['nosync'])) |
2284 | 2298 |
unset($config_copy['nat']['rule'][$x]); |
2299 |
$config_copy['nat']['rule'][$x]['descr'] = remove_special_characters($config_copy['nat']['rule'][$x]['descr']); |
|
2285 | 2300 |
} |
2286 | 2301 |
for($x=0; $x<count($config_copy['filter']['rule']); $x++) { |
2287 | 2302 |
if(isset($config_copy['filter']['rule'][$x]['nosync'])) |
2288 | 2303 |
unset($config_copy['filter']['rule'][$x]); |
2304 |
$config_copy['filter']['rule'][$x]['descr'] = remove_special_characters($config_copy['filter']['rule'][$x]['descr']); |
|
2289 | 2305 |
} |
2290 | 2306 |
|
2291 | 2307 |
if($g['booting']) |
Also available in: Unified diff
Only allow a-z -0-9 on sync'd hosts