diff --git a/Changes b/Changes index 0e5e58f..dbc30cc 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,18 @@ +0.20 - development + + Store hooks runtime config globally so they will work within the + transaction objects too. + + content_log plugin - log the content of all mails for + debugging. Robert Spier . + + http_config plugin - get configuration via http + + plugins can take arguments via their line in the "plugins" file + + make the quit_fortune plugin check that the fortune program exists + + 0.12 - 2002/10/17 Better error messages when a plugin fails diff --git a/STATUS b/STATUS index 3c92a0b..227da14 100644 --- a/STATUS +++ b/STATUS @@ -12,6 +12,8 @@ plugin support; plugin access to the data line by line during the DATA phase (instead of just after) + if qmail-queue can't be loaded we still return 250 ?! + TRACE in Constants.pm is not actually being used. Should it be? diff --git a/plugins/http_config b/plugins/http_config new file mode 100644 index 0000000..0018595 --- /dev/null +++ b/plugins/http_config @@ -0,0 +1,50 @@ +=head1 NAME + +http_config + +=head1 DESCRIPTION + +Example config plugin. Gets configuration data via http requests. + +=head1 CONFIG + +http_config is configured at plugin loading time via the plugins +config. Load the plugin with a list of urls like the folllowing. + + http_config http://localhost/~smtpd/config/ http://www.example.com/cgi-bin/qp?config= + +Looking to config "me", qpsmtpd will try loading +http://localhost/~smtpd/config/me and if failing that then try +http://www.example.com/cgi-bin/qp?config=me + +=head1 BUGS + +http_config doesn't do any caching. It should do some simple caching +to be used in production. + +=cut + +use LWP::Simple qw(get); + +my @urls; + +sub register { + my ($self, $qp, @args) = @_; + @urls = @args; + $self->register_hook("config", "http_config"); +} + +sub http_config { + my ($self, $transaction, $config) = @_; + $self->log(0, "http_config called with $config"); + for my $url (@urls) { + $self->log(10, "http_config loading from $url"); + my @config = split /[\r\n]+/, (get "$url$config" || ""); + chomp @config; + @config = grep { $_ and $_ !~ m/^\s*#/ and $_ =~ m/\S/ } @config; + close CF; + $self->log(0, "returning http_config for $config ",Data::Dumper->Dump([\@config], [qw(config)])); + return (OK, @config) if @config; + } + return DECLINED; +} diff --git a/plugins/quit_fortune b/plugins/quit_fortune index da06239..43bfaa1 100644 --- a/plugins/quit_fortune +++ b/plugins/quit_fortune @@ -10,7 +10,12 @@ sub quit_handler { # fun, so skip it. return (DECLINED) if ($qp->connection->hello || '') eq "ehlo"; - my @fortune = `/usr/games/fortune -s`; + my $fortune = '/usr/games/fortune'; + return DECLINED unless -e $fortune; + + # local %ENV = (); + + my @fortune = `$fortune -s`; @fortune = map { chop; s/^/ \/ /; $_ } @fortune; $qp->respond(221, $qp->config('me') . " closing connection.", @fortune); return DONE;