diff options
author | David Bremner <david@tethera.net> | 2017-07-11 21:53:38 -0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2017-07-11 21:53:38 -0300 |
commit | 1547050d23739476ebd1c88d824c72432f06d4dd (patch) | |
tree | d024f931f3b1df6def4a9fb524c7eb58aeb6ab24 /src | |
parent | 80037a141acb9c495c506db73219440ea971814c (diff) |
Import Upstream version 1.13
Diffstat (limited to 'src')
-rw-r--r-- | src/inject.cc | 5 | ||||
-rw-r--r-- | src/queue.cc | 1 | ||||
-rw-r--r-- | src/send.cc | 30 | ||||
-rw-r--r-- | src/smtpd.cc | 3 |
4 files changed, 31 insertions, 8 deletions
diff --git a/src/inject.cc b/src/inject.cc index 0176780..6bd5c80 100644 --- a/src/inject.cc +++ b/src/inject.cc @@ -345,8 +345,11 @@ bool is_continuation(const mystring& line) bool read_header() { + mystring cur_line; mystring whole; - while(fin.getline(cur_line)) { + for (;;) { + if (!fin.getline(cur_line)) + cur_line = ""; if(!cur_line || cur_line == "\r") break; if(!!whole && is_continuation(cur_line)) { diff --git a/src/queue.cc b/src/queue.cc index 44ad59b..8db9c22 100644 --- a/src/queue.cc +++ b/src/queue.cc @@ -183,6 +183,7 @@ int main(int, char*[]) { umask(077); if(config_read("adminaddr", adminaddr) && !!adminaddr) { + adminaddr = adminaddr.subst(',', '\n'); remapadmin = true; read_hostnames(); } diff --git a/src/send.cc b/src/send.cc index 535b3d4..1b854fc 100644 --- a/src/send.cc +++ b/src/send.cc @@ -101,7 +101,9 @@ unsigned ws_split(const mystring& str, slist& lst) } static rlist remotes; -static int pausetime = 60; +static int minpause = 60; +static int pausetime = minpause; +static int maxpause = 24*60*60; static int sendtimeout = 60*60; bool load_remotes() @@ -133,12 +135,18 @@ bool load_config() if(!load_remotes()) result = false; - - if(!config_readint("pausetime", pausetime)) - pausetime = 60; + + int oldminpause = minpause; + if(!config_readint("pausetime", minpause)) + minpause = 60; + if(!config_readint("maxpause", maxpause)) + maxpause = 24*60*60; if(!config_readint("sendtimeout", sendtimeout)) sendtimeout = 60*60; + if (minpause != oldminpause) + pausetime = minpause; + return result; } @@ -309,14 +317,22 @@ bool do_select() FD_ZERO(&readfds); FD_SET(trigger, &readfds); struct timeval timeout; + + if (files.count() == 0) + pausetime = maxpause; timeout.tv_sec = pausetime; timeout.tv_usec = 0; - int s = select(trigger+1, &readfds, 0, 0, - (files.count() == 0) ? 0 : &timeout); + + pausetime *= 2; + if (pausetime > maxpause) + pausetime = maxpause; + + int s = select(trigger+1, &readfds, 0, 0, &timeout); if(s == 1) { fout << "Trigger pulled." << endl; read_trigger(); reload_files = true; + pausetime = minpause; } else if(s == -1 && errno != EINTR) fail_sys("Internal error in select: "); @@ -350,7 +366,7 @@ int main(int, char*[]) load_files(); for(;;) { send_all(); - if (pausetime == 0) break; + if (minpause == 0) break; do_select(); } return 0; diff --git a/src/smtpd.cc b/src/smtpd.cc index a594f0b..7e39775 100644 --- a/src/smtpd.cc +++ b/src/smtpd.cc @@ -183,6 +183,8 @@ static bool DATA(mystring& param) while (readline()) { if (line.length() == 1 && line[0] == '.') break; + if (line.length() > 1 && line[0] == '.') + line = line.sub(1, line.length() - 1); line += '\n'; if (!qwrite(qfd, line.c_str(), line.length())) return respond(resp_qwrite_err); @@ -212,6 +214,7 @@ static bool MAIL(mystring& param) { if (!param) return respond(resp_need_param); + do_reset(); sender = parse_addr_arg(param); return respond(!sender ? resp_mail_bad : resp_mail_ok); } |