s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
qmail-smtpam.c
Go to the documentation of this file.
1#include <sys/types.h>
2#include <sys/socket.h>
3#include <sys/stat.h>
4#include <netinet/in.h>
5#include <arpa/inet.h>
6#include <unistd.h>
7#include "sig.h"
8#include "genalloc.h"
9#include "stralloc.h"
10#include "buffer.h"
11#include "scan.h"
12#include "case.h"
13#include "byte.h"
14#include "error.h"
15#include "auto_qmail.h"
16#include "control.h"
17#include "dns.h"
18#include "alloc.h"
19#include "quote.h"
20#include "ip.h"
21#include "ipalloc.h"
22#include "ipme.h"
23#include "str.h"
24#include "now.h"
25#include "exit.h"
26#include "constmap.h"
27#include "tcpto.h"
28#include "socket_if.h"
29#include "ucspissl.h"
30#include "timeout.h"
31#include "timeoutconn.h"
32#include "tls_remote.h"
33#include "tls_errors.h"
34#include "tls_timeoutio.h"
35#include "uint_t.h"
36
37#define MAX_SIZE 200000000
38#define HUGESMTPTEXT 5000
39#define PORT_SMTP 25 /* silly rabbit, /etc/services is for users */
40#define PORT_SMTPS 465
41#define VERIFYDEPTH 1
42#define FDPAM 3
43
44#define WHO "qmail-smtpam"
45
49int flagauth = 0; /* 1 = login; 2 = plain; 3 =crammd5 */
50int flagsmtps = 0; /* RFC 8314 - 'implicit TLS' */
51int flagtls = 0; /* -2 = rejected; -1 = not; 0 = no, default;
52 > 0 see tls_remote.c
53 +10 = SMTPS; +20 = QMTPS; 100 = active TLS connection */
54int flagverify = 0; /* 1 = verify Cert against CA ; -1 = Cert pinning */
56
57unsigned long port = PORT_SMTP;
58
59GEN_ALLOC_typedef(saa,stralloc,sa,len,a)
60GEN_ALLOC_readyplus(saa,stralloc,sa,len,a,i,n,x,10,saa_readyplus)
61
62stralloc helohost = {0};
63stralloc host = {0};
64stralloc ports = {0};
65stralloc remotehost = {0};
66stralloc sender = {0};
67stralloc canonhost = {0};
68stralloc canonbox = {0};
69stralloc sendip = {0};
70stralloc recipient = {0};
71
72stralloc domainips = {0};
74char ip4[4];
75char ip6[16];
76uint32 ifidx = 0;
77
78stralloc routes = {0};
80
82
83SSL *ssl;
84SSL_CTX *ctx;
85
86void out(char *s) { if (buffer_puts(buffer_1small,s) == -1) _exit(111); }
87void zero() { if (buffer_put(buffer_1small,"\0",1) == -1) _exit(111); }
88void zerodie() { zero(); buffer_flush(buffer_1small); _exit(111); }
89void outsafe(stralloc *sa)
90{
91 int i;
92 char ch;
93 for (i = 0; i < sa->len; ++i) {
94 ch = sa->s[i];
95 if (ch < 33) ch = '?';
96 if (ch > 126) ch = '?';
97 if (buffer_put(buffer_1small,&ch,1) == -1) _exit(111);
98 }
99}
100
102{
103 out("Zinvalid ipaddr in control/domainips (#4.3.0)\n");
104 zerodie();
105}
107{
108 out("ZOut of memory. (#4.3.0)\n");
109 zerodie();
110}
112{
113 out("ZSystem resources temporarily unavailable. (#4.3.0)\n");
114 zerodie();
115}
117{
118 out("ZCan't bind to local ip address: ");
119 outsafe(&sendip);
120 out(". (#4.3.0)\n");
121 zerodie();
122}
124{
125 out("ZSorry, I wasn't able to establish an SMTP connection. (#4.4.1)\n");
126 zerodie();
127}
129{
130 out("ZCNAME lookup failed temporarily for: ");
132 out(". (#4.4.3)\n");
133 zerodie();
134}
135void temp_dns()
136{
137 out("ZSorry, I couldn't find any host named: ");
138 outsafe(&host);
139 out(". (#4.1.2)\n");
140 zerodie();
141}
143{
144 out("ZUnable to switch to home directory. (#4.3.0)\n");
145 zerodie();
146}
148{
149 out("ZUnable to read control files. (#4.3.0)\n");
150 zerodie();
151}
153{
154 out("Dqmail-smtpam was invoked improperly. (#5.3.5)\n");
155 zerodie();
156}
157void perm_dns()
158{
159 out("DSorry, I couldn't find any host named: ");
160 outsafe(&host);
161 out(". (#5.1.2)\n");
162 zerodie();
163}
165{
166 char ipaddr[IPFMT];
167 int len;
168
169 switch (partner.af) {
170 case AF_INET:
171 len = ip4_fmt(ipaddr,(char *)&partner.addr.ip4.d); break;
172 case AF_INET6:
173 len = ip6_fmt(ipaddr,(char *)&partner.addr.ip6.d); break;
174 }
175 if (buffer_put(buffer_1small,ipaddr,len) == -1) _exit(0);
176}
177
179
180void dropped()
181{
182 out("ZConnected to ");
183 outhost();
184 out(" but connection died. ");
185 if (flagcritical) out("Possible duplicate! ");
186 out("(#4.4.2)\n");
187 zerodie();
188}
189
192int timeout = 1200;
193
194ssize_t saferead(int fd,char *buf,int len)
195{
196 int r;
197 r = timeoutread(timeout,smtpfd,buf,len);
198 if (r <= 0) dropped();
199 return r;
200}
201
202ssize_t safewrite(int fd,char *buf,int len)
203{
204 int r;
205 r = timeoutwrite(timeout,smtpfd,buf,len);
206 if (r <= 0) dropped();
207 return r;
208}
209
210char outbuf[1450];
211buffer bo = BUFFER_INIT(safewrite,-1,outbuf,sizeof(outbuf));
212char frombuf[128];
213buffer bi = BUFFER_INIT(saferead,-1,frombuf,sizeof(frombuf));
214
215stralloc smtptext = {0};
216
217void get(char *ch)
218{
219 buffer_get(&bi,ch,1);
220 if (*ch != '\r')
221 if (smtptext.len < HUGESMTPTEXT)
222 if (!stralloc_append(&smtptext,ch)) temp_nomem();
223}
224
225unsigned long smtpcode()
226{
227 unsigned char ch;
228 unsigned long code;
229
231
232 get(&ch); code = ch - '0';
233 get(&ch); code = code * 10 + (ch - '0');
234 get(&ch); code = code * 10 + (ch - '0');
235 for (;;) {
236 get(&ch);
237 if (ch != '-') break;
238 while (ch != '\n') get(&ch);
239 get(&ch);
240 get(&ch);
241 get(&ch);
242 }
243 while (ch != '\n') get(&ch);
244
245 return code;
246}
247
249{
250 int i;
251 if (smtptext.s) if (smtptext.len) {
252 out("Remote host said: ");
253 for (i = 0; i < smtptext.len; ++i)
254 if (!smtptext.s[i]) smtptext.s[i] = '?';
255 if (buffer_put(buffer_1small,smtptext.s,smtptext.len) == -1) _exit(111);
256 smtptext.len = 0;
257 }
258}
259
260void quit(char *prepend,char *append)
261{
262 buffer_putsflush(&bo,"QUIT\r\n");
263 /* waiting for remote side is just too ridiculous */
264 out(prepend);
265 outhost();
266 out(append);
267 out(".\n");
268 outsmtptext();
269 zerodie();
270}
271
272stralloc recip = {0};
273
274/* this file is too long -------------------------------------- client TLS */
275
276stralloc cafile = {0};
277stralloc cadir = {0};
278stralloc certfile = {0};
279stralloc keyfile = {0};
280stralloc keypwd = {0};
281stralloc ciphers = {0};
282stralloc tlsdest = {0};
283
284char *tlsdestinfo = 0;
286
287stralloc domaincerts = {0};
289stralloc tlsdestinations = {0};
291unsigned long verifydepth = VERIFYDEPTH;
292
294{
295/* Client CTX */
296
297 ctx = ssl_client();
298 ssl_errstr();
299 if (!ctx) temp_tlsctx();
300
301/* Fetch CA infos for dest */
302
303 if (flagverify > 0)
304 if (cafile.len || cadir.len)
305 if (!ssl_ca(ctx,cafile.s,cadir.s,(int) verifydepth)) temp_tlsca();
306
307 if (ciphers.len)
309
310/* Set SSL Context */
311
313 if (!ssl) temp_tlsctx();
314
315/* Setup SSL FDs */
316
318
319/* Go on in none-blocking mode */
320
322 temp_tlserr();
323}
324
326{
327 int i = 0;
328
329 while ( (i += str_chr(smtptext.s + i,'\n') + 1) &&
330 (i < smtptext.len - 8) ) {
331 if (!str_diffn(smtptext.s + i + 4,"STARTTLS",8)) return 1; }
332
333 return 0;
334}
335
337{
338 X509 *cert;
339
340 cert = SSL_get_peer_certificate(ssl);
341 if (!cert) { flagtls = 100; return; }
342
343 if (flagverify < 0) {
344 if (cafile.len) case_lowerb(cafile.s,cafile.len);
345 switch (tls_fingerprint(cert,cafile.s + 1,cafile.len - 1)) {
346 case -1: temp_tlspeercert();
347 case -2: temp_tlsdigest();
348 case -3: temp_invaliddigest();
349 case 1: temp_tlscertfp();
350 }
351 } else {
353 case -1: temp_tlspeercert();
354 case -2: temp_tlspeerverify();
355 case -3: temp_tlspeervalid();
356 case 1: flagtls = 101; break;
357 case 2: flagtls = 102; break;
358 case 3: flagtls = 103; break;
359 }
360 }
361
362 if (flagtls < 100) flagtls = 100;
363
364 X509_free(cert);
365
366 return;
367}
368
369int utf8flag(unsigned char *ch,int len)
370{
371 int i = 0;
372 while (i < len)
373 if (ch[i++] > 127) return 1;
374 return 0;
375}
376
377/* this file is too long -------------------------------------- SMTP connection */
378
379unsigned long code;
380
382{
383 buffer_puts(&bo,"EHLO ");
384 buffer_put(&bo,helohost.s,helohost.len);
385 buffer_puts(&bo,"\r\n");
386 buffer_flush(&bo);
387
388 if (smtpcode() != 250) {
389 buffer_puts(&bo,"HELO ");
390 buffer_put(&bo,helohost.s,helohost.len);
391 buffer_puts(&bo,"\r\n");
392 buffer_flush(&bo);
393 code = smtpcode();
394 if (code >= 500) quit("DConnected to"," but my name was rejected");
395 if (code != 250) quit("ZConnected to"," but my name was rejected");
396 }
397}
398
400{
401 buffer_puts(&bo,"STARTTLS\r\n");
402 buffer_flush(&bo);
403 if (smtpcode() == 220) {
404 tls_init();
407 } else {
408 flagtls = -2;
409 quit("ZConnected to"," but STARTTLS was rejected");
410 }
411}
412
413void smtp()
414{
415
416 if (flagtls > 10 && flagtls < 20) { /* SMTPS */
417 tls_init();
419 }
420
421 code = smtpcode();
422 if (code >= 500) quit("DConnected to "," but sender was rejected");
423 if (code >= 400) quit("ZConnected to "," but sender was probably greylisted");
424
426
427 if (flagutf8mail) buffer_puts(&bo," SMTPUTF8");
428
429 if (flagtls > 0 && flagtls < 10) /* STARTTLS */
430 if (starttls_peer()) {
432 } else if (flagtls > 2) {
433 temp_tlshost();
434 }
435
436 buffer_puts(&bo,"MAIL FROM:<>");
437 if (flagutf8mail)
438 buffer_puts(&bo," SMTPUTF8");
439 buffer_puts(&bo,"\r\n");
440 buffer_flush(&bo);
441 code = smtpcode();
442 if (code >= 500) quit("DConnected to "," but sender was rejected");
443 if (code >= 400) quit("ZConnected to "," but sender was rejected");
444
445 buffer_puts(&bo,"RCPT TO:<");
446 buffer_put(&bo,recipient.s,recipient.len);
447 buffer_puts(&bo,">\r\n");
448 buffer_flush(&bo);
449 code = smtpcode();
450 close(smtpfd);
451 if (code == 250) _exit(0);
452 _exit(1);
453}
454
456{
457 if (control_init() == -1) temp_control();
458 if (control_readint(&timeout,"control/timeoutremote") == -1) temp_control();
459 if (control_readint(&timeoutconnect,"control/timeoutconnect") == -1)
460 temp_control();
461 if (control_rldef(&helohost,"control/helohost",1,(char *) 0) != 1)
462 temp_control();
463 switch (control_readfile(&domainips,"control/domainips",0)) {
464 case -1: temp_control();
465 case 0: if (!constmap_init(&mapdomainips,"",0,1)) temp_nomem(); break;
466 case 1: if (!constmap_init(&mapdomainips,domainips.s,domainips.len,1)) temp_nomem(); break;
467 }
468 switch (control_readfile(&tlsdestinations,"control/tlsdestinations",0)) {
469 case -1: temp_control();
470 case 0: if (!constmap_init(&maptlsdestinations,"",0,1)) temp_nomem(); break;
472 }
473
474}
475
476char up[513];
478
479int main(int argc,char **argv)
480{
481 static ipalloc ip = {0};
482 stralloc netif = {0};
483 int i, j, k;
484 int r; /* reserved for return code */
485 int p; /* reserved for port */
486 char *localip = 0;
487 char *tlsdestinfo = 0;
488
489 sig_pipeignore();
490 if (argc < 2) perm_usage();
491 if (chdir(auto_qmail) == -1) temp_chdir();
492 getcontrols();
493
494 if (!stralloc_copys(&host,argv[1])) temp_nomem();
495
496 if (argv[2]) {
497 if (!stralloc_copys(&ports,argv[2])) temp_nomem();
498 if (*ports.s == 's') { ports.s++; flagsmtps = 1; }
499 scan_ulong(ports.s,&port);
500 }
501
502 if (ipme_init() != 1) temp_oserr();
503
504/* this file is too long -------------------------------------- set domain ip + helohost */
505
506 if (!localip)
507 localip = constmap(&mapdomainips,"*",1); /* one for all */
508
509 if (localip) {
510 j = str_chr(localip,'%');
511 if (localip[j] != '%') j = 0;
512 k = str_chr(localip,'|');
513 if (localip[k] != '|') k = 0;
514 if (k) { /* helohost */
515 if (!stralloc_copys(&helohost,localip + k + 1)) temp_nomem();
516 localip[k] = 0;
517 }
518 if (j) { /* if index */
519 localip[j] = 0;
520 if (!stralloc_copys(&netif,localip + j + 1)) temp_nomem();
521 if (!stralloc_0(&netif)) temp_nomem();
522 }
523 }
524
525
526/* this file is too long -------------------------------------- TLS destinations */
527
528 flagtls = tls_destination((const stralloc) host); // un-terminated
529
530 if (flagtls > 0) {
531 if (tlsdestinfo) {
532 i = str_chr(tlsdestinfo,'|'); /* ca file or cert fingerprint */
533 if (tlsdestinfo[i] == '|') {
534 tlsdestinfo[i] = 0;
535 j = str_chr(tlsdestinfo+i+1,'|'); /* cipher */
536 if (tlsdestinfo[i + j + 1] == '|') {
537 tlsdestinfo[i + j + 1] = 0;
538 k = str_chr(tlsdestinfo + i + j + 2,'|'); /* cone domain */
539 if (tlsdestinfo[i + j + k + 2] == '|') {
540 tlsdestinfo[i + j + k + 2] = 0;
541 if (str_diffn(tlsdestinfo + j + k + 3,canonhost.s,canonhost.len)) flagtls = 0;
542 }
543 p = str_chr(tlsdestinfo + i + j + 2,';'); /* verifydepth;port */
544 if (tlsdestinfo[i + j + p + 2] == ';') {
545 if (tlsdestinfo[i + j + p + 3] == 's') { flagsmtps = 1; p++; }
546 tlsdestinfo[i + j + p + 2] = 0;
547 if (p > 0) scan_ulong(tlsdestinfo+i+j + 2,&verifydepth);
548 scan_ulong(tlsdestinfo+i+j + p + 3,&port);
549 }
550 }
552 }
554 }
555
556/* cafile starts with '=' => it is a fingerprint
557 cafile ends with '/' => consider it as cadir */
558
559 if (cafile.len) {
560 flagverify = 1;
561 if (cafile.s[cafile.len] == '/') {
562 cafile.len = 0;
563 flagverify = 2;
565 if (!stralloc_0(&cadir)) temp_nomem();
566 } else {
567 if (cafile.s[0] == '%') flagverify = -1;
568 if (!stralloc_0(&cafile)) temp_nomem();
569 }
570 } else {
571 cafile.len = cadir.len = ciphers.len = p = 0;
572 }
573
574 if (port == PORT_SMTPS || flagsmtps) flagtls = flagtls + 10;
575 }
576
577/* this file is too long -------------------------------------- Setup connection */
578
579 uplen = 0;
580 for (;;) {
581 do
582 r = read(FDPAM,up + uplen,sizeof(up) - uplen);
583 while ((r == -1) && (errno == EINTR));
584 if (r == -1) _exit(111);
585 if (r == 0) break;
586 uplen += r;
587 if (uplen >= sizeof(up)) _exit(111);
588 }
589 close(FDPAM);
590
591 if (!stralloc_copyb(&recipient,up,uplen)) temp_nomem();
592 if (!stralloc_0(&recipient)) temp_nomem();
593 if (!stralloc_0(&host)) temp_nomem();
595
597
598 switch (dns_ip(&ip,&remotehost)) {
599 case DNS_MEM: temp_nomem();
600 case DNS_ERR: temp_dns();
601 case DNS_COM: temp_dnscanon();
602 default: if (ip.len <= 0) perm_dns();
603 }
604
605 smtpfd = socket(ip.ix[i].af,SOCK_STREAM,0);
606 if (smtpfd == -1) temp_oserr();
607
608 if (localip) { /* set domain ip */
609 if (!stralloc_copyb(&sendip,localip,str_len(localip))) temp_nomem();
610 j = str_chr(localip,':');
611 if (j && localip[j] == ':') { /* IPv6 */
612 if (!ip6_scan(localip,ip6)) temp_noip();
613 ifidx = socket_getifidx(netif.s);
614 if (socket_bind6(smtpfd,ip6,0,ifidx) < 0) temp_osip();
615 } else { /* IPv4 */
616 if (!ip4_scan(localip,ip4)) temp_noip();
617 if (socket_bind4(smtpfd,ip4,0) < 0) temp_osip();
618 }
619 }
620
621 r = timeoutconn(smtpfd,&ip.ix[i].addr,(unsigned int) port,timeoutconnect,ifidx);
622 if (r == 0) {
623 tcpto_err(&ip.ix[i],0);
624 partner = ip.ix[i];
625 smtp(); /* does not return */
626 }
627 tcpto_err(&ip.ix[i],errno == ETIMEDOUT);
628 close(smtpfd);
629
630 temp_noconn();
631}
char auto_qmail[]
int main()
Definition: chkshsgr.c:6
int constmap_init(struct constmap *cm, char *s, int len, int flagcolon)
Definition: constmap.c:35
int control_readint(int *i, char *fn)
Definition: control.c:71
int control_rldef(stralloc *sa, char *fn, int flagme, char *def)
Definition: control.c:41
int control_readfile(stralloc *sa, char *fn, int flagme)
Definition: control.c:86
int control_init(void)
Definition: control.c:32
int stralloc_copys(stralloc *, char const *)
int dns_ip(ipalloc *ia, stralloc *sa)
Definition: dns.c:194
stralloc out
Definition: dnscname.c:12
stralloc sa
Definition: dnscname.c:11
void _exit()
char buf[100+FMT_ULONG]
Definition: hier.c:10
void p(char *, char *, int, int, int)
Definition: install.c:39
int ipme_init()
Definition: ipme.c:61
char ipaddr[IPFMT]
Definition: ipmeprint.c:11
GEN_ALLOC_readyplus(prioq, struct prioq_elt, p, len, a, i, n, x, 100, prioq_readyplus)
Definition: prioq.c:5
int fd
stralloc helohost
Definition: qmail-remote.c:75
int j
Definition: qmail-send.c:920
stralloc canonhost
Definition: qmail-smtpam.c:67
unsigned long code
Definition: qmail-smtpam.c:379
char outbuf[1450]
Definition: qmail-smtpam.c:210
void outhost()
Definition: qmail-smtpam.c:164
void zero()
Definition: qmail-smtpam.c:87
stralloc recip
Definition: qmail-smtpam.c:272
int flagcritical
Definition: qmail-smtpam.c:178
ssize_t saferead(int fd, char *buf, int len)
Definition: qmail-smtpam.c:194
stralloc smtptext
Definition: qmail-smtpam.c:215
int flagutf8mail
Definition: qmail-smtpam.c:55
void temp_noip()
Definition: qmail-smtpam.c:101
void temp_dns()
Definition: qmail-smtpam.c:135
stralloc remotehost
Definition: qmail-smtpam.c:65
void temp_chdir()
Definition: qmail-smtpam.c:142
int flagverify
Definition: qmail-smtpam.c:54
stralloc certfile
Definition: qmail-smtpam.c:278
struct constmap maproutes
Definition: qmail-smtpam.c:79
void perm_usage()
Definition: qmail-smtpam.c:152
void smtp_greeting()
Definition: qmail-smtpam.c:381
void getcontrols()
Definition: qmail-smtpam.c:455
stralloc routes
Definition: qmail-smtpam.c:78
uint32 ifidx
Definition: qmail-smtpam.c:76
int timeout
Definition: qmail-smtpam.c:192
char up[513]
Definition: qmail-smtpam.c:476
void temp_control()
Definition: qmail-smtpam.c:147
unsigned long port
Definition: qmail-smtpam.c:57
stralloc host
Definition: qmail-smtpam.c:63
void dropped()
Definition: qmail-smtpam.c:180
int flagsmtps
Definition: qmail-smtpam.c:50
stralloc sender
Definition: qmail-smtpam.c:66
struct constmap mapdomainips
Definition: qmail-smtpam.c:73
char * tlsdomaininfo
Definition: qmail-smtpam.c:285
void temp_dnscanon()
Definition: qmail-smtpam.c:128
stralloc domainips
Definition: qmail-smtpam.c:72
struct ip_mx partner
Definition: qmail-smtpam.c:81
char ip6[16]
Definition: qmail-smtpam.c:75
void perm_dns()
Definition: qmail-smtpam.c:157
char frombuf[128]
Definition: qmail-smtpam.c:212
void temp_noconn()
Definition: qmail-smtpam.c:123
GEN_ALLOC_typedef(GEN_ALLOC_readyplus(saa, GEN_ALLOC_readyplus(stralloc, GEN_ALLOC_readyplus(sa, GEN_ALLOC_readyplus(len, GEN_ALLOC_readyplus(a)
Definition: qmail-smtpam.c:59
void temp_oserr()
Definition: qmail-smtpam.c:111
stralloc recipient
Definition: qmail-smtpam.c:70
#define FDPAM
Definition: qmail-smtpam.c:42
#define PORT_SMTP
Definition: qmail-smtpam.c:39
int uplen
Definition: qmail-smtpam.c:477
struct constmap maptlsdestinations
Definition: qmail-smtpam.c:290
stralloc sendip
Definition: qmail-smtpam.c:69
void quit(char *prepend, char *append)
Definition: qmail-smtpam.c:260
stralloc ports
Definition: qmail-smtpam.c:64
unsigned long verifydepth
Definition: qmail-smtpam.c:291
void smtp()
Definition: qmail-smtpam.c:413
void outsafe(stralloc *sa)
Definition: qmail-smtpam.c:89
stralloc keyfile
Definition: qmail-smtpam.c:279
void outsmtptext()
Definition: qmail-smtpam.c:248
struct constmap mapdomaincerts
Definition: qmail-smtpam.c:288
void get(char *ch)
Definition: qmail-smtpam.c:217
stralloc cadir
Definition: qmail-smtpam.c:277
int smtpfd
Definition: qmail-smtpam.c:191
#define HUGESMTPTEXT
Definition: qmail-smtpam.c:38
int flagauth
Definition: qmail-smtpam.c:49
stralloc keypwd
Definition: qmail-smtpam.c:280
void temp_nomem()
Definition: qmail-smtpam.c:106
char * tlsdestinfo
Definition: qmail-smtpam.c:284
stralloc ciphers
Definition: qmail-smtpam.c:281
void temp_osip()
Definition: qmail-smtpam.c:116
buffer bi
Definition: qmail-smtpam.c:213
char ip4[4]
Definition: qmail-smtpam.c:74
#define VERIFYDEPTH
Definition: qmail-smtpam.c:41
void tls_peercheck()
Definition: qmail-smtpam.c:336
stralloc tlsdest
Definition: qmail-smtpam.c:282
stralloc cafile
Definition: qmail-smtpam.c:276
buffer bo
Definition: qmail-smtpam.c:211
SSL_CTX * ctx
Definition: qmail-smtpam.c:84
int starttls_peer()
Definition: qmail-smtpam.c:325
void tls_init()
Definition: qmail-smtpam.c:293
int utf8flag(unsigned char *ch, int len)
Definition: qmail-smtpam.c:369
void zerodie()
Definition: qmail-smtpam.c:88
#define PORT_SMTPS
Definition: qmail-smtpam.c:40
unsigned long smtpcode()
Definition: qmail-smtpam.c:225
SSL * ssl
Definition: qmail-smtpam.c:83
void smtp_starttls()
Definition: qmail-smtpam.c:399
stralloc tlsdestinations
Definition: qmail-smtpam.c:289
stralloc canonbox
Definition: qmail-smtpam.c:68
stralloc domaincerts
Definition: qmail-smtpam.c:287
int flagtls
Definition: qmail-smtpam.c:51
int timeoutconnect
Definition: qmail-smtpam.c:190
ssize_t safewrite()
uint32_t k[64]
Definition: sha256.c:26
Definition: ipalloc.h:8
struct ip6_address ip6
Definition: ipalloc.h:12
struct ip4_address ip4
Definition: ipalloc.h:11
union ip_mx::@0 addr
unsigned short af
Definition: ipalloc.h:9
void tcpto_err()
void temp_tlspeercert()
Definition: tls_errors.c:93
void temp_tlsctx(void)
Definition: tls_errors.c:56
void temp_tlshost(void)
Definition: tls_errors.c:82
void temp_tlscipher(void)
Definition: tls_errors.c:46
void temp_tlspeervalid()
Definition: tls_errors.c:109
void temp_tlsdigest(void)
Definition: tls_errors.c:151
void temp_tlsca(void)
Definition: tls_errors.c:36
void temp_tlspeerverify()
Definition: tls_errors.c:101
void temp_tlscon()
Definition: tls_errors.c:64
void temp_tlserr(void)
Definition: tls_errors.c:73
void temp_tlscertfp(void)
Definition: tls_errors.c:117
void temp_invaliddigest(void)
Definition: tls_errors.c:127
int tls_conn(SSL *, int)
Definition: tls_remote.c:49
int tls_destination(const stralloc)
tls_destination
Definition: tls_remote.c:280
int tls_fingerprint(X509 *, const char *, const int)
Definition: tls_remote.c:235
int tls_checkpeer(SSL *, X509 *, const stralloc, const int, const int)
Definition: tls_remote.c:56
int tls_timeoutconn(int t, int rfd, int wfd, SSL *tls)
Definition: tls_timeoutio.c:59
#define ssl_client()
Definition: ucspitls.h:16
int ssl_ciphers(SSL_CTX *, const char *)
#define ssl_errstr()
Definition: ucspitls.h:36
SSL * ssl_new(SSL_CTX *, int)
int ssl_ca(SSL_CTX *, const char *, const char *, int)