[Kolab-devel] [issue2462] php array variables are not read correctly from the config file

Richard Bos kolab-issues at intevation.de
Thu Feb 7 10:20:11 CET 2008


New submission from Richard Bos <ml at radoeka.nl>:

In Content.php the following construct is found:

        if (!empty($conf['filter']['verify_from_header'])) {
            $verify_from_header = $conf['filter']['verify_from_header'];
        } else {
            $verify_from_header = true;
        }

With the following setting in the config file:
 # grep verify_from_header /var/lib/kolab/kolab-filter/config.php
$conf['filter']['verify_from_header'] = false;

One would expect that the verify_header is false after that particular
piece of code has run.  However it is not!

This is the result:
Feb 07 09:51:51 Kolab Filter [debug] [horde] DEBUG: _parse verify_from_header
set to true [on line 62 of "/usr/share/php5/PEAR/Kolab/Filter/Content.php"]    
  Feb 07 09:51:51 Kolab Filter [debug] [horde] DEBUG: _parse verify_from_header
== true [on line 68 of "/usr/share/php5/PEAR/Kolab/Filter/Content.php"]           

When the php keyword "!empty" is changed to "isset", the result is:
Feb 07 10:15:34 Kolab Filter [debug] [horde] DEBUG: _parse verify_from_header is
not empty [on line 59 of "/usr/share/php5/PEAR/Kolab/Filter/Content.php"]
Feb 07 10:15:34 Kolab Filter [debug] [horde] DEBUG: _parse verify_from_header ==
false [on line 71 of "/usr/share/php5/PEAR/Kolab/Filter/Content.php"]

In this case the email sent from root also arrives at the recipients address!
        
So, the impact is high!

There are many !empty statements in that file, so a diff might look like as:
[/usr/share/php5/PEAR/Kolab/Filter] # diff Content.php.org Content.php
55c55
<         if (!empty($conf['filter']['verify_from_header'])) {
---
>         if (isset($conf['filter']['verify_from_header'])) {
61c61
<         if (!empty($conf['filter']['allow_sender_header'])) {
---
>         if (isset($conf['filter']['allow_sender_header'])) {
67c67
<         if (!empty($conf['filter']['allow_outlook_ical_forward'])) {
---
>         if (!issetconf['filter']['allow_outlook_ical_forward'])) {
194c194
<         if (!empty($conf['filter']['smtp_host'])) {
---
>         if (isset($conf['filter']['smtp_host'])) {
199c199
<         if (!empty($conf['filter']['smtp_port'])) {
---
>         if (isset($conf['filter']['smtp_port'])) {
273c273
<     if (!empty($conf['filter']['verify_subdomains'])) {
---
>     if (isset($conf['filter']['verify_subdomains'])) {
279c279
<     if (!empty($conf['filter']['email_domain'])) {
---
>     if (isset($conf['filter']['email_domain'])) {
378c378
<         if (!empty($conf['filter']['untrusted_subject_insert'])) {
---
>         if (isset($conf['filter']['untrusted_subject_insert'])) {
384c384
<         if (!empty($conf['filter']['unauthenticated_subject_insert'])) {
---
>         if (isset($conf['filter']['unauthenticated_subject_insert'])) {
407c407
<     if (!empty($conf['filter']['email_domain'])) {
---
>     if (isset($conf['filter']['email_domain'])) {
417c417
<     if (!empty($conf['filter']['local_addr'])) {
---
>     if (isset($conf['filter']['local_addr'])) {
423c423
<     if (!empty($conf['filter']['verify_subdomains'])) {
---
>     if (isset($conf['filter']['verify_subdomains'])) {
429c429
<     if (!empty($conf['filter']['reject_forged_from_headers'])) {
---
>     if (isset($conf['filter']['reject_forged_from_headers'])) {
435c435
<     if (!empty($conf['filter']['kolabhosts'])) {
---
>     if (isset($conf['filter']['kolabhosts'])) {

----------
messages: 13629
nosy: rbos
priority: urgent
status: unread
title: php array variables are not read correctly from the config file
________________________________________________
Kolab issue tracker <kolab-issues at intevation.de>
<https://intevation.de/roundup/kolab/issue2462>
________________________________________________




More information about the devel mailing list