On Sun, 31 Dec 2006 06:52:25 -0500
Guy Hulbert <[EMAIL PROTECTED]> wrote:
> On Sun, 2006-31-12 at 08:59 +0100, Hanno Hecker wrote:
> > The best thing[tm] would be a uniform Qpsmtpd::DBI module, which
> > handles all flavours of qpsmtpd. I can do this for -forkserver and
> > -prefork, but I will need help for Apache::Qpsmtpd and -async.
> I've started working on a dbi auth plugin but stalled due to being busy
> over the holiday. Also because I've been trying to understand how the
> plugins work.
>
> For authentication, I would assume that things are a bit simpler than a
> general module. Could you clarify for me:
>
> 1. I want to read the connection parameters from config/auth_dbi
> 2. I will make a new DBI connection for each auth request so I store
> the db name, user, password rather than '$dbh'.
This will be ok for stuff which is requested just once or twice. For
reading config values from a DB (and auth data ;-)) connecting,
querying and disconnecting for each request is too much.
> I understand how to get the config parameters but I don't have a good
> sense of how init() is called. Presumably when the plugin is loaded but
Yes, plugin is loaded, then init() is called.
> I notice in some plugins that arguments are passed to init() while in
> others the configuration is read directly.
The arguments passed to init() are the values from the plugin line in
config/plugins. See plugins/spamassassin for one example.
> 3. Are the arguments passed read from the config file or do I have to
No, see above.
> do that myself -- is init() the right place to read them if I only want
...depends on your config file. For most things
@lines = $self->qp->config("filename"));
will do. This will read each line (non empty and not starting with a
"#") from config/filename. Parsing these lines is the plugin's job.
> to read the configuration once ?
Yes, init() is the right place for reading this once.
Hanno