dbaa9dbd6c
on files in plugins dir: fixed a number of POD errors formatted some # comments into POD removed bare 1; (these are plugins, not perl modules) most instances of this were copy/pasted from a previous plugin that had it removed instances of # vim ts=N ... they weren't consistent, many didn't match .perltidyrc on modules that failed perl -c tests, added 'use Qpsmtpd::Constants;' Conflicts: plugins/async/check_earlytalker plugins/async/dns_whitelist_soft plugins/async/dnsbl plugins/async/queue/smtp-forward plugins/async/require_resolvable_fromhost plugins/async/rhsbl plugins/async/uribl plugins/auth/auth_checkpassword plugins/auth/auth_cvm_unix_local plugins/auth/auth_flat_file plugins/auth/auth_ldap_bind plugins/auth/auth_vpopmail plugins/auth/auth_vpopmail_sql plugins/auth/authdeny plugins/check_badmailfromto plugins/check_badrcptto_patterns plugins/check_bogus_bounce plugins/check_earlytalker plugins/check_norelay plugins/check_spamhelo plugins/connection_time plugins/dns_whitelist_soft plugins/dnsbl plugins/domainkeys plugins/greylisting plugins/hosts_allow plugins/http_config plugins/logging/adaptive plugins/logging/apache plugins/logging/connection_id plugins/logging/transaction_id plugins/logging/warn plugins/milter plugins/queue/exim-bsmtp plugins/queue/maildir plugins/queue/postfix-queue plugins/queue/smtp-forward plugins/quit_fortune plugins/random_error plugins/rcpt_map plugins/rcpt_regexp plugins/relay_only plugins/require_resolvable_fromhost plugins/rhsbl plugins/sender_permitted_from plugins/spamassassin plugins/tls plugins/tls_cert plugins/uribl plugins/virus/aveclient plugins/virus/bitdefender plugins/virus/clamav plugins/virus/clamdscan plugins/virus/hbedv plugins/virus/kavscanner plugins/virus/klez_filter plugins/virus/sophie plugins/virus/uvscan
82 lines
2.4 KiB
Perl
82 lines
2.4 KiB
Perl
#!perl -Tw
|
|
# this is a simple 'connection_id' plugin like the default builtin logging
|
|
#
|
|
# It demonstrates that a logging plugin can call ->log itself as well
|
|
# as how to ignore log entries from itself
|
|
|
|
sub register {
|
|
my ($self, $qp, $loglevel) = @_;
|
|
die "The connection ID feature is currently unsupported";
|
|
$self->{_level} = LOGWARN;
|
|
if ( defined($loglevel) ) {
|
|
if ($loglevel =~ /^\d+$/) {
|
|
$self->{_level} = $loglevel;
|
|
}
|
|
else {
|
|
$self->{_level} = log_level($loglevel);
|
|
}
|
|
}
|
|
|
|
# If you want to capture this log entry with this plugin, you need to
|
|
# wait until after you register the plugin
|
|
$self->log(LOGINFO,'Initializing logging::connection_id plugin');
|
|
}
|
|
|
|
sub hook_logging {
|
|
my ($self, $transaction, $trace, $hook, $plugin, @log) = @_;
|
|
|
|
# Don't log your own log entries! If this is the only logging plugin
|
|
# then these lines will not be logged at all. You can safely comment
|
|
# out this line and it will not cause an infinite loop.
|
|
return DECLINED if defined $plugin and $plugin eq $self->plugin_name;
|
|
|
|
my $connection = $self->qp && $self->qp->connection;
|
|
# warn "connection = $connection\n";
|
|
warn
|
|
join(" ", ($connection ? $connection->id : "???") .
|
|
(defined $plugin ? " $plugin plugin:" :
|
|
defined $hook ? " running plugin ($hook):" : ""),
|
|
@log), "\n"
|
|
if ($trace <= $self->{_level});
|
|
|
|
return DECLINED;
|
|
}
|
|
|
|
=head1 NAME
|
|
|
|
connection_id - plugin to demo use of the connection id
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
A qpsmtpd plugin which replicates the built in logging functionality, which
|
|
is to send all logging messages to STDERR below a specific log level.
|
|
|
|
This plugin differs from logging/warn only by using the connection id
|
|
instead of the pid to demonstrate the effect of different algorithms.
|
|
|
|
=head1 INSTALL AND CONFIG
|
|
|
|
Place this plugin in the plugin/logging directory beneath the standard
|
|
qpsmtpd installation. Edit the config/logging file and add a line like
|
|
this:
|
|
|
|
logging/connection_id [loglevel]
|
|
|
|
where the optional parameters C<loglevel> is either the numeric or text
|
|
representation of the maximum log level, as shown in the
|
|
L<config.sample/loglevel> file.
|
|
|
|
=head1 AUTHOR
|
|
|
|
John Peacock <jpeacock@cpan.org>
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
Copyright (c) 2005 John Peacock
|
|
|
|
This plugin is licensed under the same terms as the qpsmtpd package itself.
|
|
Please see the LICENSE file included with qpsmtpd for details.
|
|
|
|
=cut
|
|
|