Project

General

Profile

« Previous | Next » 

Revision 1e40bdeb

Added by Phillip Davis over 8 years ago

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)

View differences:

src/etc/inc/xmlparse.inc
279 279
						    (substr($ent, 0, 9) == "ldap_attr") ||
280 280
						    (substr($ent, 0, 9) == "ldap_bind") ||
281 281
						    (substr($ent, 0, 11) == "ldap_basedn") ||
282
						    (substr($ent, 0, 18) == "ldap_authcn") ||
282
						    (substr($ent, 0, 11) == "ldap_authcn") ||
283 283
						    (substr($ent, 0, 19) == "ldap_extended_query")) {
284 284
							$xmlconfig .= "<$ent><![CDATA[" . htmlentities($cval) . "]]></$ent>\n";
285 285
						} else {
......
310 310
				    (substr($ent, 0, 9) == "ldap_attr") ||
311 311
				    (substr($ent, 0, 9) == "ldap_bind") ||
312 312
				    (substr($ent, 0, 11) == "ldap_basedn") ||
313
				    (substr($ent, 0, 18) == "ldap_authcn") ||
313
				    (substr($ent, 0, 11) == "ldap_authcn") ||
314 314
				    (substr($ent, 0, 19) == "ldap_extended_query") ||
315
				    (substr($ent, 0, 5) == "text")) {
315
				    (substr($ent, 0, 4) == "text")) {
316 316
					$xmlconfig .= "<$ent><![CDATA[" . htmlentities($val) . "]]></$ent>\n";
317 317
				} else {
318 318
					$xmlconfig .= "<$ent>" . htmlentities($val) . "</$ent>\n";

Also available in: Unified diff