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