* lib/Qpsmtpd/Auth.pm

lib/Qpsmtpd/SMTP.pm
    Take the AUTH method and put it in SMTP.pm where it belongs.

* lib/Qpsmtpd.pm
  lib/Qpsmtpd/Plugin.pm
    Expose the auth_user/auth_mechanism property to plugin writers.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@556 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2005-10-31 17:12:37 +00:00
parent e67bbed2ac
commit 5959cc1c32
4 changed files with 31 additions and 13 deletions

View File

@ -424,6 +424,16 @@ sub size_threshold {
return $Size_threshold;
}
sub auth_user {
my $self = shift;
return (defined $self->{_auth_user} ? $self->{_auth_user} : "" );
}
sub auth_mechanism {
my $self = shift;
return (defined $self->{_auth_mechanism} ? $self->{_auth_mechanism} : "" );
}
1;
__END__

View File

@ -226,19 +226,6 @@ sub e64
return($res);
}
sub Qpsmtpd::SMTP::auth {
my ( $self, $arg, @stuff ) = @_;
#they AUTH'd once already
return $self->respond( 503, "but you already said AUTH ..." )
if ( defined $self->{_auth}
and $self->{_auth} == OK );
return $self->respond( 503, "AUTH not defined for HELO" )
if ( $self->connection->hello eq "helo" );
return $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $arg, @stuff );
}
sub SASL {
# $DB::single = 1;

View File

@ -65,6 +65,14 @@ sub spool_dir {
shift->qp->spool_dir;
}
sub auth_user {
shift->qp->auth_user;
}
sub auth_mechanism {
shift->qp->auth_mechanism;
}
sub temp_file {
my $self = shift;
my $tempfile = $self->qp->temp_file;

View File

@ -225,6 +225,19 @@ HOOK: foreach my $hook ( keys %{$self->{hooks}} ) {
}
}
sub auth {
my ( $self, $arg, @stuff ) = @_;
#they AUTH'd once already
return $self->respond( 503, "but you already said AUTH ..." )
if ( defined $self->{_auth}
and $self->{_auth} == OK );
return $self->respond( 503, "AUTH not defined for HELO" )
if ( $self->connection->hello eq "helo" );
return $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $arg, @stuff );
}
sub mail {
my $self = shift;
return $self->respond(501, "syntax error in parameters") if !$_[0] or $_[0] !~ m/^from:/i;