On Freitag, 1. Juni 2007 Aaron Stone wrote:
> It might actually be useful to add another flag to dbmail-util to do
> this for you -- a sort of 'rebuild everything from scratch' option.

I also found these things should be done in dbmail-util:
1) dbmail_aliases: when you have an entry
alias1 -> 1000 (i.e. the userid 1000)
and then you delete the user with userid 1000, you have a stale entry 
that should be removed.
The bad thing is that the design of that table is broken, as you can't 
guarantee that the number refers to an existing user. OTOH, I don't 
know how to do it better, other than introducing another 
table "dbmail_external_aliases" just for text entries, and changing the 
existing dbmail_aliases to having only user_idnr.
So at least dbmail-util should clean up the mess here.

To see which aliases are stale:
select * from dbmail_aliases left join dbmail_users on 
(deliver_to=user_idnr) where deliver_to not like '[EMAIL PROTECTED]' and userid 
is 
null order by deliver_to;

2) dbmail_aliases: check for loops that can happen when userid's (=login 
names) are changed:
alias -> deliver_to -> userid
and that userid equals alias. I've had this after renaming logins from 
cyrus users that were "user.dom.ain" to "[EMAIL PROTECTED]", and then the 
old aliases [EMAIL PROTECTED] -> user.dom.ain became redundant.

To delete those directly:
delete from dbmail_aliases where alias in (select a.alias from 
dbmail_aliases as a left join dbmail_users as b on (a.deliver_to = 
b.user_idnr) where char_length(a.deliver_to) = 4 and a.alias=b.userid);

mfg zmi
-- 
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0676/846 914 666                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: EA39 8918 EDFF 0A68 ACFB  11B7 BA2D 060F 1C6F E6B0
// Keyserver: www.keyserver.net                   Key-ID: 1C6FE6B0

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to