group quota warning to CC

i have discovered an edge case in /usr/libexec/webmin/quota/email.pl

if you look at the group quota code, you will find:

local $to;
if quota user from group, set $to = groupname
if quota user from fixed address, set $to = fixed address
else (quota user from virtualmin), look up the domain owner's contact address/user and if domain is found set $to = contact address
if ($to) send out the quota email to user + CC

do you spot the edge case ? ;)

hint: if lookup mode is set to virtualmin, and the group that has hit its quota is not owned by a domain managed by virtualmin (such as a system group), then $to remains empty, so no warning email is sent out to the CC address either.

this means a system admin will not get group warnings for non-virtualmin-domain groups since the send_quota_mail() code will not run when $to is empty.

a fix would probably involve splitting the CC and regular email code from each other (currently they take place in the same function call to send_quota_mail()), so that it first emails the group owner IF FOUND and then emails the CC address regardless.

maybe even change send_quota_mail() to accept an array of to-addresses and generate individual emails for each recipient; this would allow easy notification-list expansion simply by putting each in the array, like "send email to group/domain owner if one exists, and also send to root and to admin@machine.com" which would generate 3 emails. care would have to be taken to also remove duplicate entries from the array before sending, to avoid dual emails if affected account and admin account are the same.

Status: 
Closed (fixed)

Comments

Thanks for pointing this out - I will fix this in the next release of webmin.

Automatically closed -- issue fixed for 2 weeks with no activity.