From 0877da986ffab36b3ba6908a6ab0ad09689b9788 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 11 Dec 2015 11:10:43 +0100 Subject: [PATCH] Fix dnsdist console client sending empty lines There is no point for the console client to send empty lines to the server. Just in case, fix the server to not abort the connection when receiving such empty lines. Reported by @gryphius as a follow-up on #3015. --- pdns/dnsdist-console.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 41d17b246..48151caa7 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -60,6 +60,10 @@ void doClient(ComboAddress server, const std::string& command) if(line=="quit") break; + /* no need to send an empty line to the server */ + if(line.empty()) + continue; + string response; string msg=sodEncryptSym(line, g_key, ours); putMsgLen32(fd, msg.length()); @@ -207,6 +211,14 @@ try uint32_t len; if(!getMsgLen32(fd, &len)) break; + + if (len == 0) { + /* just ACK an empty message + with an empty response */ + putMsgLen32(fd, 0); + continue; + } + boost::scoped_array msg(new char[len]); readn2(fd, msg.get(), len); -- 2.40.0