diff options
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/auth/auth_srv.cc | 26 | ||||
-rwxr-xr-x | src/bin/ddns/ddns.py.in | 5 | ||||
-rwxr-xr-x | src/bin/ddns/tests/ddns_test.py | 5 | ||||
-rw-r--r-- | src/bin/xfrin/tests/xfrin_test.py | 5 | ||||
-rwxr-xr-x | src/bin/xfrout/xfrout.py.in | 7 |
5 files changed, 12 insertions, 36 deletions
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc index 37fdf5286e..63ed888361 100644 --- a/src/bin/auth/auth_srv.cc +++ b/src/bin/auth/auth_srv.cc @@ -442,12 +442,9 @@ makeErrorMessage(MessageRenderer& renderer, Message& message, message.setRcode(rcode); RendererHolder holder(renderer, &buffer, stats_attrs); - if (tsig_context.get() != NULL) { - message.toWire(renderer, *tsig_context); - stats_attrs.setResponseTSIG(true); - } else { - message.toWire(renderer); - } + message.toWire(renderer, tsig_context.get()); + stats_attrs.setResponseTSIG(tsig_context.get() != NULL); + LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_ERROR_RESPONSE) .arg(renderer.getLength()).arg(message); } @@ -674,12 +671,9 @@ AuthSrvImpl::processNormalQuery(const IOMessage& io_message, const bool udp_buffer = (io_message.getSocket().getProtocol() == IPPROTO_UDP); renderer_.setLengthLimit(udp_buffer ? remote_bufsize : 65535); - if (tsig_context.get() != NULL) { - message.toWire(renderer_, *tsig_context); - stats_attrs.setResponseTSIG(true); - } else { - message.toWire(renderer_); - } + message.toWire(renderer_, tsig_context.get()); + stats_attrs.setResponseTSIG(tsig_context.get() != NULL); + LOG_DEBUG(auth_logger, DBG_AUTH_MESSAGES, AUTH_SEND_NORMAL_RESPONSE) .arg(renderer_.getLength()).arg(message); return (true); @@ -836,12 +830,8 @@ AuthSrvImpl::processNotify(const IOMessage& io_message, Message& message, message.setRcode(Rcode::NOERROR()); RendererHolder holder(renderer_, &buffer, stats_attrs); - if (tsig_context.get() != NULL) { - message.toWire(renderer_, *tsig_context); - stats_attrs.setResponseTSIG(true); - } else { - message.toWire(renderer_); - } + message.toWire(renderer_, tsig_context.get()); + stats_attrs.setResponseTSIG(tsig_context.get() != NULL); return (true); } diff --git a/src/bin/ddns/ddns.py.in b/src/bin/ddns/ddns.py.in index 6bb81c5b6c..f87a21f352 100755 --- a/src/bin/ddns/ddns.py.in +++ b/src/bin/ddns/ddns.py.in @@ -495,10 +495,7 @@ class DDNSServer: return False msg = update_session.get_message() self.__response_renderer.clear() - if tsig_ctx is not None: - msg.to_wire(self.__response_renderer, tsig_ctx) - else: - msg.to_wire(self.__response_renderer) + msg.to_wire(self.__response_renderer, tsig_ctx) ret = self.__send_response(sock, self.__response_renderer.get_data(), remote_addr) diff --git a/src/bin/ddns/tests/ddns_test.py b/src/bin/ddns/tests/ddns_test.py index 66e87a4e4c..c5db61aa71 100755 --- a/src/bin/ddns/tests/ddns_test.py +++ b/src/bin/ddns/tests/ddns_test.py @@ -900,10 +900,7 @@ def create_msg(opcode=Opcode.UPDATE, zones=[TEST_ZONE_RECORD], prereq=[], msg.add_rrset(SECTION_PREREQUISITE, p) renderer = MessageRenderer() - if tsigctx is not None: - msg.to_wire(renderer, tsigctx) - else: - msg.to_wire(renderer) + msg.to_wire(renderer, tsigctx) # re-read the created data in the parse mode msg.clear(Message.PARSE) diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py index 4158638456..1405cd83a4 100644 --- a/src/bin/xfrin/tests/xfrin_test.py +++ b/src/bin/xfrin/tests/xfrin_test.py @@ -373,10 +373,7 @@ class MockXfrinConnection(XfrinConnection): [resp.add_rrset(Message.SECTION_AUTHORITY, a) for a in authorities] renderer = MessageRenderer() - if tsig_ctx is not None: - resp.to_wire(renderer, tsig_ctx) - else: - resp.to_wire(renderer) + resp.to_wire(renderer, tsig_ctx) reply_data = struct.pack('H', socket.htons(renderer.get_length())) reply_data += renderer.get_data() diff --git a/src/bin/xfrout/xfrout.py.in b/src/bin/xfrout/xfrout.py.in index a776690dca..0fe8e1511b 100755 --- a/src/bin/xfrout/xfrout.py.in +++ b/src/bin/xfrout/xfrout.py.in @@ -345,12 +345,7 @@ class XfroutSession(): render.set_compress_mode(MessageRenderer.CASE_SENSITIVE) render.set_length_limit(XFROUT_MAX_MESSAGE_SIZE) - # XXX Currently, python wrapper doesn't accept 'None' parameter in this case, - # we should remove the if statement and use a universal interface later. - if tsig_ctx is not None: - msg.to_wire(render, tsig_ctx) - else: - msg.to_wire(render) + msg.to_wire(render, tsig_ctx) header_len = struct.pack('H', socket.htons(render.get_length())) self._send_data(sock_fd, header_len) |