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
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
12 +with user and password being optional for smarthosts that require authentication.
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
20 struct constmap maproutes;
22 stralloc sender = {0};
23 +stralloc auth_smtp_user = {0};
24 +stralloc auth_smtp_pass = {0};
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");
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);
86 + substdio_puts(&smtpto,"MAIL FROM:<");
87 + substdio_put(&smtpto,sender.s,sender.len);
88 + substdio_puts(&smtpto,">\r\n");
89 + substdio_flush(&smtpto);
93 if (code >= 500) quit("D Connected to "," but sender was rejected");
94 if (code >= 400) quit("Z Connected to "," but sender was rejected");
98 static ipalloc ip = {0};
101 unsigned long random;
103 unsigned long prefme;
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();
112 for (i = 0;i <= host.len;++i)
114 if (!stralloc_copys(&protocol,"smtp")) temp_nomem(); /* smtp is the default */
117 + i = str_chr(relayhost,' ');
118 + if (relayhost[i]) {
119 + j = str_chr(relayhost + i + 1,' ');
120 + if (relayhost[j]) {
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,':');
130 Subdirectorios comunes: qmail-1.03-orig/qmail-rhinit y qmail-1.03/qmail-rhinit