mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
ntp: don't accept packets with unexpected authentication
If authentication is not enabled in configuration, responses are not expected to be authenticated. Handle such responses as having failed authentication. A case where this could happen is a misconfigured symmetric association where only one peer has specified the other with a key. Before this change synchronization would work in one direction and used packets with an asymmetric length.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user