Commit 43ae21ef authored by Franco Fichtner's avatar Franco Fichtner

upnp: hardcode loading of miniupnpd.xml, hiding the

possibility to invoke XML files completely.  Now the only thing is
the missing conversion of the UPnP Service into MVC.
parent 3981b45d
......@@ -106,7 +106,7 @@
<PPPoEServer VisibleName="PPPoE Server" url="/services_vpn_pppoe.php"/>
<Proxy VisibleName="Proxy Server" url="/ui/proxy/"/>
<SNMP VisibleName="SNMP" url="/services_snmp.php"/>
<UPnP VisibleName="Universal Plug and Play" url="/pkg_edit.php?xml=miniupnpd.xml"/>
<UPnP VisibleName="Universal Plug and Play" url="/service_upnp.php"/>
<WoL VisibleName="Wake on LAN" url="/services_wol.php"/>
</Services>
......
......@@ -9,7 +9,7 @@
},
"user-copy-files": {
"name": "User - System - Copy files",
"descr": "Indicates whether the user is allowed to copy files onto the appliance via SCP\/SFTP. If you are going to use this privilege, you must install scponly on the appliance (Hint: pkg_add -r scponly)."
"descr": "Indicates whether the user is allowed to copy files onto the appliance via SCP\/SFTP."
},
"user-shell-access": {
"name": "User - System - Shell account access",
......@@ -651,27 +651,6 @@
"index.php*"
]
},
"page-package-edit": {
"name": "WebCfg - Package: Edit page",
"descr": "Allow access to the 'Package: Edit' page.",
"match": [
"pkg_edit.php*"
]
},
"page-package-settings": {
"name": "WebCfg - Package: Settings page",
"descr": "Allow access to the 'Package: Settings' page.",
"match": [
"pkg.php*"
]
},
"page-pkg-mgr-settings": {
"name": "WebCfg - Packages: Settings page",
"descr": "Allow access to the 'Packages: Settings' page.",
"match": [
"pkg_mgr_settings.php*"
]
},
"page-pfsensewizardsubsystem": {
"name": "WebCfg - pfSense wizard subsystem page",
"descr": "Allow access to the 'pfSense wizard subsystem' page.",
......@@ -1176,13 +1155,6 @@
"status_openvpn.php*"
]
},
"page-status-packagelogs": {
"name": "WebCfg - Status: Package logs page",
"descr": "Allow access to the 'Status: Package logs' page.",
"match": [
"diag_pkglogs.php*"
]
},
"page-status-rrdgraphs": {
"name": "WebCfg - Status: RRD Graphs page",
"descr": "Allow access to the 'Status: RRD Graphs' page.",
......@@ -1271,9 +1243,16 @@
"ifstats.php*"
]
},
"page-service-upnp": {
"name": "WebCfg - Service: Univeral Plug and Play page",
"descr": "Allow access to the 'Service: Univeral Plug and Play' page.",
"match": [
"service_upnp.php*"
]
},
"page-status-upnpstatus": {
"name": "WebCfg - Status: UPnP Status page",
"descr": "Allow access to the 'Status: UPnP Status' page.",
"name": "WebCfg - Status: Univeral Plug and Play Status page",
"descr": "Allow access to the 'Status: Univeral Plug and Play Status' page.",
"match": [
"status_upnp.php*"
]
......@@ -1447,27 +1426,6 @@
"license.php*"
]
},
"page-system-packagemanager": {
"name": "WebCfg - System: Package Manager page",
"descr": "Allow access to the 'System: Package Manager' page.",
"match": [
"pkg_mgr.php*"
]
},
"page-system-packagemanager-installpackage": {
"name": "WebCfg - System: Package Manager: Install Package page",
"descr": "Allow access to the 'System: Package Manager: Install Package' page.",
"match": [
"pkg_mgr_install.php*"
]
},
"page-system-packagemanager-installed": {
"name": "WebCfg - System: Package Manager: Installed page",
"descr": "Allow access to the 'System: Package Manager: Installed' page.",
"match": [
"pkg_mgr_installed.php*"
]
},
"page-system-staticroutes": {
"name": "WebCfg - System: Static Routes page",
"descr": "Allow access to the 'System: Static Routes' page.",
......
......@@ -6,10 +6,10 @@
<savetext>Change</savetext>
<include_file>miniupnpd.inc</include_file>
<menu>
<name>UPnP &amp; NAT-PMP</name>
<name>Universal Plug and Play</name>
<tooltiptext>Set UPnP &amp; NAT-PMP settings such as interfaces to listen on.</tooltiptext>
<section>Services</section>
<url>/pkg_edit.php?xml=miniupnpd.xml&amp;id=0</url>
<url>/service_upnp&amp;id=0</url>
</menu>
<service>
<name>miniupnpd</name>
......
......@@ -50,9 +50,8 @@ if (empty($pagename)) {
$pagename = "index.php";
}
/* If the filename is pkg_edit.php or wizard.php, reparse looking
for the .xml filename */
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
/* If the filename is wizard.php, reparse looking for the .xml filename */
if ($pagename == 'wizard.php') {
$param_split = explode('&', $uri_split[2]);
foreach ($param_split as $param) {
if (substr($param, 0, 4) == "xml=") {
......
......@@ -60,9 +60,8 @@ if (empty($pagename)) {
$pagename = "index.php";
}
/* If the filename is pkg_edit.php or wizard.php, reparse looking
for the .xml filename */
if (($pagename == "pkg.php") || ($pagename == "pkg_edit.php") || ($pagename == "wizard.php")) {
/* If the filename is wizard.php, reparse looking for the .xml filename */
if ($pagename == 'wizard.php') {
$param_split = explode('&', $uri_split[2]);
foreach ($param_split as $param) {
if (substr($param, 0, 4) == "xml=") {
......
......@@ -57,20 +57,14 @@ function domTT_title($title_msg){
}
}
$xml = htmlspecialchars($_GET['xml']);
if($_POST['xml']) $xml = htmlspecialchars($_POST['xml']);
/* hardcode miniupnpd.xml here, this file is going away */
$xml = 'miniupnpd.xml';
$xml_fullpath = realpath('/usr/local/pkg/' . $xml);
if ($xml == "" || $xml_fullpath === false ||
substr($xml_fullpath, 0, strlen('/usr/local/pkg/')) != '/usr/local/pkg/') {
print_info_box_np(gettext("ERROR: No valid package defined."));
die;
} else {
global $listtags ;
$listtags = array_flip(array('build_port_path', 'depends_on_package', 'onetoone', 'queue', 'rule', 'servernat', 'alias', 'additional_files_needed', 'tab', 'template', 'menu', 'rowhelperfield', 'service', 'step', 'package', 'columnitem', 'option', 'item', 'field', 'package', 'file'));
$pkg = parse_xml_config_raw($xml_fullpath, "packagegui", false);
}
global $listtags;
$listtags = array_flip(array('build_port_path', 'depends_on_package', 'onetoone', 'queue', 'rule', 'servernat', 'alias', 'additional_files_needed', 'tab', 'template', 'menu', 'rowhelperfield', 'service', 'step', 'package', 'columnitem', 'option', 'item', 'field', 'package', 'file'));
$pkg = parse_xml_config_raw($xml_fullpath, "packagegui", false);
if($pkg['include_file'] <> "") {
require_once($pkg['include_file']);
......@@ -237,9 +231,9 @@ if ($_POST) {
if($pkg['aftersaveredirect'] <> "") {
redirectHeader($pkg['aftersaveredirect']);
} elseif(!$pkg['adddeleteeditpagefields']) {
redirectHeader("pkg_edit.php?xml={$xml}&amp;id=0");
redirectHeader("service_upnp.php?id=0");
} elseif(!$pkg['preoutput']) {
redirectHeader("pkg.php?xml=" . $xml);
redirectHeader("service_upnp.php");
}
exit;
} else {
......@@ -386,9 +380,7 @@ else
<div class="content-box">
<form name="iform" action="pkg_edit.php" method="post">
<input type="hidden" name="xml" value="<?= htmlspecialchars($xml) ?>" />
<form name="iform" action="service_upnp.php" method="post">
<div class="table-responsive">
<table class="table table-striped table-sort">
......@@ -409,7 +401,7 @@ if ($pkg['tabs'] <> "") {
$no_drop_down = true;
$urltmp = "";
if($tab['url'] <> "") $urltmp = $tab['url'];
if($tab['xml'] <> "") $urltmp = "pkg_edit.php?xml=" . $tab['xml'];
if($tab['xml'] <> "") $urltmp = "service_upnp.php";
$addresswithport = getenv("HTTP_HOST");
$colonpos = strpos($addresswithport, ":");
......
......@@ -132,7 +132,7 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) {
}
$shortcuts['upnp'] = array();
$shortcuts['upnp']['main'] = "pkg_edit.php?xml=miniupnpd.xml";
$shortcuts['upnp']['main'] = "service_upnp.php";
$shortcuts['upnp']['log'] = "diag_logs_routing.php";
$shortcuts['upnp']['status'] = "status_upnp.php";
$shortcuts['upnp']['service'] = "miniupnpd";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment