1 (edited by thatday 2012-10-23 17:18:53)

Topic: Sieve bugs in iRedAdmin-Mysql-Pro-1.5.1

==== Required information ====
- iRedMail version: 0.8.3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Linux/BSD distribution name and version: centos 6.3
- Related log if you're reporting an issue:
====

我今天又测试了一下sieve功能,
数据库里面,有四个字段enablemanagesieve,enablemanagesievesecured,enablesieve,enablesievesecured,
在iredadmin后台的“用户属性-高级设置”里,只要点保存更改,数据库里的enablesieve,enablesievesecured都会变成0,
即使勾上“自定义邮件过滤规则+自定义邮件过滤规则(使用TLS/SSL加密传输)”,只要保存设置,后面两个字段都会变成0,而enablemanagesieve,enablemanagesievesecured两个字段则分别能保存设置。

看到libs/mysql/user.py里有如下代码:

if 'enablemanagesieve' in self.enabledService:
self.enabledService += ['enablesieve']
else:
self.disabledService += ['enablesieve']

if 'enablemanagesievesecured' in self.enabledService:
self.enabledService += ['enablesievesecured']
else:
self.disabledService += ['enablesievesecured']

我看到这段代码,原则上是勾选了enablemanagesieve,那么enablesieve也会生效,
同样勾选了enablemanagesievesecured',enablesievesecured亦会生效,
但不知道为什么,只要保存,后面两个字段都为0了。

2

Re: Sieve bugs in iRedAdmin-Mysql-Pro-1.5.1

这个补丁同时修正了你反馈的这个问题:
http://www.iredmail.org/forum/post18793.html#p18793

3

Re: Sieve bugs in iRedAdmin-Mysql-Pro-1.5.1

ZhangHuangbin wrote:

这个补丁同时修正了你反馈的这个问题:
http://www.iredmail.org/forum/post18793.html#p18793

我打了这个补丁之后,勾选“自定义邮件过滤规则”和“自定义邮件过滤规则(使用 TLS/SSL 加密传输)”能够正确保存,数据库里四个字段enablemanagesieve,enablemanagesievesecured,enablesieve,enablesievesecured的值均为1.

但“自定义邮件过滤规则”和“自定义邮件过滤规则(使用 TLS/SSL 加密传输)”其中之一不勾选的话,仍然不能保存,网页出现“internal server error”。

后台httpd日志如下:

   File "/var/www/iredadmin/controllers/decorators.py", line 33, in decorated
     return f(*args, **kw)
   File "/var/www/iredadmin/controllers/decorators.py", line 11, in proxyfunc
     return func(self, *args, **kw)
   File "/var/www/iredadmin/controllers/mysql/user.py", line 191, in POST
     data=i,
   File "/var/www/iredadmin/libs/mysql/decorators.py", line 22, in proxyfunc
     return func(*args, **kw)
   File "/var/www/iredadmin/libs/mysql/user.py", line 612, in update
     self.disabledService += ['enablesieve']
 AttributeError: User instance has no attribute 'disabledService'

应该还是有点问题,请站长费心。

4

Re: Sieve bugs in iRedAdmin-Mysql-Pro-1.5.1

抱歉。请在已经打过补丁的版本上再打这个补丁:

diff -r 744053b4657c libs/mysql/user.py
--- a/libs/mysql/user.py    Tue Oct 23 21:08:30 2012 +0800
+++ b/libs/mysql/user.py    Wed Oct 24 08:18:00 2012 +0800
@@ -599,11 +599,12 @@
                 pass
 
         elif self.profile_type == 'advanced':
-            # Get enabled services.
+            # Get enabled/disabled services.
             self.enabledService = [str(v).lower()
                                    for v in data.get('enabledService', [])
                                    if v in ENABLED_SERVICES
                                   ]
+            self.disabledService = []
 
             # Append 'sieve', 'sievesecured' for dovecot-1.2.
             if 'enablemanagesieve' in self.enabledService:
@@ -616,7 +617,7 @@
             else:
                 self.disabledService += ['enablesievesecured']
 
-            self.disabledService = [v for v in ENABLED_SERVICES if v not in self.enabledService]
+            self.disabledService += [v for v in ENABLED_SERVICES if v not in self.enabledService]
 
             # Enable/disable services.
             for srv in self.enabledService:

5

Re: Sieve bugs in iRedAdmin-Mysql-Pro-1.5.1

完美解决,jood job!