Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 611142
Collapse All | Expand All

(-)file_not_specified_in_diff (-10 / +120 lines)
Line  Link Here
0
-- /dev/null
0
++ netqmail-1.06/Makefile
Lines 1446-1452 substdio.a error.a str.a fs.a auto_qmail.o dns.lib socket.lib Link Here
1446
	timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
1446
	timeoutwrite.o timeoutconn.o tcpto.o now.o dns.o ip.o \
1447
	ipalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
1447
	ipalloc.o ipme.o quote.o ndelay.a case.a sig.a open.a \
1448
	lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
1448
	lock.a seek.a getln.a stralloc.a alloc.a substdio.a error.a \
1449
	str.a fs.a auto_qmail.o  `cat dns.lib` `cat socket.lib`
1449
	str.a fs.a auto_qmail.o  `cat dns.lib` `cat socket.lib` -lidn2
1450
1450
1451
qmail-remote.0: \
1451
qmail-remote.0: \
1452
qmail-remote.8
1452
qmail-remote.8
1453
-- /dev/null
1453
++ netqmail-1.06/qmail-remote.c
Lines 2-7 Link Here
2
#include <sys/socket.h>
2
#include <sys/socket.h>
3
#include <netinet/in.h>
3
#include <netinet/in.h>
4
#include <arpa/inet.h>
4
#include <arpa/inet.h>
5
#include <idn2.h>
5
#include "sig.h"
6
#include "sig.h"
6
#include "stralloc.h"
7
#include "stralloc.h"
7
#include "substdio.h"
8
#include "substdio.h"
Lines 42-47 Link Here
42
stralloc routes = {0};
43
stralloc routes = {0};
43
struct constmap maproutes;
44
struct constmap maproutes;
44
stralloc host = {0};
45
stralloc host = {0};
46
stralloc asciihost = {0};
45
stralloc sender = {0};
47
stralloc sender = {0};
46
48
47
saa reciplist = {0};
49
saa reciplist = {0};
Lines 53-64 Link Here
53
# include "tls.h"
55
# include "tls.h"
54
# include "ssl_timeoutio.h"
56
# include "ssl_timeoutio.h"
55
# include <openssl/x509v3.h>
57
# include <openssl/x509v3.h>
56
# define EHLO 1
57
58
58
int tls_init();
59
int tls_init();
59
const char *ssl_err_str = 0;
60
const char *ssl_err_str = 0;
60
#endif 
61
#endif 
61
62
63
# define EHLO 1
64
62
void out(s) char *s; { if (substdio_puts(subfdoutsmall,s) == -1) _exit(0); }
65
void out(s) char *s; { if (substdio_puts(subfdoutsmall,s) == -1) _exit(0); }
63
void zero() { if (substdio_put(subfdoutsmall,"\0",1) == -1) _exit(0); }
66
void zero() { if (substdio_put(subfdoutsmall,"\0",1) == -1) _exit(0); }
64
void zerodie() { zero(); substdio_flush(subfdoutsmall); _exit(0); }
67
void zerodie() { zero(); substdio_flush(subfdoutsmall); _exit(0); }
Lines 156-161 Link Here
156
substdio smtpfrom = SUBSTDIO_FDBUF(saferead,-1,smtpfrombuf,sizeof smtpfrombuf);
159
substdio smtpfrom = SUBSTDIO_FDBUF(saferead,-1,smtpfrombuf,sizeof smtpfrombuf);
157
160
158
stralloc smtptext = {0};
161
stralloc smtptext = {0};
162
stralloc firstpart = {0};
159
163
160
void get(ch)
164
void get(ch)
161
char *ch;
165
char *ch;
Lines 308-313 Link Here
308
  int r;
312
  int r;
309
  char ch;
313
  char ch;
310
314
315
  substdio_put(&smtpto,firstpart.s,firstpart.len);
316
311
  for (;;) {
317
  for (;;) {
312
    r = substdio_get(&ssin,&ch,1);
318
    r = substdio_get(&ssin,&ch,1);
313
    if (r == 0) break;
319
    if (r == 0) break;
Lines 518-523 Link Here
518
524
519
stralloc recip = {0};
525
stralloc recip = {0};
520
526
527
int containsutf8(p, l) unsigned char * p; int l;
528
{
529
  int i = 0;
530
  while (i<l)
531
    if(p[i++] > 127) return 1;
532
  return 0;
533
}
534
535
int utf8message;
536
537
void checkutf8message()
538
{
539
  int pos;
540
  int i;
541
  int r;
542
  char ch;
543
  int state;
544
545
  if (containsutf8(sender.s, sender.len)) { utf8message = 1; return; }
546
  for (i = 0;i < reciplist.len;++i)
547
    if (containsutf8(reciplist.sa[i].s, reciplist.sa[i].len)) {
548
      utf8message = 1;
549
      return;
550
    }
551
552
  state = 0;
553
  pos = 0;
554
  for (;;) {
555
    r = substdio_get(&ssin,&ch,1);
556
    if (r == 0) break;
557
    if (r == -1) temp_read();
558
559
    if (ch == '\n' && !stralloc_cats(&firstpart,"\r")) temp_nomem();
560
    if (!stralloc_append(&firstpart,&ch)) temp_nomem();
561
562
    if (ch == '\r')
563
      continue;
564
    if (ch == '\t')
565
      ch = ' ';
566
567
    switch (state) {
568
    case 6: /* in Received, at LF but before WITH clause */
569
      if (ch == ' ') { state = 3; pos = 1; continue; }
570
      state = 0;
571
      /* FALL THROUGH */
572
573
    case 0: /* start of header field */
574
      if (ch == '\n') return;
575
      state = 1;
576
      pos = 0;
577
      /* FALL THROUGH */
578
579
    case 1: /* partway through "Received:" */
580
      if (ch != "RECEIVED:"[pos] && ch != "received:"[pos]) { state = 2; continue; }
581
      if (++pos == 9) { state = 3; pos = 0; }
582
      continue;
583
584
    case 2: /* other header field */
585
      if (ch == '\n') state = 0;
586
      continue;
587
588
    case 3: /* in Received, before WITH clause or partway though " with " */
589
      if (ch == '\n') { state = 6; continue; }
590
      if (ch != " WITH "[pos] && ch != " with "[pos]) { pos = 0; continue; }
591
      if (++pos == 6) { state = 4; pos = 0; }
592
      continue;
593
594
    case 4: /* in Received, having seen with, before the argument */
595
      if (pos == 0 && (ch == ' ' || ch == '\t')) continue;
596
      if (ch != "UTF8"[pos] && ch != "utf8"[pos]) { state = 5; continue; }
597
      if(++pos == 4) { utf8message = 1; state = 5; continue; }
598
      continue;
599
600
    case 5: /* after the RECEIVED WITH argument */
601
      /* blast() assumes that it copies whole lines */
602
      if (ch == '\n') return;
603
      state = 1;
604
      pos = 0;
605
      continue;
606
    }
607
  }
608
}
609
521
void smtp()
610
void smtp()
522
{
611
{
523
  unsigned long code;
612
  unsigned long code;
Lines 571-579 Link Here
571
  }
660
  }
572
#endif
661
#endif
573
 
662
 
663
  checkutf8message();
574
  substdio_puts(&smtpto,"MAIL FROM:<");
664
  substdio_puts(&smtpto,"MAIL FROM:<");
575
  substdio_put(&smtpto,sender.s,sender.len);
665
  substdio_put(&smtpto,sender.s,sender.len);
576
  substdio_puts(&smtpto,">\r\n");
666
  substdio_puts(&smtpto,">");
667
  if (utf8message) substdio_puts(&smtpto," SMTPUTF8");
668
  substdio_puts(&smtpto,"\r\n");
577
  substdio_flush(&smtpto);
669
  substdio_flush(&smtpto);
578
  code = smtpcode();
670
  code = smtpcode();
579
  if (code >= 500) quit("DConnected to "," but sender was rejected");
671
  if (code >= 500) quit("DConnected to "," but sender was rejected");
Lines 702-710 Link Here
702
      relayhost[i] = 0;
794
      relayhost[i] = 0;
703
    }
795
    }
704
    if (!stralloc_copys(&host,relayhost)) temp_nomem();
796
    if (!stralloc_copys(&host,relayhost)) temp_nomem();
797
  } else {
798
    char * ascii = 0;
799
    host.s[host.len] = '\0';
800
    switch (idn2_lookup_u8(host.s, (uint8_t**)&ascii, IDN2_NFC_INPUT)) {
801
      case IDN2_OK: break;
802
      case IDN2_MALLOC: temp_nomem();
803
      default: perm_dns();
804
    }
805
    if (!stralloc_copys(&asciihost, ascii)) temp_nomem();
705
  }
806
  }
706
807
707
708
  addrmangle(&sender,argv[2],&flagalias,0);
808
  addrmangle(&sender,argv[2],&flagalias,0);
709
 
809
 
710
  if (!saa_readyplus(&reciplist,0)) temp_nomem();
810
  if (!saa_readyplus(&reciplist,0)) temp_nomem();
Lines 723-729 Link Here
723
823
724
 
824
 
725
  random = now() + (getpid() << 16);
825
  random = now() + (getpid() << 16);
726
  switch (relayhost ? dns_ip(&ip,&host) : dns_mxip(&ip,&host,random)) {
826
  switch (relayhost ? dns_ip(&ip,&host) : dns_mxip(&ip,&asciihost,random)) {
727
    case DNS_MEM: temp_nomem();
827
    case DNS_MEM: temp_nomem();
728
    case DNS_SOFT: temp_dns();
828
    case DNS_SOFT: temp_dns();
729
    case DNS_HARD: perm_dns();
829
    case DNS_HARD: perm_dns();
730
-- /dev/null
830
++ netqmail-1.06/qmail-smtpd.c
Lines 273-278 Link Here
273
stralloc rcptto = {0};
273
stralloc rcptto = {0};
274
stralloc fuser = {0};
274
stralloc fuser = {0};
275
stralloc mfparms = {0};
275
stralloc mfparms = {0};
276
int smtputf8 = 0;
276
277
277
int mailfrom_size(arg) char *arg;
278
int mailfrom_size(arg) char *arg;
278
{
279
{
Lines 323-328 Link Here
323
      while (len) {
324
      while (len) {
324
        arg++; len--; 
325
        arg++; len--; 
325
        if (*arg == ' ' || *arg == '\0' ) {
326
        if (*arg == ' ' || *arg == '\0' ) {
327
           if (case_starts(mfparms.s,"SMTPUTF8")) smtputf8 = 1;
326
           if (case_starts(mfparms.s,"SIZE=")) if (mailfrom_size(mfparms.s+5)) { flagsize = 1; return; }
328
           if (case_starts(mfparms.s,"SIZE=")) if (mailfrom_size(mfparms.s+5)) { flagsize = 1; return; }
327
           if (case_starts(mfparms.s,"AUTH=")) mailfrom_auth(mfparms.s+5,mfparms.len-5);  
329
           if (case_starts(mfparms.s,"AUTH=")) mailfrom_auth(mfparms.s+5,mfparms.len-5);  
328
           if (!stralloc_copys(&mfparms,"")) die_nomem;
330
           if (!stralloc_copys(&mfparms,"")) die_nomem;
Lines 351-357 Link Here
351
    out("\r\n250-STARTTLS");
353
    out("\r\n250-STARTTLS");
352
#endif
354
#endif
353
  size[fmt_ulong(size,(unsigned int) databytes)] = 0;
355
  size[fmt_ulong(size,(unsigned int) databytes)] = 0;
354
  out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n");
356
  out("\r\n250-PIPELINING\r\n250-SMTPUTF8\r\n250-8BITMIME\r\n");
355
  out("250-SIZE "); out(size); out("\r\n");
357
  out("250-SIZE "); out(size); out("\r\n");
356
#ifdef CRAM_MD5
358
#ifdef CRAM_MD5
357
  out("250 AUTH LOGIN PLAIN CRAM-MD5\r\n");
359
  out("250 AUTH LOGIN PLAIN CRAM-MD5\r\n");
Lines 516-522 Link Here
516
  if (qmail_open(&qqt) == -1) { err_qqt(); return; }
518
  if (qmail_open(&qqt) == -1) { err_qqt(); return; }
517
  qp = qmail_qp(&qqt);
519
  qp = qmail_qp(&qqt);
518
  out("354 go ahead\r\n");
520
  out("354 go ahead\r\n");
519
 
521
522
  if (smtputf8) {
523
    stralloc utf8proto = {0};
524
    if ('E' == *protocol) protocol++;
525
    if (!stralloc_copys(&utf8proto, "UTF8")) die_nomem();
526
    if (!stralloc_cats(&utf8proto, protocol)) die_nomem();
527
    utf8proto.s[utf8proto.len] = '\0';
528
    protocol = utf8proto.s;
529
  }
520
  received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo);
530
  received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo);
521
  blast(&hops);
531
  blast(&hops);
522
  hops = (hops >= MAXHOPS);
532
  hops = (hops >= MAXHOPS);

Return to bug 611142