1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
*** adcomplain.pl.old Tue Mar 3 03:20:37 1998
--- adcomplain.pl Tue Mar 3 03:23:52 1998
***************
*** 1,3 ****
--- 1,4 ----
+ #!/usr/bin/perl
#! /bin/sh -- # -*- perl -*-
# first line invokes sh. Some systems may need to refer to perl directly, i.e.:
***************
*** 7,14 ****
# allows perl to be _anywhere_ in the user's path. The intent is to reduce
# the need to edit this file.
! eval 'exec perl $0 ${1+"$@"}'
! if 0; # tee hee! This is on a separate line, so /bin/sh never sees it.
#-----------------------------------------------
# DESCRIPTION
--- 8,15 ----
# allows perl to be _anywhere_ in the user's path. The intent is to reduce
# the need to edit this file.
! #eval 'exec perl $0 ${1+"$@"}'
! #if 0; # tee hee! This is on a separate line, so /bin/sh never sees it.
#-----------------------------------------------
# DESCRIPTION
***************
*** 633,648 ****
&moref($tempname);
}
- if ($batchmode) {
- $ok = &send_to_list($from, $send_to, $tempname);
- unlink $tempname;
- exit 1 if !$ok;
- }
- else {
## send, abort, edit, or list the message
for (;;) {
! print "\n";
! $ans = &get_answer("Send, abort, edit, or list (s/a/e/l)?", "a");
if ($ans =~ /s.*/ || $ans =~ /y.*/) {
# re-extract the addressee from the body
open(F, "<$tempname") || die "temp file $tempname has disappeared!";
--- 634,647 ----
&moref($tempname);
}
## send, abort, edit, or list the message
for (;;) {
! if ($batchmode) {
! $ans = "s";
! } else {
! print "\n";
! $ans = &get_answer("Send, abort, edit, or list (s/a/e/l)?", "a");
! }
if ($ans =~ /s.*/ || $ans =~ /y.*/) {
# re-extract the addressee from the body
open(F, "<$tempname") || die "temp file $tempname has disappeared!";
***************
*** 659,669 ****
--- 658,676 ----
}
}
if ($send_to eq "") {
+ if ($batchmode) {
+ print "no addressee!\n";
+ last;
+ }
print "no addressee! re-edit and continue\n";
next;
}
$ok = &send_to_list($from, $send_to, $tempname);
+ if ($batchmode && !$ok) {
+ print "can't send to $send_to!\n";
+ last;
+ }
next if !$ok;
print "sent to $send_to\n";
***************
*** 687,693 ****
print "what?\n";
}
} # for
- }
print "\n";
unlink $tempname;
--- 694,699 ----
***************
*** 726,731 ****
--- 732,738 ----
local($local_inetaddr, $remote_inetaddr);
local($targetPort) = "smtp"; # or 25, world-wide standard
local($response);
+ local($local_prot) = (getprotobyname('tcp'))[2];
if (defined($mailscript) && $mailscript ne "") {
$name = "$mailscript $body ";
***************
*** 764,774 ****
}
}
! $local_inetaddr = pack($sockaddr, $AF_INET, 0, $thisaddr);
! $remote_inetaddr = pack($sockaddr, $AF_INET, $targetPort, $thataddr);
#MAKE the socket filehandle.
! if ( ! socket( S, $AF_INET, $SOCK_STREAM, 0)) {
print STDERR "socket() failure: $!\n";
return 0;
}
--- 771,781 ----
}
}
! $local_inetaddr = pack($sockaddr, &AF_INET, 0, $thisaddr);
! $remote_inetaddr = pack($sockaddr, &AF_INET, $targetPort, $thataddr);
#MAKE the socket filehandle.
! if ( ! socket( S, &PF_INET, &SOCK_STREAM, $local_prot)) {
print STDERR "socket() failure: $!\n";
return 0;
}
***************
*** 1490,1496 ****
local ($name, $aliases, $addrtype, $length, @addrs);
local ($addr_int);
local ($a, $b, $c, $d);
- local ($AF_INET) = 2; # not portable, but pretty common
$name = $ips_to_hosts{$text};
return $name if defined($name) && $name ne "";
--- 1497,1502 ----
***************
*** 1506,1512 ****
$addr_int = pack("C4", $a, $b, $c, $d);
($name, $aliases, $addrtype, $length, @addrs) =
! gethostbyaddr($addr_int, $AF_INET);
if (defined($name) && $name ne "") {
&log_mapping($name, $text, "gethostbyaddr");
return $name;
--- 1512,1518 ----
$addr_int = pack("C4", $a, $b, $c, $d);
($name, $aliases, $addrtype, $length, @addrs) =
! gethostbyaddr($addr_int, &AF_INET);
if (defined($name) && $name ne "") {
&log_mapping($name, $text, "gethostbyaddr");
return $name;
***************
*** 2317,2323 ****
# Windows 95, as opposed to Windows NT which would pass previous test
$os_kind = "win32";
}
! elsif (-x "/bin/uname") {
# $^O would work with perl5, but then I would have to distinguish
# between AIX, HP-UX, Solaris, SunOS, Linux, SINIX, SVr4, etc.
$os_kind = "unix";
--- 2323,2329 ----
# Windows 95, as opposed to Windows NT which would pass previous test
$os_kind = "win32";
}
! elsif (-x "/bin/uname" || -x "/usr/bin/uname") {
# $^O would work with perl5, but then I would have to distinguish
# between AIX, HP-UX, Solaris, SunOS, Linux, SINIX, SVr4, etc.
$os_kind = "unix";
***************
*** 2333,2339 ****
# years ago by someone who _really_ didn't know what he was doing.
# All of the host-specific libraries are really a mess, and disentangling
# it for our different architectures is not practical.
! $junk = `/bin/uname -rs`;
if ($junk =~ /^SunOS 5.*/) { # Solaris
$AF_INET = 2;
$SOCK_STREAM = 2; # they just _had_ to be different.
--- 2339,2345 ----
# years ago by someone who _really_ didn't know what he was doing.
# All of the host-specific libraries are really a mess, and disentangling
# it for our different architectures is not practical.
! $junk = -x "/bin/uname" ? `/bin/uname -rs` : `/usr/bin/uname -rs`;
if ($junk =~ /^SunOS 5.*/) { # Solaris
$AF_INET = 2;
$SOCK_STREAM = 2; # they just _had_ to be different.
***************
*** 2411,2422 ****
$local_hostname = $name if defined($name) && $name ne "";
if (!defined($mailhost) || $mailhost eq "") {
! local($name, $aliases, $type, $len, $addr) = gethostbyname("mailhost");
! $addr = $addr; # shut up perl5 -w
! if (defined($name) && $name ne "") {
! $mailhost = $name;
! }
! elsif ($os_kind eq "unix") {
$mailhost = $local_hostname;
# $mailhost = "localhost";
}
--- 2417,2423 ----
$local_hostname = $name if defined($name) && $name ne "";
if (!defined($mailhost) || $mailhost eq "") {
! if ($os_kind eq "unix") {
$mailhost = $local_hostname;
# $mailhost = "localhost";
}
|