On 2006-03-27, at 1304, Robin Bowes wrote:
John Simpson wrote:i have written a patch against vpopmail-5.4.15 which causes any changesto trigger "~vpopmail/etc/onchange", if it exists and if it is executable to the userid which is running the vpopmail program. thepatch can be downloaded, and simple directions found, at the bottom ofthis page:http://qmail.jms1.net/patches/ i am running this on my own server as we speak- it seems to work well so far, and i will be writing the scripting to have it build a new validrcptto.cdb over the next day or two.my hope is that there is enough interest in this functionality that itcan be integrated into a future verison of vpopmail.John, Can this be modified to pass parameters to the program/script? For example, the action that has just occurred, plus any data associated with that action? e.g. "onchange useradd [EMAIL PROTECTED]"
i guess it's not impossible... i hadn't thought of doing that, but it shouldn't be hard.
looking at the code, i guess we can have the script be called with a command line consisting of:
- a command (to tell what was done.) the commands would be the same commands which are used in vpopmaild (i.e. "add_domain", "del_domain", "add_alias_domain", "add_user", "del_user", and "mod_user"... the only question is how to handle calls to valias_insert(), valias_remove(), and valias_delete()- what command should they put on the script's command line? for now i'll just go with the function names- "valias_insert", "valias_remove", and "valias_delete".
the valias_insert() function adds a line to an existing alias, or if it doesn't exist, it creates an alias.
the valias_remove() function removes an existing line from an alias. if that was the last line, the alias is deleted.
the valias_delete() function removes all lines from an alias, deleting it.
i don't know what bearing this might have on somebody's script some day, but i figure it doesn't hurt to document it somewhere.
- the target of that command. for "add_domain", "del_domain", and "add_alias_domain", the target is the domain name. for all other commands, the target is the mailbox or alias which is being operated on.
that's all. no passwords, no alias targets, nothing else. if a user's script needs more information, they can read whatever file or database holds the data directly.
and i was right, it wasn't that hard. same web page.
Also, have you tried this with vqadmin/qmailadmin? The reason I mentionthis is that I'm having a bugger of a job getting my code that implements skel dirs to work with vqadmin - it works fine from the command line (as root) but I get a permission denied error when executing from vqadmin.
i've tried it with qmailadmin, and i've tried it with the command line tools, and i've tried it from a vpopmaild service. all seem to trigger the script when they should. however you couldn't pay me to use vqadmin in its current form (nothing personal, i understand you guys are working on other things- and to be honest i'm happier adding and removing domains with the command line tools any way.)
http://qmail.jms1.net/vpopmaild.shtml shows a clearer example of how to run vpopmaild under daemontools, by the way.
-------------------------------------------------- | John M. Simpson - KG4ZOW - Programmer At Large | | http://www.jms1.net/ <[EMAIL PROTECTED]> | -------------------------------------------------- | Mac OS X proves that it's easier to make UNIX | | pretty than it is to make Windows secure. | --------------------------------------------------
PGP.sig
Description: This is a digitally signed message part