dev at stean.ch
2014-Mar-25 06:47 UTC
[Dovecot] Getting second quota limit out of database
Hello there, I am working with dovecot v2.2.12, and have setup a user and domain quota by using a quota/quota_rule for user and quota2/quota2_rule for the domain. This works fine when the limit configuration for both is stored inside dovecot configuration files. However, I would like to have the limits configurable on a user and domain base, and that data is stored inside my SQL database. Getting the user quota out of a database with SQL works fine, as documented with "SELECT whatever AS quota_rule FROM mytable", I extended my query to return quota2_rule too, but dovecot did not really do something with that value in the end, the domain limit was set to 0, as visible through the logs and with doveadm quota get ... Any idea or hint how I could get dovecot to read the limit for the domains out of my SQL database ? Thanks, Stephan
dev at stean.ch wrote:> Hello there, > > I am working with dovecot v2.2.12, and have setup a user and domain > quota by using a quota/quota_rule for user and quota2/quota2_rule for > the domain. > > This works fine when the limit configuration for both is stored inside > dovecot configuration files. However, I would like to have the limits > configurable on a user and domain base, and that data is stored inside > my SQL database. > > Getting the user quota out of a database with SQL works fine, as documented > with "SELECT whatever AS quota_rule FROM mytable", I extended my query > to return quota2_rule too, but dovecot did not really do something with > that value in the end, the domain limit was set to 0, as visible through > the logs and with doveadm quota get ... > > Any idea or hint how I could get dovecot to read the limit for the domains > out of my SQL database ? > > Thanks, StephanWorks here with 2.2.9 (Debian). Snippet from userdb SQL query: user_query = SELECT ... '*:bytes=' || domains.quota_size || 'M:messages=' || domains.quota_files as quota_rule, '*:bytes=' || mailboxes.quota_size || 'M:messages=' || mailboxes.quota_files as quota2_rule ... Using quota backend "fs" for both (user quota for mailbox, group quota for domain) plugin { quota = fs:Domain quota:group:inode_per_mail quota2 = fs:Mailbox quota:user:inode_per_mail }