mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
cmdmon: convert LOGON timestamp only with LOGON message
Avoid always calling UTI_TimevalNetworkToHost() and make the code more readable.
This commit is contained in:
24
cmdmon.c
24
cmdmon.c
@@ -1843,20 +1843,22 @@ read_from_cmd_socket(void *anything)
|
|||||||
}
|
}
|
||||||
|
|
||||||
valid_ts = 0;
|
valid_ts = 0;
|
||||||
|
issue_token = 0;
|
||||||
|
|
||||||
if (auth_ok) {
|
if (auth_ok) {
|
||||||
struct timeval ts;
|
if (utoken_ok && token_ok) {
|
||||||
|
|
||||||
UTI_TimevalNetworkToHost(&rx_message.data.logon.ts, &ts);
|
|
||||||
if ((utoken_ok && token_ok) ||
|
|
||||||
((ntohl(rx_message.utoken) == SPECIAL_UTOKEN) &&
|
|
||||||
(rx_command == REQ_LOGON) &&
|
|
||||||
(valid_ts = ts_is_unique_and_not_stale(&ts, &now))))
|
|
||||||
issue_token = 1;
|
issue_token = 1;
|
||||||
else
|
} else if (rx_command == REQ_LOGON &&
|
||||||
issue_token = 0;
|
ntohl(rx_message.utoken) == SPECIAL_UTOKEN) {
|
||||||
} else {
|
struct timeval ts;
|
||||||
issue_token = 0;
|
|
||||||
|
UTI_TimevalNetworkToHost(&rx_message.data.logon.ts, &ts);
|
||||||
|
valid_ts = ts_is_unique_and_not_stale(&ts, &now);
|
||||||
|
|
||||||
|
if (valid_ts) {
|
||||||
|
issue_token = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticated = auth_ok & utoken_ok & token_ok;
|
authenticated = auth_ok & utoken_ok & token_ok;
|
||||||
|
|||||||
Reference in New Issue
Block a user