mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 11:15:07 -05:00
privops: allow binding to acquisition port
Fix the privileged helper process to allow binding of client sockets to a non-zero acquisition port which is not equal to the server port.
This commit is contained in:
@@ -268,7 +268,7 @@ do_bind_socket(ReqBindSocket *req, PrvResponse *res)
|
|||||||
sock_fd = req->sock;
|
sock_fd = req->sock;
|
||||||
|
|
||||||
UTI_SockaddrToIPAndPort(sa, &ip, &port);
|
UTI_SockaddrToIPAndPort(sa, &ip, &port);
|
||||||
if (port && port != CNF_GetNTPPort()) {
|
if (port && port != CNF_GetNTPPort() && port != CNF_GetAcquisitionPort()) {
|
||||||
close(sock_fd);
|
close(sock_fd);
|
||||||
res_fatal(res, "Invalid port %d", port);
|
res_fatal(res, "Invalid port %d", port);
|
||||||
return;
|
return;
|
||||||
@@ -579,7 +579,8 @@ PRV_BindSocket(int sock, struct sockaddr *address, socklen_t address_len)
|
|||||||
unsigned short port;
|
unsigned short port;
|
||||||
|
|
||||||
UTI_SockaddrToIPAndPort(address, &ip, &port);
|
UTI_SockaddrToIPAndPort(address, &ip, &port);
|
||||||
assert(!port || port == CNF_GetNTPPort());
|
if (port && port != CNF_GetNTPPort() && port != CNF_GetAcquisitionPort())
|
||||||
|
assert(0);
|
||||||
|
|
||||||
if (!have_helper())
|
if (!have_helper())
|
||||||
return bind(sock, address, address_len);
|
return bind(sock, address, address_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user