sudo_interposer_init: verify message type from sudo

We should only get a HelloResponse from sudo at this point.
This commit is contained in:
Todd C. Miller
2021-09-15 11:20:45 -06:00
parent db750232c5
commit 51d5f05e67

View File

@@ -247,9 +247,15 @@ sudo_interposer_init(void)
res = recv_intercept_response(fd);
if (res != NULL) {
if (res->type_case == INTERCEPT_RESPONSE__TYPE_HELLO_RESP) {
intercept_token.u64[0] = res->u.hello_resp->token_lo;
intercept_token.u64[1] = res->u.hello_resp->token_hi;
intercept_port = res->u.hello_resp->portno;
} else {
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
"unexpected type_case value %d in %s from %s",
res->type_case, "InterceptResponse", "sudo");
}
intercept_response__free_unpacked(res, NULL);
}