Re: server side filter plugin problem

Bu Xiaobing <[email protected]> Fri, 14 Jun 2013 10:29:07 +0800
Newsgroups gmane.mail.squirrelmail.plugins
Message-ID <[email protected]>
On 2013-6-8 3:35, Paul Lesniewski wrote:
> On Wed, Jun 5, 2013 at 8:20 PM, Bu Xiaobing <[email protected]> wrote:
>> On 2013-6-5 0:48, Paul Lesniewski wrote:
>>> On Tue, Jun 4, 2013 at 4:35 AM, Bu Xiaobing <[email protected]> wrote:
>>>> Hi all,
>>>>
>>>> I want to use the server_side_filters plugin to do the procmail filter in the server side.
>>>>
>>>> version list:
>>>> squirrelmail-webmail-1.4.22
>>>> server_settings_backend-2.0-1.4.0.tar.gz
>>>> server_side_filters-2.0beta1-1.4.0.tar.gz
>>>> compatibility-2.0.16-1.0.tar.gz
>>>>
>>>> And I have enabled the server_side_filters throw config/conf.pl script.
>>> You need to show configuration files/snippets.
>>>
>>>> Plugins
>>>>     Installed Plugins
>>>>       1. server_side_filters
>>>>
>>>>     Available Plugins:
>>>>       2. administrator
>>>>
>>>>
>>>> When I use "Options" -> "Message Filters" in my web browser, after add some filter rules, and click the SAVE button, it says "Error: Error deleting file or directory"
>>>>
>>>> And in my /var/log/httpd/ssl_error_log:
>>>>
>>>> PHP Warning:  unlink(/): \xca\xc7\xd2\xbb\xb8\xf6\xc4\xbf\xc2\xbc in /var/www/html/webmail/functions/global.php on line 278, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
>>> This is a warning, not an error.  You should provide the complete log
>>> information for whatever has happened.  You may need to look in a
>>> different log file or increase your PHP log settings.  You also might
>>> try using only ASCII characters in your filters to start with.
>>>
>>>> Here is the global.php function:
>>>>
>>>>      275 function sq_call_function_suppress_errors($function, $args=array()) {
>>>>       276    $display_errors = ini_get('display_errors');
>>>>       277    ini_set('display_errors', '0');
>>>>       278    $ret = call_user_func_array($function, $args);
>>>>       279    ini_set('display_errors', $display_errors);
>>>>       280    return $ret;
>>>>       281 }
>>>> Anyone can give me some advice?
>> I have enabled another plugin: server_side_filters_procmail, and below lists all the parameters I changed:
>>
>> server_side_filters_procmail/config.php
>> $use_maildirs = 0;
> Your system uses mbox?
>
>> $filter_rules_storage_info = array(
>>      'BACKEND'               => 'local_file',
>>      'ACCESS_TYPE'           => array('VALUE' => 'PHP'),
> Per the documentation, if you are using PHP to access users' files in
> their home directories, does the web server really have write access
> to those files/directories?
>
>>      'FILE' => array('VALUE_REPLACE' => '/tmp/%u/.mailfilter'),
> Presumably this is for testing, because it isn't matching what your
> requirements are per below.  What version of Server Settings Backend
> are you using?  Presumably, version 2.0.  The example configuration in
> the filters plugin is out of sync.  Please change %u to %1 and see
> what you get.  (Note in the future, if you upgrade Server Settings
> Backend, you will need to come back to this and change it to %u
> again.)
>
>>      'PARSE_PATTERN'         => array('VALUE' => "/^(.*)$/s"),
>>      'PATTERN_GROUP_NUMBER'  => array('VALUE' => 1),
>>      'NEW_SETTING_TEMPLATE'  => array('VALUE' => '%n'),
>>      'DELETE_WHEN_EMPTY'     => array('VALUE' => 1),
>>      'TREAT_AS_EMPTY_WHEN_NOT_FOUND' => array('VALUE' => 1),
>> );
>>
>> When add one filter rule and click SAVE, it said "ERROR:Could not write to file "/" "
>> Here is the ssl_error_log I have config the log level as http://www.squirrelmail.org/docs/admin/admin-12.html#errormessages said.
>>
>> [Thu Jun 06 10:57:50 2013] [error] [client 192.168.66.6] PHP Notice:  Uninitialized string offset: -1 in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 255, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
>> [Thu Jun 06 10:57:50 2013] [error] [client 192.168.66.6] PHP Warning:  strpos(): Empty delimiter in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 257, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
> This is a minor issue you have discovered because your
> $default_folder_prefix (in the main SM config.php) is presumably
> empty.  I have a fix for that, but this isn't going to matter to you
> (code will still execute the same).
>
>> [Thu Jun 06 10:57:50 2013] [error] [client 192.168.66.6] PHP Warning:  file_put_contents(/): failed to open stream: Is a directory in /var/www/html/webmail/functions/global.php on line 278, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
> This appears to be the main problem.  See above for the fix.
>
>> Are there some configuration guide? or some examples? My purpose is to use plugins to configure /home/%u/.procmailrc file as procmail command do.
> As is mentioned several times in the documentation and configuration
> files, there is ample documentation and information in the Server
> Settings Backend plugin.  More general examples for configuring it can
> also be found in the Server Settings plugin.
>
Hi, Paul

