[Dovecot] about variables SOLVED
alex
me at deltaindigo.ro
Wed Jul 21 13:36:42 EEST 2010
On 07/20/2010 03:36 PM, alex wrote:
> On 07/20/2010 11:31 AM, Arne K. Haje wrote:
>> Tirsdag 20. juli 2010 09.31.51 skrev alex :
>>> Hi
>>>
>>> In http://wiki.dovecot.org/Variables I found:
>>> %s service imap, pop3, smtp, deliver
>>> and that can be use in userdb and SQL query string.
>>>
>>> How exactly can I use %s in the query string if I want for ex to disable
>>> a service (just one service - ex pop3) for a specific user.
>>>
>>> Alex
>>
>> While I've not tried it, I guess you could do something like this in
>> the SQL
>> query;
>>
>> ".. AND service=('%s' OR 'all')"
>>
>> You could set the default value of service column to 'all', but set it to
>> 'imap' for users that can only use that service.
>>
>> Arne
>
> How about
> "...AND %s in (services)"
> and the services column will be something like 'imap,pop3,smtp,deliver'
> => "...AND %s in (imap,pop3,smtp,deliver)"
> For the user that do not have , let say imap, the services will be
> (pop3,smtp,deliver)
>
> Further more : the postfix server use the dovecot auth. It is possible
> for an account to disable the smtp auth (the user won't be able to send
> any emails but will be able to receive an read )?
>
> Alex
For whom may be interested, I've manage to come with a configuration for
case when you wanna disable a service (pop/imap/smtp) for a certain user.
The password_query look like this:
SELECT crypt AS password FROM users WHERE email = '%u' AND \
(('%s' = 'imap' AND disableimap = '0') OR \
('%s' = 'pop3' AND disablepop3 = '0') OR \
('%s' = 'smtp' AND smtpaccess = 'Y'))
or like this :
SELECT crypt AS password FROM users WHERE \
email = '%u' AND '%s' = 'imap' AND disableimap = '0' \
UNION SELECT crypt AS password FROM users WHERE \
email = '%u' AND '%s' = 'pop3' AND disablepop3 = '0' \
UNION SELECT crypt AS password FROM users WHERE \
email = '%u' AND '%s' = 'smtp' AND smtpaccess = '0'
Alex
More information about the dovecot
mailing list