]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
privops: allow binding to acquisition port
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Apr 2018 09:05:33 +0000 (11:05 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Apr 2018 07:18:34 +0000 (09:18 +0200)
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.

privops.c

index a7ba8902dee052838cbf8b5eb392cacdd702261a..359e1637aa800c6d4ccd2a91598322d8b7b4ad4b 100644 (file)
--- a/privops.c
+++ b/privops.c
@@ -268,7 +268,7 @@ do_bind_socket(ReqBindSocket *req, PrvResponse *res)
   sock_fd = req->sock;
 
   UTI_SockaddrToIPAndPort(sa, &ip, &port);
-  if (port && port != CNF_GetNTPPort()) {
+  if (port && port != CNF_GetNTPPort() && port != CNF_GetAcquisitionPort()) {
     close(sock_fd);
     res_fatal(res, "Invalid port %d", port);
     return;
@@ -579,7 +579,8 @@ PRV_BindSocket(int sock, struct sockaddr *address, socklen_t address_len)
   unsigned short port;
 
   UTI_SockaddrToIPAndPort(address, &ip, &port);
-  assert(!port || port == CNF_GetNTPPort());
+  if (port && port != CNF_GetNTPPort() && port != CNF_GetAcquisitionPort())
+    assert(0);
 
   if (!have_helper())
     return bind(sock, address, address_len);