If you add another table with domain and protocol keys you could more easily manage plugins for domain,protocols pairs.

SELECT t1.username as user,t1.password, \
group_concat(t2.plugin seperator ' ' ) as userdb_mail_plugins, \
101 as userdb_uid, 502 as userdb_gid, CONCAT('*:bytes=', CAST(t1.quota AS
CHAR)) AS quota_rule
from mailbox t1
left outer join mailbox_plugins t2 on t2.domain = '%d' and t2.protocol = '%s'

Could join on username as well, nice for testing.

--
Brad

On Feb 8, 2011, at 1:09 PM, Paul A wrote:

Thank you Timo I got that to work, it's posted below in case some searches
the mailing list for something similar.

password_query = SELECT username as user, password, \
if('%d' IN ('virttest1.xxx.net', 'test2000.com') AND '%s'='imap', \
'quota imap_quota trash expire autocreate acl imap_acl',null) as
userdb_mail_plugins, \
101 as userdb_uid, 502 as userdb_gid, CONCAT('*:bytes=', CAST(quota AS
CHAR)) AS quota_rule FROM mailbox WHERE username = '%u'


Tested and working.

paul


-----Original Message-----
From: dovecot-bounces+razor=meganet....@dovecot.org
[mailto:dovecot-bounces+razor=meganet....@dovecot.org] On Behalf Of Timo
Sirainen
Sent: Tuesday, February 08, 2011 12:34 PM
To: Paul A
Cc: Dovecot Mailing List
Subject: Re: [Dovecot] sieve not working if i have override

Add some more trickyness to your SQL query using another IF(). If '%s'
expands to 'imap', return the imap_* plugins, otherwise don't.

On 8.2.2011, at 16.42, Paul A wrote:

I know that but I need to use the override option on selected domains, as
I
don't want all domains to have ACL access. So when I use override I need
to
specify all plugins I'm using because the override feature will not look
at
the $mail_plugin statement in dovecot.conf and ofcourse when I do this I
get
the error below. Is there another method I can use to allow only certain
domains ACL access instead of the override. Not sure if Timo has any
ideas.

Thanks, Paul


-----Original Message-----
From: Stephan Bosch [mailto:step...@rename-it.nl]
Sent: Tuesday, February 08, 2011 3:18 AM
To: Paul A
Cc: 'Dovecot Mailing List'
Subject: Re: [Dovecot] sieve not working if i have override

On 2/8/2011 12:33 AM, Paul A wrote:
Hi,



I have a few domain that I'm overriding the mail_plugins, see password
query
below, however when I use this password query everything is working
expect
sieve gives me an error. How can I get around this problem?

[...]
Feb  7 18:28:20 testip5 dovecot: managesieve: Error:
dlopen(/usr/local/lib/dovecot/lib02_imap_acl_plugin.so) failed:
/usr/local/lib/dovecot/lib02_imap_acl_plugin.so: undefined symbol:
client_send_tagline

[...]
It also complains about imap_quota.

You're trying to load the imap_quota and imap_acl plugins into
ManagSieve, which makes no sense. So, your query should not return those
plugins when the service (%Ls) is `sieve'.

Regards,

Stephan.



Reply via email to