]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1612] simply return servfail
authorJelte Jansen <jelte@isc.org>
Thu, 1 Mar 2012 16:03:53 +0000 (17:03 +0100)
committerJelte Jansen <jelte@isc.org>
Thu, 1 Mar 2012 16:03:53 +0000 (17:03 +0100)
rather than trying to be smart

src/bin/auth/auth_srv.cc
src/bin/auth/tests/auth_srv_unittest.cc

index 105146aff8fecd2453bc60c287d9afb3ac795b3c..9b911db3b34a6c2ac9c1e31db0768d63e2389a99 100644 (file)
@@ -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
index f6115727ed1c73600565e9f3cc7f2dca0f06645a..7aa364f5ae2633944c64b1bc8c190645ac1b4be7 100644 (file)
@@ -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();
 }
 
 }