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
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;
|
||||||
|
|
Loading…
Reference in a new issue