Author: jpeacock
Date: Mon Oct 31 09:12:37 2005
New Revision: 556
Modified:
branches/0.31/lib/Qpsmtpd.pm
branches/0.31/lib/Qpsmtpd/Auth.pm
branches/0.31/lib/Qpsmtpd/Plugin.pm
branches/0.31/lib/Qpsmtpd/SMTP.pm
Log:
* 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.
Modified: branches/0.31/lib/Qpsmtpd.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd.pm (original)
+++ branches/0.31/lib/Qpsmtpd.pm Mon Oct 31 09:12:37 2005
@@ -423,6 +423,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;
Modified: branches/0.31/lib/Qpsmtpd/Auth.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd/Auth.pm (original)
+++ branches/0.31/lib/Qpsmtpd/Auth.pm Mon Oct 31 09:12:37 2005
@@ -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;
Modified: branches/0.31/lib/Qpsmtpd/Plugin.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd/Plugin.pm (original)
+++ branches/0.31/lib/Qpsmtpd/Plugin.pm Mon Oct 31 09:12:37 2005
@@ -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;
Modified: branches/0.31/lib/Qpsmtpd/SMTP.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd/SMTP.pm (original)
+++ branches/0.31/lib/Qpsmtpd/SMTP.pm Mon Oct 31 09:12:37 2005
@@ -225,6 +225,19 @@ HOOK: foreach my $hook ( keys %{$self->{
}
}
+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;