Mailing List Archive

group quotas - this time mysql also
Hi all,
I've finally gotten to do more work on this.

Attached is an implementation of group quotas for both pgsql and mysql for dbmail-1.2.3

I've dropped the idea of using the config table, in favour of using a seperate clients table.

The table needs two columns; one which holds the client_idnr as per the users table, the other which holds the maxmail_size for the client.

Since I'm guessing some people may already have their own tables for tracking client info, I chose not to hardcode the table/field names.

Given that there doesn't appear to be a consensus on the config table, I dumped the following into /etc/dbmail.conf

CLIENT_TABLE=dbmail_clients # The name of the table which
# holds the group quotas
CLIENT_IDNR_FIELD=client_idnr # The name of the column which
# holds the client_idnrs
CLIENT_MAXMAIL_FIELD=maxmail_size # The name of the column which
# holds the quota.

If these aren't found, the group checks will be skipped.

Since db(pg/my)sql didn't normally have access to the config struct, I had to move the sysItems declarations to just before main() in imapd, maintainence, pop3d and user.c - There is probably a better way to do it, but it's been a long time since I dealt with a Makefile with more than a few lines, so I took the easy way out :)

Somebody should look over the mysql code especially, as I've never worked with it before. As an aside, the 'create_tables.mysql' schema didn't work for me with mysql 4.1.0-alpha
It complained about the default values in lines such as
"alias_idnr bigint(21) default '0' not null auto_increment"

I took a brief look at the docs, and apparently if a numeric column is not null, it'll default to 0 already, so I just removed the "default '0'". That could well be a bug with my mysql, I don't know, I never use it.

Anyway, please look over it, test it, and give me feedback - Hopefully I'll get to do it too for the 2.x tree over the weekend, g/f allowing :)

-fr.

--
Feargal Reilly,
Codeshifter,
Chrysalink Systems.