-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqmail-1.03-selfhelo-1.00.patch
83 lines (77 loc) · 2.24 KB
/
qmail-1.03-selfhelo-1.00.patch
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
diff -u ../qmail-1.03/qmail-smtpd.c ./qmail-smtpd.c
--- ../qmail-1.03/qmail-smtpd.c 1998-06-15 06:53:16.000000000 -0400
+++ ./qmail-smtpd.c 2006-06-06 10:27:26.000000000 -0400
@@ -80,15 +80,23 @@
char *remotehost;
char *remoteinfo;
char *local;
+char *localip;
char *relayclient;
stralloc helohost = {0};
char *fakehelo; /* pointer into helohost, or 0 */
-void dohelo(arg) char *arg; {
+int dohelo(arg) char *arg; {
+ int i;
+
if (!stralloc_copys(&helohost,arg)) die_nomem();
if (!stralloc_0(&helohost)) die_nomem();
fakehelo = case_diffs(remotehost,helohost.s) ? helohost.s : 0;
+ if (case_equals(local,helohost.s)) return 1;
+ if (case_equals(localip,helohost.s)) return 1;
+ for (i = 0; i < helohost.len-1; i++)
+ if (helohost.s[i] == '.') return 0;
+ return 1;
}
int liphostok = 0;
@@ -125,7 +133,8 @@
remoteip = env_get("TCPREMOTEIP");
if (!remoteip) remoteip = "unknown";
local = env_get("TCPLOCALHOST");
- if (!local) local = env_get("TCPLOCALIP");
+ localip = env_get("TCPLOCALIP");
+ if (!local) local = localip;
if (!local) local = "unknown";
remotehost = env_get("TCPREMOTEHOST");
if (!remotehost) remotehost = "unknown";
@@ -218,29 +227,32 @@
int seenmail = 0;
-int flagbarf; /* defined if seenmail */
+int flagbarf = 0;
stralloc mailfrom = {0};
stralloc rcptto = {0};
void smtp_helo(arg) char *arg;
{
smtp_greet("250 "); out("\r\n");
- seenmail = 0; dohelo(arg);
+ seenmail = 0;
+ flagbarf |= dohelo(arg);
}
void smtp_ehlo(arg) char *arg;
{
smtp_greet("250-"); out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
- seenmail = 0; dohelo(arg);
+ seenmail = 0;
+ flagbarf |= dohelo(arg);
}
void smtp_rset()
{
seenmail = 0;
+ flagbarf = 0;
out("250 flushed\r\n");
}
void smtp_mail(arg) char *arg;
{
if (!addrparse(arg)) { err_syntax(); return; }
- flagbarf = bmfcheck();
+ flagbarf |= bmfcheck();
seenmail = 1;
if (!stralloc_copys(&rcptto,"")) die_nomem();
if (!stralloc_copys(&mailfrom,addr.s)) die_nomem();
@@ -373,6 +385,7 @@
if (!seenmail) { err_wantmail(); return; }
if (!rcptto.len) { err_wantrcpt(); return; }
seenmail = 0;
+ flagbarf = 0;
if (databytes) bytestooverflow = databytes + 1;
if (qmail_open(&qqt) == -1) { err_qqt(); return; }
qp = qmail_qp(&qqt);