[Dovecot] problem mysql and dovecot 1.2

debian at robertain.com debian at robertain.com
Thu Jul 22 17:01:51 EEST 2010


Hi everybody , 

Since my version 1.2. I have a problem with the management of quotas.


select * from virtual_users;
+----+-----------+----------------------------------+---------------------------+----------+----------------+
| id | domain_id | password                         | email               
    | quota_kb | quota_messages |
+----+-----------+----------------------------------+---------------------------+----------+----------------+
|  1 |         1 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | xxxxxx at domain.com  
    | 10000000 |              0 |
..................

Before my time in 1.2. I did this for the quota management:
user_query = SELECT
CONCAT('/var/vmail/',CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1)))
AS home, 5000 AS uid, 5000 AS gid,
CONCAT('maildir:storage=',quota_kb,':messages=',quota_messages) AS quota
FROM virtual_users WHERE email='%u';


My configuration

dovecot -n
# 1.2.11: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.30-2-686 i686 Debian squeeze/sid ext3
log_path: /var/vmail/dovecot-deliver.log
info_log_path: /var/vmail/dovecot-deliver.log
log_timestamp: %Y-%m-%d %H:%M:%S 
protocols: imaps pop3s managesieve
ssl_cert_file: /etc/ssl/certs/popimap.crt
ssl_key_file: /etc/ssl/private/popimap.key
verbose_ssl: yes
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
mail_max_userip_connections(default): 10
mail_max_userip_connections(imap): 10
mail_max_userip_connections(pop3): 3
mail_max_userip_connections(managesieve): 10
mail_location: maildir:/var/vmail/%d/%n/Maildir
mail_debug: yes
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugins(default): quota imap_quota
mail_plugins(imap): quota imap_quota
mail_plugins(pop3): quota
mail_plugins(managesieve): 
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
namespace:
  type: private
  separator: .
  prefix: INBOX.
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  postmaster_address: postmaster at mydomain.com
  mail_plugins: quota sieve
  auth_socket_path: /var/run/dovecot/auth-master
auth default:
  mechanisms: plain login
  passdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  userdb:
    driver: static
    args: uid=5000 gid=5000 home=/var/vmail/%d/%n allow_all_users=yes
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  sieve: ~/.dovecot.sieve
  sieve_dir: ~/sieve
  quota: dict:user::proxy::quotadict
  quota_rule: *:storage=100M
  quota_warning: storage=95%% /usr/local/bin/quota-warning.sh 95
dict:
  quotadict: mysql:/etc/dovecot/dovecot-dict-sql.conf

my configuration dovecot-sql.conf 
cat dovecot-sql.conf
#protocols = imap imaps pop3 pop3s
# Database driver: mysql, pgsql, sqlite
driver = mysql 

connect = host=127.0.0.1 dbname=mailserver user=mailsuer password=*****
default_pass_scheme = PLAIN-MD5

password_query = SELECT email,password FROM virtual_users WHERE
email='%u';

#user_query = SELECT home, uid, gid, concat('*:storage=', quota_bytes,
'B') AS quota_rule FROM virtual_users WHERE userid = '%u'
#user_query = SELECT maildir, 5000 AS uid, 5000 AS gid,
CONCAT('*:storage=', quota_bytes, 'B') AS quota_rule FROM virtual_users
WHERE userid = '%u'
#user_query = SELECT maildir AS home , 5000 AS uid, 5000 AS gid,
CONCAT('*:storage=',quota, 'B') AS quota_rule FROM virtual_users WHERE
username = '%u' 
#user_query = SELECT maildir AS home, 5000 AS uid, 5000 AS gid,
CONCAT('*:bytes=', CAST(quota AS CHAR)) AS quota_rule FROM quota WHERE
username = '%u' AND active = '1

I used all these configurations but none work.

yet but the quotas work through this option:
quota_rule: *:storage=100M
The problem is that quotas are not personalized.

I'm looking for a way to use quotas, but using my mysql database. I galley
for some time.
So if someone has an idea I am willing


More information about the dovecot mailing list