PKGBUILDs/extra/smtpprox/smtpprox-tmpname-and-xforward.patch

45 lines
1.3 KiB
Diff
Raw Normal View History

2009-10-10 02:23:22 +00:00
diff -urN smtpprox-1.2/MSDW/SMTP/Server.pm smtpprox-1.2-fixed/MSDW/SMTP/Server.pm
--- smtpprox-1.2/MSDW/SMTP/Server.pm 2003-03-09 13:52:24.000000000 -0500
+++ smtpprox-1.2-fixed/MSDW/SMTP/Server.pm 2007-01-18 13:27:44.000000000 -0500
@@ -13,6 +13,7 @@
package MSDW::SMTP::Server;
use IO::Socket;
use IO::File;
+use File::Temp qw(mkstemp);
=head1 NAME
@@ -183,13 +184,21 @@
return 0 unless defined($_ = $self->getline);
s/[\r\n]*$//;
$self->{state} = $_;
- if (s/^helo\s+//i) {
+ if (s/^(helo|ehlo)\s+//i) {
s/\s*$//;s/\s+/ /g;
$self->{helo} = $_;
+ } elsif (s/^xforward\s*//i) {
+ my (@attr) = split(/\s+/, $_);
+ my ($attr);
+ foreach $attr (@attr) {
+ my ($name, $value) = ($attr =~ /^(.*?)=(.*)$/);
+ $self->{xforward}->{lc($name)} = $value;
+ }
} elsif (s/^rset\s*//i) {
delete $self->{to};
delete $self->{data};
delete $self->{recipients};
+ delete $self->{xforward};
} elsif (s/^mail\s+from:\s*//i) {
delete $self->{to};
delete $self->{data};
@@ -208,7 +217,8 @@
$self->{data}->seek(0, 0);
$self->{data}->truncate(0);
} else {
- $self->{data} = IO::File->new_tmpfile;
+ (undef, $self->{datafilename}) = mkstemp("/tmp/smtpproxXXXXXX");
+ $self->{data} = new IO::File $self->{datafilename}, "r+";
}
while (defined($_ = $self->getline)) {
if ($_ eq ".\r\n") {