Commit 0b486cd1 authored by Franco Fichtner's avatar Franco Fichtner

util: move is_fqdn()

The call stack is pretty loose on is_fqdn() as it is called by
system_routing_configure() which gets called in an uncontrollable
fashion in interface.inc.
parent 7bcc88ce
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require_once("openvpn.inc"); require_once("openvpn.inc");
require_once("util.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
function cert_get_subject_hash($crt) function cert_get_subject_hash($crt)
......
...@@ -215,23 +215,6 @@ function reload_ttys() ...@@ -215,23 +215,6 @@ function reload_ttys()
exec('/bin/kill -HUP 1'); exec('/bin/kill -HUP 1');
} }
function is_fqdn($fqdn) {
$hostname = false;
if (preg_match("/[-A-Z0-9\.]+\.[-A-Z0-9\.]+/i", $fqdn)) {
$hostname = true;
}
if (preg_match("/\.\./", $fqdn)) {
$hostname = false;
}
if (preg_match("/^\./i", $fqdn)) {
$hostname = false;
}
if (preg_match("/\//i", $fqdn)) {
$hostname = false;
}
return($hostname);
}
/* This xml 2 array function is courtesy of the php.net comment section on xml_parse. /* This xml 2 array function is courtesy of the php.net comment section on xml_parse.
* it is roughly 4 times faster then our existing pfSense parser but due to the large * it is roughly 4 times faster then our existing pfSense parser but due to the large
* size of the RRD xml dumps this is required. * size of the RRD xml dumps this is required.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* /*
Copyright (C) 2015-2016 Franco Fichtner <franco@opnsense.org> Copyright (C) 2015-2016 Franco Fichtner <franco@opnsense.org>
Copyright (C) 2004-2007 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved. All rights reserved.
...@@ -1489,3 +1490,23 @@ function download_alias_geoip($alias) ...@@ -1489,3 +1490,23 @@ function download_alias_geoip($alias)
return false; return false;
} }
} }
function is_fqdn($fqdn)
{
$hostname = false;
if (preg_match("/[-A-Z0-9\.]+\.[-A-Z0-9\.]+/i", $fqdn)) {
$hostname = true;
}
if (preg_match("/\.\./", $fqdn)) {
$hostname = false;
}
if (preg_match("/^\./i", $fqdn)) {
$hostname = false;
}
if (preg_match("/\//i", $fqdn)) {
$hostname = false;
}
return $hostname;
}
...@@ -121,8 +121,10 @@ function firmware_version_xmlrpc() ...@@ -121,8 +121,10 @@ function firmware_version_xmlrpc()
function filter_configure_xmlrpc() function filter_configure_xmlrpc()
{ {
global $config; global $config;
require_once("filter.inc"); require_once("filter.inc");
require_once("system.inc"); require_once("system.inc");
require_once("util.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
require_once("vslb.inc"); require_once("vslb.inc");
require_once("openvpn.inc"); require_once("openvpn.inc");
......
...@@ -38,6 +38,7 @@ require_once("services.inc"); ...@@ -38,6 +38,7 @@ require_once("services.inc");
require_once("rrd.inc"); require_once("rrd.inc");
require_once("util.inc"); require_once("util.inc");
require_once("system.inc"); require_once("system.inc");
require_once("plugins.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
......
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