cmdmon: convert LOGON timestamp only with LOGON message
Avoid always calling UTI_TimevalNetworkToHost() and make the code more readable.
This commit is contained in:
parent
07f7f28058
commit
09d039fba6
1 changed files with 13 additions and 11 deletions
18
cmdmon.c
18
cmdmon.c
|
@ -1843,20 +1843,22 @@ read_from_cmd_socket(void *anything)
|
|||
}
|
||||
|
||||
valid_ts = 0;
|
||||
issue_token = 0;
|
||||
|
||||
if (auth_ok) {
|
||||
if (utoken_ok && token_ok) {
|
||||
issue_token = 1;
|
||||
} else if (rx_command == REQ_LOGON &&
|
||||
ntohl(rx_message.utoken) == SPECIAL_UTOKEN) {
|
||||
struct timeval ts;
|
||||
|
||||
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))))
|
||||
valid_ts = ts_is_unique_and_not_stale(&ts, &now);
|
||||
|
||||
if (valid_ts) {
|
||||
issue_token = 1;
|
||||
else
|
||||
issue_token = 0;
|
||||
} else {
|
||||
issue_token = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
authenticated = auth_ok & utoken_ok & token_ok;
|
||||
|
|
Loading…
Reference in a new issue