diff options
author | jim-p <jimp@pfsense.org> | 2010-11-26 11:29:39 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-11-26 11:29:39 -0500 |
commit | 7af1159c01ef441f1a451df51ba23efdab64a623 (patch) | |
tree | 6ee390162fc9b5361ea494201d296f5f83938e72 | |
parent | 55845ffbb0d8665b104388630283432dceb54b68 (diff) | |
download | pfsense-packages-7af1159c01ef441f1a451df51ba23efdab64a623.tar.gz pfsense-packages-7af1159c01ef441f1a451df51ba23efdab64a623.tar.bz2 pfsense-packages-7af1159c01ef441f1a451df51ba23efdab64a623.zip |
Make siproxd use its own settings rather than use $_POST directly. Add sync command to xml file - previously, siproxd was not being sync'd on boot, only on save from the GUI, could have caused numerous issues.
-rw-r--r-- | config/siproxd.inc | 49 | ||||
-rw-r--r-- | config/siproxd.xml | 1 |
2 files changed, 26 insertions, 24 deletions
diff --git a/config/siproxd.inc b/config/siproxd.inc index 9eb6812b..93bdf203 100644 --- a/config/siproxd.inc +++ b/config/siproxd.inc @@ -103,32 +103,32 @@ function sync_package_siproxd() { @chgrp($siproxd_chroot, "nobody"); unlink_if_exists("/usr/local/etc/rc.d/siproxd"); - $conf = &$config['installedpackages']['siproxd']['config'][0]; + $siproxd_conf = &$config['installedpackages']['siproxdsettings']['config'][0]; $fout = fopen("/usr/local/etc/siproxd.conf","w"); fwrite($fout, "# This file was automatically generated by the pfSense\n"); fwrite($fout, "# package management system.\n\n"); /* proxy is turned off in package settings */ - if($_POST['rtpenable'] == "0") { + if($siproxd_conf['rtpenable'] == "0") { fclose($fout); return; } - if($_POST['if_inbound'] != "") { - fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_inbound']) . "\n"); + if($siproxd_conf['if_inbound'] != "") { + fwrite($fout, "if_inbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_inbound']) . "\n"); } - if($_POST['if_outbound'] != "") { - if(intval($config['version']) < 6 && $config['interfaces'][$_POST['if_outbound']]['ipaddr'] == "pppoe") { + if($siproxd_conf['if_outbound'] != "") { + if(intval($config['version']) < 6 && $config['interfaces'][$siproxd_conf['if_outbound']]['ipaddr'] == "pppoe") { fwrite($fout, "if_outbound = ng0\n"); } else { - fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($_POST['if_outbound']) . "\n"); + fwrite($fout, "if_outbound = " . convert_friendly_interface_to_real_interface_name($siproxd_conf['if_outbound']) . "\n"); } } - if($_POST['port'] != "") { - fwrite($fout, "sip_listen_port = " . $_POST['port'] . "\n"); + if($siproxd_conf['port'] != "") { + fwrite($fout, "sip_listen_port = " . $siproxd_conf['port'] . "\n"); } else { fwrite($fout, "sip_listen_port = 5060\n"); } @@ -142,46 +142,46 @@ function sync_package_siproxd() { fwrite($fout, "autosave_registrations = 10\n"); fwrite($fout, "pid_file = siproxd.pid\n"); - if($_POST['rtpenable'] != "") { - fwrite($fout, "rtp_proxy_enable = " . $_POST['rtpenable'] . "\n"); + if($siproxd_conf['rtpenable'] != "") { + fwrite($fout, "rtp_proxy_enable = " . $siproxd_conf['rtpenable'] . "\n"); } else { fwrite($fout, "rtp_proxy_enable = 1\n"); } - if(($_POST['rtplower'] != "") && ($_POST['rtpupper'] != "")) { - fwrite($fout, "rtp_port_low = " . $_POST['rtplower'] . "\n"); - fwrite($fout, "rtp_port_high = " . $_POST['rtpupper'] . "\n"); + if(($siproxd_conf['rtplower'] != "") && ($siproxd_conf['rtpupper'] != "")) { + fwrite($fout, "rtp_port_low = " . $siproxd_conf['rtplower'] . "\n"); + fwrite($fout, "rtp_port_high = " . $siproxd_conf['rtpupper'] . "\n"); } else { fwrite($fout, "rtp_port_low = 7070\n"); fwrite($fout, "rtp_port_high = 7079\n"); } - if($_POST['rtptimeout'] != "") { - fwrite($fout, "rtp_timeout = " . $_POST['rtptimeout'] . "\n"); + if($siproxd_conf['rtptimeout'] != "") { + fwrite($fout, "rtp_timeout = " . $siproxd_conf['rtptimeout'] . "\n"); } else { fwrite($fout, "rtp_timeout = 300\n"); } - if($_POST['defaulttimeout'] != "") { - fwrite($fout, "default_expires = " . $_POST['defaulttimeout'] . "\n"); + if($siproxd_conf['defaulttimeout'] != "") { + fwrite($fout, "default_expires = " . $siproxd_conf['defaulttimeout'] . "\n"); } else { fwrite($fout, "default_expires = 600\n"); } - if($_POST['authentication']) { + if($siproxd_conf['authentication']) { fwrite($fout, "proxy_auth_realm = Authentication_Realm\n"); fwrite($fout, "proxy_auth_pwfile = /usr/local/etc/siproxd_passwd.cfg\n"); } fwrite($fout, "debug_level = 0x00000000\n"); - if($_POST['outboundproxyhost'] != "") { - if($_POST['outboundproxyport'] != "") { - fwrite($fout, "outbound_proxy_host = " . $_POST['outboundproxyhost'] . "\n"); - fwrite($fout, "outbound_proxy_port = " . $_POST['outboundproxyport'] . "\n"); + if($siproxd_conf['outboundproxyhost'] != "") { + if($siproxd_conf['outboundproxyport'] != "") { + fwrite($fout, "outbound_proxy_host = " . $siproxd_conf['outboundproxyhost'] . "\n"); + fwrite($fout, "outbound_proxy_port = " . $siproxd_conf['outboundproxyport'] . "\n"); } } - if($_POST['expeditedforwarding'] != "") + if($siproxd_conf['expeditedforwarding'] != "") fwrite($fout, "rtp_dscp = 46\n"); fclose($fout); @@ -202,6 +202,7 @@ function sync_package_siproxd() { filter_configure(); conf_mount_ro(); + } ?> diff --git a/config/siproxd.xml b/config/siproxd.xml index f4e1bd0b..7feb4d0f 100644 --- a/config/siproxd.xml +++ b/config/siproxd.xml @@ -169,6 +169,7 @@ sync_package_siproxd(); </custom_add_php_command> <custom_php_resync_config_command> + sync_package_siproxd(); </custom_php_resync_config_command> <filter_rules_needed>siproxd_generate_rules</filter_rules_needed> </packagegui> |