From: Jelte Jansen Date: Thu, 1 Mar 2012 16:03:53 +0000 (+0100) Subject: [1612] simply return servfail X-Git-Tag: trac2351_base~226^2~116^2~41^2~52^2~2^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d93639f9d862eee755aecbde69e37f40543f7109;p=thirdparty%2Fkea.git [1612] simply return servfail rather than trying to be smart --- diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc index 105146aff8..9b911db3b3 100644 --- a/src/bin/auth/auth_srv.cc +++ b/src/bin/auth/auth_srv.cc @@ -479,12 +479,12 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message, return; } + bool send_answer = true; try { // update per opcode statistics counter. This can only be reliable // after TSIG check succeeds. impl_->counters_.inc(message->getOpcode()); - bool send_answer = true; if (message->getOpcode() == Opcode::NOTIFY()) { send_answer = impl_->processNotify(io_message, message, buffer, tsig_context); @@ -508,22 +508,12 @@ AuthSrv::processMessage(const IOMessage& io_message, MessagePtr message, buffer, tsig_context); } } - - impl_->resumeServer(server, message, send_answer); - } catch (const isc::Unexpected&) { - // If the error was unexpected protocol, don't even bother responding - // (If we see other Unexpected's here, we should probably change to - // a specific exception for unknown protocol) - impl_->resumeServer(server, message, false); } catch (const isc::Exception&) { - // For ISC Exceptions, respond with servfail makeErrorMessage(message, buffer, Rcode::SERVFAIL()); - impl_->resumeServer(server, message, true); } catch (...) { - // Drop the query on any other exceptions (do we want servfail here - // too?) - impl_->resumeServer(server, message, false); + makeErrorMessage(message, buffer, Rcode::SERVFAIL()); } + impl_->resumeServer(server, message, send_answer); } bool diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc index f6115727ed..7aa364f5ae 100644 --- a/src/bin/auth/tests/auth_srv_unittest.cc +++ b/src/bin/auth/tests/auth_srv_unittest.cc @@ -1254,7 +1254,7 @@ TEST_F(AuthSrvTest, queryWithInMemoryClientProxyFindZoneStdException) { setupThrow(&server, CONFIG_INMEMORY_EXAMPLE, throw_at_find_zone, false); - EXPECT_FALSE(dnsserv.hasAnswer()); + processAndCheckSERVFAIL(); } // Throw isc::Exception at getOrigin(), should result in SERVFAIL @@ -1302,7 +1302,7 @@ TEST_F(AuthSrvTest, queryWithInMemoryClientProxyFindStdException) { createDataFromFile("nsec3query_nodnssec_fromWire.wire"); setupThrow(&server, CONFIG_INMEMORY_EXAMPLE, throw_at_find, false); - EXPECT_FALSE(dnsserv.hasAnswer()); + processAndCheckSERVFAIL(); } // Throw isc::Exception in findNSEC3(), should result in SERVFAIL @@ -1324,7 +1324,7 @@ TEST_F(AuthSrvTest, queryWithInMemoryClientProxyFindNSEC3StdException) { createRequestPacket(request_message, IPPROTO_UDP); setupThrow(&server, CONFIG_INMEMORY_EXAMPLE, throw_at_find_nsec3, false); - EXPECT_FALSE(dnsserv.hasAnswer()); + processAndCheckSERVFAIL(); } }