|
From: <ssc...@us...> - 2003-03-21 05:33:15
|
Update of /cvsroot/popfile/engine/Proxy
In directory sc8-pr-cvs1:/tmp/cvs-serv9297
Modified Files:
SMTP.pm
Log Message:
implemented ideas suggested in patch 706596
Index: SMTP.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Proxy/SMTP.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SMTP.pm 6 Mar 2003 23:10:20 -0000 1.7
--- SMTP.pm 21 Mar 2003 05:33:12 -0000 1.8
***************
*** 106,113 ****
$self->log_( "Command: --$command--" );
! if ( $command =~ /HELO/ ) {
if ( $self->config_( 'chain_server' ) ) {
if ( $mail = $self->verify_connected_( $mail, $client, $self->config_( 'chain_server' ), $self->config_( 'chain_port' ) ) ) {
! $self->echo_response_( $mail, $client, $command );
} else {
last;
--- 106,116 ----
$self->log_( "Command: --$command--" );
! if ( $command =~ /HELO|EHLO/i ) {
if ( $self->config_( 'chain_server' ) ) {
if ( $mail = $self->verify_connected_( $mail, $client, $self->config_( 'chain_server' ), $self->config_( 'chain_port' ) ) ) {
!
! $self->smtp_echo_response_( $mail, $client, $command );
!
!
} else {
last;
***************
*** 125,133 ****
( $command =~ /RCPT TO:/i ) ||
( $command =~ /VRFY/i ) ||
! ( $command =~ /EXPN/i ) ||
( $command =~ /NOOP/i ) ||
( $command =~ /HELP/i ) ||
( $command =~ /RSET/i ) ) {
! $self->echo_response_( $mail, $client, $command );
$self->flush_extra_( $mail, $client, 0 );
next;
--- 128,136 ----
( $command =~ /RCPT TO:/i ) ||
( $command =~ /VRFY/i ) ||
! ( $command =~ /EXPN/i ) ||
( $command =~ /NOOP/i ) ||
( $command =~ /HELP/i ) ||
( $command =~ /RSET/i ) ) {
! $self->smtp_echo_response_( $mail, $client, $command );
$self->flush_extra_( $mail, $client, 0 );
next;
***************
*** 137,141 ****
# Get the message from the remote server, if there's an error then we're done, but if not then
# we echo each line of the message until we hit the . at the end
! if ( $self->echo_response_( $mail, $client, $command ) ) {
$count += 1;
--- 140,144 ----
# Get the message from the remote server, if there's an error then we're done, but if not then
# we echo each line of the message until we hit the . at the end
! if ( $self->smtp_echo_response_( $mail, $client, $command ) ) {
$count += 1;
***************
*** 157,161 ****
if ( $command =~ /QUIT/i ) {
if ( $mail ) {
! $self->echo_response_( $mail, $client, $command );
close $mail;
} else {
--- 160,164 ----
if ( $command =~ /QUIT/i ) {
if ( $mail ) {
! $self->smtp_echo_response_( $mail, $client, $command );
close $mail;
} else {
***************
*** 167,171 ****
# Don't know what this is so let's just pass it through and hope for the best
if ( $mail && $mail->connected ) {
! $self->echo_response_( $mail, $client, $command );
$self->flush_extra_( $mail, $client, 0 );
next;
--- 170,174 ----
# Don't know what this is so let's just pass it through and hope for the best
if ( $mail && $mail->connected ) {
! $self->smtp_echo_response_( $mail, $client, $command );
$self->flush_extra_( $mail, $client, 0 );
next;
***************
*** 179,182 ****
--- 182,218 ----
close $client;
}
+
+ # ---------------------------------------------------------------------------------------------
+ #
+ # smtp_echo_response_
+ #
+ # $mail The stream (created with IO::) to send the message to (the remote mail server)
+ # $client The local mail client (created with IO::) that needs the response
+ # $command The text of the command to send (we add an EOL)
+ #
+ # Send $command to $mail, receives the response and echoes it to the $client and the debug
+ # output.
+ #
+ # This subroutine returns responses from the server as defined in appendix E of
+ # RFC 821, allowing multi-line SMTP responses.
+ #
+ # Returns true if the initial response is a 2xx or 3xx series (as defined by {good_response_}
+ #
+ # ---------------------------------------------------------------------------------------------
+
+
+
+ sub smtp_echo_response_
+ {
+ my ($self, $mail, $client, $command) = @_;
+ my $response = $self->get_response_( $mail, $client, $command );
+
+ if ( $response =~ /^[23]\d\d-/ ) {
+ $self->echo_to_regexp_($mail, $client, qr/^\d\d\d /, 1);
+ }
+ return ( $response =~ /$self->{good_response_}/ );
+ }
+
+
1;
|