diff --git a/ntp_auth.c b/ntp_auth.c index 56f05fc..43f4483 100644 --- a/ntp_auth.c +++ b/ntp_auth.c @@ -401,11 +401,6 @@ NAU_GenerateResponseAuth(NTP_Packet *request, NTP_PacketInfo *request_info, int NAU_CheckResponseAuth(NAU_Instance instance, NTP_Packet *response, NTP_PacketInfo *info) { - /* If we don't expect the packet to be authenticated, ignore any - authentication data in the packet */ - if (instance->mode == NTP_AUTH_NONE) - return 1; - /* The authentication must match the expected mode */ if (info->auth.mode != instance->mode) return 0; diff --git a/test/unit/ntp_core.c b/test/unit/ntp_core.c index 7a70245..d3965cd 100644 --- a/test/unit/ntp_core.c +++ b/test/unit/ntp_core.c @@ -356,9 +356,9 @@ test_unit(void) inst1->tx_count < MAX_CLIENT_INTERLEAVED_TX); authenticated = random() % 2; valid = (!interleaved || (source.params.interleaved && has_updated)) && - (!source.params.authkey || authenticated); + ((source.params.authkey == INACTIVE_AUTHKEY) == !authenticated); updated = (valid || inst1->mode == MODE_ACTIVE) && - (!source.params.authkey || authenticated); + ((source.params.authkey == INACTIVE_AUTHKEY) == !authenticated); has_updated = has_updated || updated; if (inst1->mode == MODE_CLIENT) updated = 0;