[qmailadmin] qmailadmin onchange patch

2007-07-12 Thread John Simpson

howdy-

i wrote the onchange patch which was added to vpopmail version  
5.4.15. if you're not familiar with it, it allows the administrator  
to set up a ~vpopmail/etc/onchange script which is automatically  
executed whenever something changes with vpopmail's status, i.e. when  
a domain, mailbox, or alias is added or removed, or a password is  
changed.


my reason for writing this is to support the validrcptto.cdb patch  
that i wrote for qmail. it enables qmail to consult a cdb file  
containing every valid recipient address on the system, and reject  
incoming messages which are being sent to non-existent users.


http://qmail.jms1.net/patches/validrcptto.cdb.shtml

the idea is that whenever something changes- mailbox, alias,  
whatever- the list of valid recipient addresses also changes, which  
means that the validrcptto.cdb file needs to be re-generated. i have  
a daemontools service that i call qmail-updater, which waits for  
input on a named pipe and then runs a script as root. the named pipe  
is writable by any user. the root script re-generates the  
validrcptto.cdb and auth.cdb files, and then for one of my clients,  
pushes those files out to three other machines which pre-process the  
flood of incoming mail through rblsmtpd, clamav, and spamassassin,  
and then hand the messages to the mailbox server.


http://qmail.jms1.net/scripts/qmail-updater.shtml
http://qmail.jms1.net/mailhub.shtml

of course the onchange functionality can be used for other things-  
to automatically make a final backup of a mailbox before deleting it,  
for example.


anyway.

somebody using the vpopmail onchange patch, along with qmailadmin,  
reported that qmailadmin does not call the onchange function when  
it creates a mailing list. this makes perfect sense- qmailadmin was  
never patched to make it call this function, IF it was even available.


his work-around was to trigger his qmail-updater service via cron  
job every five minutes. that seemed rather ugly to me, so i looked  
into what it would take to make qmailadmin call the onchange script  
whenever a mailing list was added (or deleted.)


it turned out that adding the necessary code was a twenty-minute  
exercise, most of which involved finding the correct places to add  
the code, and then realizing that i needed to include  
vpopmail_config.h so that the compiler would know whether or not to  
include the onchange code in the executable.


so i'm submitting the patch to the qmailadmin developers (rick i  
believe) so that it can be added to a future version of qmailadmin.  
and in the meantime, anybody who wants to try it is free to download  
it. it's about halfway down on this page:


http://qmail.jms1.net/patches/vpopmail.shtml

the page has two versions- the 1.2.9 version applies cleanly to the  
1.2.10 code, while the 1.2.11 version is actually running on my own  
server, and has been tested- it does call the onchange script after  
adding and before removing a mailing list.


the one thing i noticed is that four error messages show up because  
the same constants exist in vpopmail's vpopmail_config.h and  
qmailadmin's config.h, however this appears to me to be a non-issue  
because the qmailadmin file is included AFTER the vpopmail file.



| John M. Simpson---   KG4ZOW   ---Programmer At Large |
| http://www.jms1.net/ [EMAIL PROTECTED] |

| http://video.google.com/videoplay?docid=-4312730277175242198 |





PGP.sig
Description: This is a digitally signed message part


Re: [qmailadmin] qmailadmin onchange patch

2007-07-12 Thread Rick Widmer
Tom:  Do you still have a lock on qmailadmin development?  If not I'll 
see about getting this added.



Rick

John Simpson wrote:
snip