summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil@jankaritech.com>2017-04-27 06:59:08 +0545
committerRenato Botelho <renato@netgate.com>2017-04-27 10:44:16 -0300
commit1e40bdebc1113718131c7ac56d1d393651d437a2 (patch)
tree1e8e9243f8b8739dbbce656ab7c4ce0242f06e84
parent3b010c68339f4c902c5ce7591cfd651022d07e04 (diff)
downloadpfsense-1e40bdebc1113718131c7ac56d1d393651d437a2.zip
pfsense-1e40bdebc1113718131c7ac56d1d393651d437a2.tar.gz
Fix comparisons for CDATA tags in config
Some length numbers here do not match the strings they are comparing with. That looks very odd. Note that: ``` substr($ent, 0, 5) == "text" ``` will return true when $ent is "text". So actually this "works". But it returns false if $ent is "text1" "texta" etc. So it depends what the intention was. If it was intended to match just "text" then I could be just: ``` $ent == "text" ``` If it was intended to match "text" "text1" "texta" etc, then it needs to be fixed like I suggest here. (cherry picked from commit 856514f59574085ca526509190221918426158c7)
-rw-r--r--src/etc/inc/xmlparse.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/etc/inc/xmlparse.inc b/src/etc/inc/xmlparse.inc
index 84a1424..95783b6 100644
--- a/src/etc/inc/xmlparse.inc
+++ b/src/etc/inc/xmlparse.inc
@@ -279,7 +279,7 @@ function dump_xml_config_sub($arr, $indent) {
(substr($ent, 0, 9) == "ldap_attr") ||
(substr($ent, 0, 9) == "ldap_bind") ||
(substr($ent, 0, 11) == "ldap_basedn") ||
- (substr($ent, 0, 18) == "ldap_authcn") ||
+ (substr($ent, 0, 11) == "ldap_authcn") ||
(substr($ent, 0, 19) == "ldap_extended_query")) {
$xmlconfig .= "<$ent><![CDATA[" . htmlentities($cval) . "]]></$ent>\n";
} else {
@@ -310,9 +310,9 @@ function dump_xml_config_sub($arr, $indent) {
(substr($ent, 0, 9) == "ldap_attr") ||
(substr($ent, 0, 9) == "ldap_bind") ||
(substr($ent, 0, 11) == "ldap_basedn") ||
- (substr($ent, 0, 18) == "ldap_authcn") ||
+ (substr($ent, 0, 11) == "ldap_authcn") ||
(substr($ent, 0, 19) == "ldap_extended_query") ||
- (substr($ent, 0, 5) == "text")) {
+ (substr($ent, 0, 4) == "text")) {
$xmlconfig .= "<$ent><![CDATA[" . htmlentities($val) . "]]></$ent>\n";
} else {
$xmlconfig .= "<$ent>" . htmlentities($val) . "</$ent>\n";
OpenPOWER on IntegriCloud