summaryrefslogtreecommitdiffstats
path: root/qmail-smtpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmail-smtpd.c')
-rw-r--r--qmail-smtpd.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
index 35630ac..db0e16b 100644
--- a/qmail-smtpd.c
+++ b/qmail-smtpd.c
@@ -29,6 +29,10 @@
29#include "cdb.h" 29#include "cdb.h"
30#include "qmail-spp.h" 30#include "qmail-spp.h"
31#include "dns.h" 31#include "dns.h"
32#include "base64.h"
33#include "open.h"
34#include "fd.h"
35#include "fork.h"
32 36
33int spp_val; 37int spp_val;
34 38
@@ -511,6 +515,7 @@ stralloc mailfrom = {0};
511stralloc rcptto = {0}; 515stralloc rcptto = {0};
512stralloc fuser = {0}; 516stralloc fuser = {0};
513stralloc mfparms = {0}; 517stralloc mfparms = {0};
518int smtputf8 = 0;
514int recipcount; 519int recipcount;
515 520
516int mailfrom_size(arg) char *arg; 521int mailfrom_size(arg) char *arg;
@@ -562,6 +567,9 @@ void mailfrom_parms(arg) char *arg;
562 while (len) { 567 while (len) {
563 arg++; len--; 568 arg++; len--;
564 if (*arg == ' ' || *arg == '\0' ) { 569 if (*arg == ' ' || *arg == '\0' ) {
570#ifdef SMTPUTF8
571 if (case_starts(mfparms.s,"SMTPUTF8")) smtputf8 = 1;
572#endif
565 if (case_starts(mfparms.s,"SIZE=")) if (mailfrom_size(mfparms.s+5)) { flagsize = 1; return; } 573 if (case_starts(mfparms.s,"SIZE=")) if (mailfrom_size(mfparms.s+5)) { flagsize = 1; return; }
566 if (case_starts(mfparms.s,"AUTH=")) mailfrom_auth(mfparms.s+5,mfparms.len-5); 574 if (case_starts(mfparms.s,"AUTH=")) mailfrom_auth(mfparms.s+5,mfparms.len-5);
567 if (!stralloc_copys(&mfparms,"")) die_nomem; 575 if (!stralloc_copys(&mfparms,"")) die_nomem;
@@ -596,7 +604,11 @@ void smtp_ehlo(arg) char *arg;
596 if (!ssl && (stat(servercert, &st) == 0)) 604 if (!ssl && (stat(servercert, &st) == 0))
597 out("\r\n250-STARTTLS"); 605 out("\r\n250-STARTTLS");
598#endif 606#endif
607#ifdef SMTPUTF8
608 out("\r\n250-PIPELINING\r\n250-SMTPUTF8\r\n250-8BITMIME\r\n");
609#else
599 out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n"); 610 out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n");
611#endif
600#if defined(TLS) 612#if defined(TLS)
601 if(!tls_before_auth || (tls_before_auth && ssl)) smtp_authout(); 613 if(!tls_before_auth || (tls_before_auth && ssl)) smtp_authout();
602#else 614#else
@@ -827,7 +839,16 @@ void smtp_data(arg) char *arg; {
827 if (qmail_open(&qqt) == -1) { err_qqt(); return; } 839 if (qmail_open(&qqt) == -1) { err_qqt(); return; }
828 qp = qmail_qp(&qqt); 840 qp = qmail_qp(&qqt);
829 out("354 go ahead\r\n"); 841 out("354 go ahead\r\n");
830 842
843 if (smtputf8) {
844 stralloc utf8proto = {0};
845 if (*protocol == 'E') ++protocol;
846 if (!stralloc_copys(&utf8proto, "UTF8")) die_nomem();
847 if (!stralloc_cats(&utf8proto, protocol)) die_nomem();
848 if (!stralloc_0(&utf8proto)) die_nomem();
849 protocol = utf8proto.s;
850 }
851
831 received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo); 852 received(&qqt,protocol,local,remoteip,remotehost,remoteinfo,fakehelo);
832 qmail_put(&qqt,sppheaders.s,sppheaders.len); /* set in qmail-spp.c */ 853 qmail_put(&qqt,sppheaders.s,sppheaders.len); /* set in qmail-spp.c */
833 spp_rset(); 854 spp_rset();