Log de l'utilisateur authentifié

tags/0.1.3
Daniel Berteaud 12 years ago
parent b56e73795a
commit ebf4c1e73d
  1. 16
      root/usr/share/qpsmtpd/plugins/logging/log2sql
  2. 1
      smtp_log.sql

@ -25,6 +25,8 @@ sub register {
my (%args) = @_;
$self->register_hook("connect", "connect_handler");
$self->register_hook("auth-plain", "auth_handler");
$self->register_hook("auth-login", "auth_handler");
$self->register_hook("mail", "mail_handler");
$self->register_hook("rcpt", "rcpt_handler");
$self->register_hook("data_post", "data_post_handler");
@ -92,6 +94,20 @@ sub connect_handler {
return(DECLINED);
}
sub auth_handler {
my ($self, $transaction, $method, $user) = @_;
my ($statement) = "UPDATE ".$mail_table." SET auth_user=".
$dbh->quote($user).
" WHERE mail_id=".$mail_id;
$self->log(LOGDEBUG,"auth_handler statement:".$statement);
$dbh->do($statement)
|| $self->log(LOGERROR,$dbh->errstr());
return(DECLINED);
}
sub mail_handler {
my ($self, $transaction, $sender) = @_;

@ -5,6 +5,7 @@ CREATE TABLE `messages` (
`remote_ip` varchar(255) default NULL,
`remote_host` varchar(255) default NULL,
`remote_info` varchar(255) default NULL,
`auth_user` varchar(30) default NULL,
`sender` varchar(255) default NULL,
`subject` varchar(255) default NULL,
`header_size` int(11) default NULL,

Loading…
Cancel
Save