Yes, I use mbox.

And for test purpose, I have changed the config as blow:
$filter_rules_storage_info = array(
    'BACKEND'               => 'local_file',
    'ACCESS_TYPE'           => array('VALUE' => 'PHP'),
    'FILE' => array('VALUE_REPLACE' => '/tmp/.mailfilter'),
    'PARSE_PATTERN'         => array('VALUE' => "/^(.*)$/s"),
    'PATTERN_GROUP_NUMBER'  => array('VALUE' => 1),
    'NEW_SETTING_TEMPLATE'  => array('VALUE' => '%n'),
    'DELETE_WHEN_EMPTY'     => array('VALUE' => 1),
    'TREAT_AS_EMPTY_WHEN_NOT_FOUND' => array('VALUE' => 1),
);

Of course php owner have write privilege to the /tmp directory.

But seems the same problem.

Following is the debug file information:

--
SERVER SETTINGS BACKEND MATCHES (PATTERN = "/^(.*)$/s") ARE:

Array
(
     [0] => Array
         (
             [0] => Array
                 (
                     [0] =>
                     [1] => 0
                 )

         )

     [1] => Array
         (
             [0] => Array
                 (
                     [0] =>
                     [1] => 0
                 )

         )

)

CHOSEN PATTERN GROUP (1) IS:

Array
(
     [0] => Array
         (
             [0] =>
             [1] => 0
         )

)

Notice: Uninitialized string offset: -1 in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 255 Warning: strpos(): Empty delimiter in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 257 SERVER SETTINGS BACKEND MATCHES (PATTERN = "/^(.*)$/s") ARE:

Array
(
     [0] => Array
         (
             [0] => Array
                 (
                     [0] =>
                     [1] => 0
                 )

         )

     [1] => Array
         (
             [0] => Array
                 (
                     [0] =>
                     [1] => 0
                 )

         )

)

CHOSEN PATTERN GROUP (1) IS:

Array
(
     [0] => Array
         (
             [0] =>
             [1] => 0
         )

)

ERROR:
Could not write to file "/"
--

here is the ssl_error_log

[Fri Jun 14 10:25:27 2013] [error] [client 192.168.66.6] PHP Notice:  Uninitialized string offset: -1 in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 255, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
[Fri Jun 14 10:25:27 2013] [error] [client 192.168.66.6] PHP Warning:  strpos(): Empty delimiter in /var/www/html/webmail/plugins/server_side_filters_procmail/functions.php on line 257, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php
[Fri Jun 14 10:25:27 2013] [error] [client 192.168.66.6] PHP Warning:  file_put_contents(/): failed to open stream: Is a directory in /var/www/html/webmail/functions/global.php on line 278, referer: https://mymailserver.com/webmail/plugins/server_side_filters/options.php



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins