Lines 43-48
Link Here
|
43 |
struct constmap maproutes; |
43 |
struct constmap maproutes; |
44 |
stralloc host = {0}; |
44 |
stralloc host = {0}; |
45 |
stralloc sender = {0}; |
45 |
stralloc sender = {0}; |
|
|
46 |
stralloc auth_smtp_user = {0}; |
47 |
stralloc auth_smtp_pass = {0}; |
46 |
|
48 |
|
47 |
saa reciplist = {0}; |
49 |
saa reciplist = {0}; |
48 |
|
50 |
|
Lines 523-528
Link Here
|
523 |
unsigned long code; |
525 |
unsigned long code; |
524 |
int flagbother; |
526 |
int flagbother; |
525 |
int i; |
527 |
int i; |
|
|
528 |
stralloc slop = {0}; |
526 |
|
529 |
|
527 |
#ifndef PORT_SMTP |
530 |
#ifndef PORT_SMTP |
528 |
/* the qmtpc patch uses smtp_port and undefines PORT_SMTP */ |
531 |
/* the qmtpc patch uses smtp_port and undefines PORT_SMTP */ |
Lines 570-580
Link Here
|
570 |
#ifdef EHLO |
573 |
#ifdef EHLO |
571 |
} |
574 |
} |
572 |
#endif |
575 |
#endif |
573 |
|
576 |
|
574 |
substdio_puts(&smtpto,"MAIL FROM:<"); |
577 |
i = 0; |
575 |
substdio_put(&smtpto,sender.s,sender.len); |
578 |
/* |
576 |
substdio_puts(&smtpto,">\r\n"); |
579 |
while((i += str_chr(smtptext.s+i,'\n') + 1) && (i+14 < smtptext.len) && |
577 |
substdio_flush(&smtpto); |
580 |
str_diffn(smtptext.s+i+4,"AUTH LOGIN\n",11) && |
|
|
581 |
str_diffn(smtptext.s+i+4,"AUTH LOGIN ",11) && |
582 |
str_diffn(smtptext.s+i+4,"AUTH PLAIN LOGIN\n",17) && |
583 |
str_diffn(smtptext.s+i+4,"AUTH PLAIN LOGIN ",17) && |
584 |
str_diffn(smtptext.s+i+4,"AUTH=LOGIN\n",11) && |
585 |
str_diffn(smtptext.s+i+4,"AUTH=LOGIN ",11)); */ |
586 |
if (/*(i+14 < smtptext.len) && */auth_smtp_user.len && auth_smtp_pass.len) { |
587 |
substdio_puts(&smtpto,"AUTH LOGIN\r\n"); |
588 |
substdio_flush(&smtpto); |
589 |
if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (AUTH LOGIN)"); |
590 |
if (b64encode(&auth_smtp_user,&slop) < 0) temp_nomem(); |
591 |
substdio_put(&smtpto,slop.s,slop.len); |
592 |
substdio_puts(&smtpto,"\r\n"); |
593 |
substdio_flush(&smtpto); |
594 |
if (smtpcode() != 334) quit("ZConnected to "," but authentication was rejected (username)"); |
595 |
if (b64encode(&auth_smtp_pass,&slop) < 0) temp_nomem(); |
596 |
substdio_put(&smtpto,slop.s,slop.len); |
597 |
substdio_puts(&smtpto,"\r\n"); |
598 |
substdio_flush(&smtpto); |
599 |
if (smtpcode() != 235) quit("ZConnected to "," but authentication was rejected (password)"); |
600 |
substdio_puts(&smtpto,"MAIL FROM:<"); |
601 |
substdio_put(&smtpto,sender.s,sender.len); |
602 |
substdio_puts(&smtpto,"> AUTH=<"); |
603 |
substdio_put(&smtpto,auth_smtp_user.s,auth_smtp_user.len); |
604 |
substdio_puts(&smtpto,">\r\n"); |
605 |
substdio_flush(&smtpto); |
606 |
} else { |
607 |
substdio_puts(&smtpto,"MAIL FROM:<"); |
608 |
substdio_put(&smtpto,sender.s,sender.len); |
609 |
substdio_puts(&smtpto,">\r\n"); |
610 |
substdio_flush(&smtpto); |
611 |
} |
578 |
code = smtpcode(); |
612 |
code = smtpcode(); |
579 |
if (code >= 500) quit("DConnected to "," but sender was rejected"); |
613 |
if (code >= 500) quit("DConnected to "," but sender was rejected"); |
580 |
if (code >= 400) quit("ZConnected to "," but sender was rejected"); |
614 |
if (code >= 400) quit("ZConnected to "," but sender was rejected"); |
Lines 672-678
Link Here
|
672 |
char **argv; |
706 |
char **argv; |
673 |
{ |
707 |
{ |
674 |
static ipalloc ip = {0}; |
708 |
static ipalloc ip = {0}; |
675 |
int i; |
709 |
int i,j; |
676 |
unsigned long random; |
710 |
unsigned long random; |
677 |
char **recips; |
711 |
char **recips; |
678 |
unsigned long prefme; |
712 |
unsigned long prefme; |
Lines 687-692
Link Here
|
687 |
|
721 |
|
688 |
|
722 |
|
689 |
if (!stralloc_copys(&host,argv[1])) temp_nomem(); |
723 |
if (!stralloc_copys(&host,argv[1])) temp_nomem(); |
|
|
724 |
if (!stralloc_copys(&auth_smtp_user,"")) temp_nomem(); |
725 |
if (!stralloc_copys(&auth_smtp_pass,"")) temp_nomem(); |
690 |
|
726 |
|
691 |
relayhost = 0; |
727 |
relayhost = 0; |
692 |
for (i = 0;i <= host.len;++i) |
728 |
for (i = 0;i <= host.len;++i) |
Lines 696-701
Link Here
|
696 |
if (relayhost && !*relayhost) relayhost = 0; |
732 |
if (relayhost && !*relayhost) relayhost = 0; |
697 |
|
733 |
|
698 |
if (relayhost) { |
734 |
if (relayhost) { |
|
|
735 |
i = str_chr(relayhost,' '); |
736 |
if (relayhost[i]) { |
737 |
j = str_chr(relayhost + i + 1,' '); |
738 |
if (relayhost[j]) { |
739 |
relayhost[i] = 0; |
740 |
relayhost[i + j + 1] = 0; |
741 |
if (!stralloc_copys(&auth_smtp_user,relayhost + i + 1)) temp_nomem(); |
742 |
if (!stralloc_copys(&auth_smtp_pass,relayhost + i + j + 2)) temp_nomem(); |
743 |
} |
744 |
} |
699 |
i = str_chr(relayhost,':'); |
745 |
i = str_chr(relayhost,':'); |
700 |
if (relayhost[i]) { |
746 |
if (relayhost[i]) { |
701 |
scan_ulong(relayhost + i + 1,&port); |
747 |
scan_ulong(relayhost + i + 1,&port); |