summaryrefslogtreecommitdiffstats
path: root/qmail-rspawn.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2015-06-30 14:00:01 +0200
committermanuel <manuel@mausz.at>2015-06-30 14:00:01 +0200
commitc76a0244565136c708d945f3ef1d4e14c7d3e1f8 (patch)
tree71a3eb18853a137e7074144b17c17300219990d5 /qmail-rspawn.c
parent999de3146c7bec7ca9e2c55f1f4143b527ba98c4 (diff)
downloadqmail-c76a0244565136c708d945f3ef1d4e14c7d3e1f8.tar.gz
qmail-c76a0244565136c708d945f3ef1d4e14c7d3e1f8.tar.bz2
qmail-c76a0244565136c708d945f3ef1d4e14c7d3e1f8.zip
opportunistic TLS
When the TLS handshake fails, retry delivery with TLS disabled
Diffstat (limited to 'qmail-rspawn.c')
-rw-r--r--qmail-rspawn.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/qmail-rspawn.c b/qmail-rspawn.c
index 9d838e6..40e5d52 100644
--- a/qmail-rspawn.c
+++ b/qmail-rspawn.c
@@ -25,6 +25,7 @@ int len;
25 int k; 25 int k;
26 int result; 26 int result;
27 int orr; 27 int orr;
28 int l;
28 29
29 if (wait_crashed(wstat)) 30 if (wait_crashed(wstat))
30 { substdio_puts(ss,"Zqmail-remote crashed.\n"); return; } 31 { substdio_puts(ss,"Zqmail-remote crashed.\n"); return; }
@@ -48,8 +49,16 @@ int len;
48 j = k + 1; 49 j = k + 1;
49 } 50 }
50 51
52 j = 0;
53 for (k = 0;k < len;++k)
54 if (!s[k])
55 {
56 if (s[j] != 'l') break;
57 j = k + 1;
58 }
59
51 orr = result; 60 orr = result;
52 switch(s[0]) 61 switch(s[j])
53 { 62 {
54 case 's': orr = 0; break; 63 case 's': orr = 0; break;
55 case 'h': orr = -1; 64 case 'h': orr = -1;
@@ -62,10 +71,17 @@ int len;
62 case -1: substdio_put(ss,"D",1); break; 71 case -1: substdio_put(ss,"D",1); break;
63 } 72 }
64 73
65 for (k = 1;k < len;) 74 for (k = l = 1;k < j;++k)
75 if (!s[k])
76 {
77 substdio_puts(ss,s + l);
78 l = k + 2;
79 }
80
81 for (k = j+1;k < len;)
66 if (!s[k++]) 82 if (!s[k++])
67 { 83 {
68 substdio_puts(ss,s + 1); 84 substdio_puts(ss,s + j + 1);
69 if (result <= orr) 85 if (result <= orr)
70 if (k < len) 86 if (k < len)
71 switch(s[k]) 87 switch(s[k])