updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / smtpprox / smtpprox-tmpname-and-xforward.patch
blob5d8451cd1b77aaf24f8040621f0536bd8c39902e
1 diff -urN smtpprox-1.2/MSDW/SMTP/Server.pm smtpprox-1.2-fixed/MSDW/SMTP/Server.pm
2 --- smtpprox-1.2/MSDW/SMTP/Server.pm 2003-03-09 13:52:24.000000000 -0500
3 +++ smtpprox-1.2-fixed/MSDW/SMTP/Server.pm 2007-01-18 13:27:44.000000000 -0500
4 @@ -13,6 +13,7 @@
5 package MSDW::SMTP::Server;
6 use IO::Socket;
7 use IO::File;
8 +use File::Temp qw(mkstemp);
10 =head1 NAME
12 @@ -183,13 +184,21 @@
13 return 0 unless defined($_ = $self->getline);
14 s/[\r\n]*$//;
15 $self->{state} = $_;
16 - if (s/^helo\s+//i) {
17 + if (s/^(helo|ehlo)\s+//i) {
18 s/\s*$//;s/\s+/ /g;
19 $self->{helo} = $_;
20 + } elsif (s/^xforward\s*//i) {
21 + my (@attr) = split(/\s+/, $_);
22 + my ($attr);
23 + foreach $attr (@attr) {
24 + my ($name, $value) = ($attr =~ /^(.*?)=(.*)$/);
25 + $self->{xforward}->{lc($name)} = $value;
26 + }
27 } elsif (s/^rset\s*//i) {
28 delete $self->{to};
29 delete $self->{data};
30 delete $self->{recipients};
31 + delete $self->{xforward};
32 } elsif (s/^mail\s+from:\s*//i) {
33 delete $self->{to};
34 delete $self->{data};
35 @@ -208,7 +217,8 @@
36 $self->{data}->seek(0, 0);
37 $self->{data}->truncate(0);
38 } else {
39 - $self->{data} = IO::File->new_tmpfile;
40 + (undef, $self->{datafilename}) = mkstemp("/tmp/smtpproxXXXXXX");
41 + $self->{data} = new IO::File $self->{datafilename}, "r+";
43 while (defined($_ = $self->getline)) {
44 if ($_ eq ".\r\n") {