From: <ssc...@us...> - 2003-05-22 23:33:59
|
Update of /cvsroot/popfile/engine/Proxy In directory sc8-pr-cvs1:/tmp/cvs-serv22529 Modified Files: Proxy.pm SMTP.pm Log Message: implement suppression of unsupported ESMTP extensions Index: Proxy.pm =================================================================== RCS file: /cvsroot/popfile/engine/Proxy/Proxy.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Proxy.pm 9 May 2003 00:33:42 -0000 1.15 --- Proxy.pm 22 May 2003 23:33:55 -0000 1.16 *************** *** 332,335 **** --- 332,336 ---- # $regexp The pattern match to terminate echoing, compile using qr/pattern/ # $verbose (OPTIONAL) log output if 1, defaults to 0 if unset + # $suppress (OPTIONAL) suppress any lines that match, compile using qr/pattern/ # # echo all information from the $mail server until a single line matching $regexp is seen *************** *** 338,342 **** sub echo_to_regexp_ { ! my ( $self, $mail, $client, $regexp, $verbose ) = @_; $verbose = 0 if (!defined($verbose)); --- 339,343 ---- sub echo_to_regexp_ { ! my ( $self, $mail, $client, $regexp, $verbose, $suppress ) = @_; $verbose = 0 if (!defined($verbose)); *************** *** 346,357 **** last if ( $self->{alive_} == 0 ); ! ! if (!$verbose) { ! print $client $_; ! } else { ! # This creates log output ! ! $self->tee_($client, $_); ! } last if ( $_ =~ $regexp ); --- 347,362 ---- last if ( $self->{alive_} == 0 ); ! ! if (!defined($suppress) || !( $_ =~ $suppress )) { ! if (!$verbose) { ! print $client $_; ! } else { ! # This creates log output ! ! $self->tee_($client, $_); ! } ! } else { ! $self->log_("Suppressed: $_"); ! } last if ( $_ =~ $regexp ); Index: SMTP.pm =================================================================== RCS file: /cvsroot/popfile/engine/Proxy/SMTP.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SMTP.pm 22 May 2003 09:25:03 -0000 1.11 --- SMTP.pm 22 May 2003 23:33:55 -0000 1.12 *************** *** 128,132 **** $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' ) ) ) { --- 128,132 ---- $self->log_( "Command: --$command--" ); ! if ( $command =~ /HELO/i ) { if ( $self->config_( 'chain_server' ) ) { if ( $mail = $self->verify_connected_( $mail, $client, $self->config_( 'chain_server' ), $self->config_( 'chain_port' ) ) ) { *************** *** 146,149 **** --- 146,191 ---- next; } + + # Handle EHLO specially so we can control what ESMTP extensions are negotiated + + if ( $command =~ /EHLO/i ) { + if ( $self->config_( 'chain_server' ) ) { + if ( $mail = $self->verify_connected_( $mail, $client, $self->config_( 'chain_server' ), $self->config_( 'chain_port' ) ) ) { + + # TODO: Make this user-configurable (-smtp_add_unsupported, -smtp_remove_unsupported) + + # Stores a list of unsupported ESMTP extensions + + my $unsupported; + + + + # RFC 1830, http://www.faqs.org/rfcs/rfc1830.html + # CHUNKING and BINARYMIME both require the support of the "BDAT" command + # support of BDAT requires extensive changes to POPFile's internals and + # will not be implemented at this time + + $unsupported .= "CHUNKING|BINARYMIME"; + + # append unsupported ESMTP extensions to $unsupported here, important to maintain + # format of OPTION|OPTION2|OPTION3 + + $unsupported = qr/250\-$unsupported/; + + $self->smtp_echo_response_( $mail, $client, $command, $unsupported ); + + + } else { + last; + } + + $self->flush_extra_( $mail, $client, 0 ); + } else { + $self->tee_( $client, "421 service not available$eol" ); + } + + next; + } + if ( ( $command =~ /MAIL FROM:/i ) || *************** *** 212,215 **** --- 254,258 ---- # $client The local mail client (created with IO::) that needs the response # $command The text of the command to send (we add an EOL) + # $suppress (OPTIONAL) suppress any lines that match, compile using qr/pattern/ # # Send $command to $mail, receives the response and echoes it to the $client and the debug *************** *** 224,232 **** sub smtp_echo_response_ { ! my ($self, $mail, $client, $command) = @_; my $response = $self->get_response_( $mail, $client, $command ); if ( $response =~ /^\d\d\d-/ ) { ! $self->echo_to_regexp_($mail, $client, qr/^\d\d\d /, 1); } return ( $response =~ /$self->{good_response_}/ ); --- 267,275 ---- sub smtp_echo_response_ { ! my ($self, $mail, $client, $command, $suppress) = @_; my $response = $self->get_response_( $mail, $client, $command ); if ( $response =~ /^\d\d\d-/ ) { ! $self->echo_to_regexp_($mail, $client, qr/^\d\d\d /, 1, $suppress); } return ( $response =~ /$self->{good_response_}/ ); |