diff options
author | Phil Davis <phil@jankaritech.com> | 2017-04-27 06:59:08 +0545 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-27 06:59:08 +0545 |
commit | 856514f59574085ca526509190221918426158c7 (patch) | |
tree | cee3ee866926c4f605effbe768c47926af099afa /src | |
parent | 49a6769d99b4ea0306b0d619d14c3c0c841386e9 (diff) | |
download | pfsense-856514f59574085ca526509190221918426158c7.zip pfsense-856514f59574085ca526509190221918426158c7.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.
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/xmlparse.inc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/etc/inc/xmlparse.inc b/src/etc/inc/xmlparse.inc index 5632e98..5d00d29 100644 --- a/src/etc/inc/xmlparse.inc +++ b/src/etc/inc/xmlparse.inc @@ -247,7 +247,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 { @@ -278,9 +278,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"; |