Re: Getting quota limits from DB
Adam Miller via dovecot <[email protected]>
| Newsgroups | gmane.mail.imap.dovecot |
|---|---|
| Message-ID | <0100019cb62e1633-2580bb96-475b-4b54-9299-ac1dc8cd64f4-000000@email.amazonses.com> |
Hi Alberto!
I just upgrade from 2.3 to 2.4.2 last night. It looks like your query is
incorrect. It should be returning “quota_storage_size” and
“quota_message_count” but right now your query is returning
“userdb_quota_storage_size” and “userdb_quota_storage_size”.
Try this instead:
userdb sql {
query = SELECT home, CONCAT(username, '@', domain) AS username,
crampassword AS password, uid, gid, CONCAT(COALESCE(quota, 0), 'B') AS
quota_storage_size, COALESCE(quotamsgs, 0) AS quota_message_count FROM
users WHERE username = '%{ user | username | lower }' AND domain = '%{
user | domain | lower }’
iterate_query = SELECT CONCAT(username,'@',domain) AS user FROM users
}
Adam L Miller
Arda Dynamics, LLC / Recoil Networks, LLC
[email protected] | [email protected]
------ Original Message ------
>From "Alberto via dovecot" <[email protected]>
To [email protected]
Date 3/3/2026 2:43:45 PM
Subject Getting quota limits from DB
>Hi group:
>
>I have a Docker Dovecot 2.4.2 installation with MySQL user management, with this record:
>
>SELECT * FROM users;
>+----------------------------------------------------------------------------
>| username | domain | password | home | uid | gid | active | quota | quotamsgs | crampassword
>+----------------------------------------------------------------------------
>| alberto | bersol.info | {MD5-CRYPT}$1$Jm... | /var/mail/alberto | 1000 | 1000 | Y | 3221225472 | 149999 | {CRAM-MD5}fd246... |
>+----------------------------------------------------------------------------
>
>But I have a problem with user quota definitions...
>
>If I run "doveadm" command, I get the user quota occupation, I have "quota_clone" plugin working, but I don't get user quota limit, I don't know why:
>
>-----
># docker exec -it midovecot doveadm quota get -A
>Username Quota name Type Value Limit %
>[email protected] User quota STORAGE 1925805 3145728 61
>[email protected] User quota MESSAGE 37608 100000 37
>-----
>
>That limit isn't the correct limit set in DB, but the one is put in the config, and it must to be override in my userdb:Extra Fields.
>-----
># # docker exec -it midovecot doveadm config
># 2.4.2 (0962ed2104): /etc/dovecot/dovecot.conf
>...
>userdb sql {
>iterate_query = SELECT CONCAT(username,'@',domain) AS user FROM users
>query = SELECT home,CONCAT(username,'@',domain) AS username,crampassword AS password,uid AS userdb_uid,gid AS userdb_gid,CONCAT(quota,'B') AS userdb_quota_storage_size,concat('*:messages=',quotamsgs) AS userdb_quota_storage_size FROM users WHERE username = '%{ user | username | lower }' AND domain = '%{ user | domain | lower }'
>}
>...
>quota_storage_size = 3G
>quota_message_count = 100000
>...
>-----
>
>Do you have any idea of the problem?
>
>Best Regards,
>Alberto
>
>_______________________________________________
>dovecot mailing list -- [email protected]
>To unsubscribe send an email to [email protected]
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]