updated on Tue Jan 17 00:10:10 UTC 2012
[aur-mirror.git] / qmail / qmail-remote-auth.patch
blobde19073495e532d805addd6730da9479f55f3b82
1 diff -u --new-file qmail-1.03-orig/qmail-remote.8 qmail-1.03/qmail-remote.8
2 --- qmail-1.03-orig/qmail-remote.8 2006-03-21 17:44:54.000000000 -0300
3 +++ qmail-1.03/qmail-remote.8 2006-03-21 17:47:14.000000000 -0300
4 @@ -218,8 +218,9 @@
5 .I smtproutes
6 Artificial SMTP routes.
7 Each route has the form
8 -.IR domain\fB:\fIrelay ,
9 -without any extra spaces.
10 +.IR domain\fB:\fIrelay
11 +.I user password,
12 +with user and password being optional for smarthosts that require authentication.
14 .I domain
15 matches
16 diff -u --new-file qmail-1.03-orig/qmail-remote.c qmail-1.03/qmail-remote.c
17 --- qmail-1.03-orig/qmail-remote.c 2006-03-21 17:44:54.000000000 -0300
18 +++ qmail-1.03/qmail-remote.c 2006-03-21 17:52:32.000000000 -0300
19 @@ -47,6 +47,8 @@
20 struct constmap maproutes;
21 stralloc host = {0};
22 stralloc sender = {0};
23 +stralloc auth_smtp_user = {0};
24 +stralloc auth_smtp_pass = {0};
26 saa reciplist = {0};
28 @@ -227,19 +229,58 @@
29 unsigned long code;
30 int flagbother;
31 int i;
32 + stralloc slop = {0};
34 if (smtpcode() != 220) quit("Z Connected to "," but greeting failed");
36 - substdio_puts(&smtpto,"HELO ");
38 + substdio_puts(&smtpto,"EHLO ");
39 substdio_put(&smtpto,helohost.s,helohost.len);
40 substdio_puts(&smtpto,"\r\n");
41 substdio_flush(&smtpto);
42 - if (smtpcode() != 250) quit("Z Connected to "," but my name was rejected");
44 - substdio_puts(&smtpto,"MAIL FROM:<");
45 - substdio_put(&smtpto,sender.s,sender.len);
46 - substdio_puts(&smtpto,">\r\n");
47 - substdio_flush(&smtpto);
50 + if (smtpcode() != 250) {
51 + substdio_puts(&smtpto,"HELO ");
52 + substdio_put(&smtpto,helohost.s,helohost.len);
53 + substdio_puts(&smtpto,"\r\n");
54 + substdio_flush(&smtpto);
55 + if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
56 + }
57 + i = 0;
58 + while((i += str_chr(smtptext.s+i,'\n') + 1) && (i+14 < smtptext.len) &&
59 + str_diffn(smtptext.s+i+4,"AUTH LOGIN\n",11) &&
60 + str_diffn(smtptext.s+i+4,"AUTH LOGIN ",11) &&
61 + str_diffn(smtptext.s+i+4,"AUTH PLAIN LOGIN\n",17) &&
62 + str_diffn(smtptext.s+i+4,"AUTH PLAIN LOGIN ",17) &&
63 + str_diffn(smtptext.s+i+4,"AUTH=LOGIN\n",11) &&
64 + str_diffn(smtptext.s+i+4,"AUTH=LOGIN ",11));
65 + if ((i+14 < smtptext.len) && auth_smtp_user.len && auth_smtp_pass.len) {
66 + substdio_puts(&smtpto,"AUTH LOGIN\r\n");
67 + substdio_flush(&smtpto);
68 + if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (AUTH LOGIN)");
69 + if (b64encode(&auth_smtp_user,&slop) < 0) temp_nomem();
70 + substdio_put(&smtpto,slop.s,slop.len);
71 + substdio_puts(&smtpto,"\r\n");
72 + substdio_flush(&smtpto);
73 + if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (username)");
74 + if (b64encode(&auth_smtp_pass,&slop) < 0) temp_nomem();
75 + substdio_put(&smtpto,slop.s,slop.len);
76 + substdio_puts(&smtpto,"\r\n");
77 + substdio_flush(&smtpto);
78 + if (smtpcode() != 235) quit("ZConnected to "," but authentication was rejected (password)");
79 + substdio_puts(&smtpto,"MAIL FROM:<");
80 + substdio_put(&smtpto,sender.s,sender.len);
81 + substdio_puts(&smtpto,"> AUTH=<");
82 + substdio_put(&smtpto,sender.s,sender.len);
83 + substdio_puts(&smtpto,">\r\n");
84 + substdio_flush(&smtpto);
85 + } else {
86 + substdio_puts(&smtpto,"MAIL FROM:<");
87 + substdio_put(&smtpto,sender.s,sender.len);
88 + substdio_puts(&smtpto,">\r\n");
89 + substdio_flush(&smtpto);
90 + }
92 code = smtpcode();
93 if (code >= 500) quit("D Connected to "," but sender was rejected");
94 if (code >= 400) quit("Z Connected to "," but sender was rejected");
95 @@ -457,7 +498,7 @@
96 char **argv;
98 static ipalloc ip = {0};
99 - int i;
100 + int i,j;
101 unsigned long random;
102 char **recips;
103 unsigned long prefme;
104 @@ -472,6 +513,8 @@
107 if (!stralloc_copys(&host,argv[1])) temp_nomem();
108 + if (!stralloc_copys(&auth_smtp_user,"")) temp_nomem();
109 + if (!stralloc_copys(&auth_smtp_pass,"")) temp_nomem();
111 relayhost = 0;
112 for (i = 0;i <= host.len;++i)
113 @@ -483,6 +526,16 @@
114 if (!stralloc_copys(&protocol,"smtp")) temp_nomem(); /* smtp is the default */
116 if (relayhost) {
117 + i = str_chr(relayhost,' ');
118 + if (relayhost[i]) {
119 + j = str_chr(relayhost + i + 1,' ');
120 + if (relayhost[j]) {
121 + relayhost[i] = 0;
122 + relayhost[i + j + 1] = 0;
123 + if (!stralloc_copys(&auth_smtp_user,relayhost + i + 1)) temp_nomem();
124 + if (!stralloc_copys(&auth_smtp_pass,relayhost + i + j + 2)) temp_nomem();
127 i = str_chr(relayhost,':');
128 if (relayhost[i]) {
130 Subdirectorios comunes: qmail-1.03-orig/qmail-rhinit y qmail-1.03/qmail-rhinit