]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
socket: remove unused chmod() call 28/head
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 16 Jul 2025 14:19:18 +0000 (16:19 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 30 Jul 2025 12:46:59 +0000 (14:46 +0200)
Drop the SCK_FLAG_ALL_PERMISSIONS support from the socket code.
chronyc is now calling chmod() on its socket itself in a hidden
directory to mitigate the unsafe operation.

socket.c
socket.h

index 13ea69fb680c66a5e77d3ed35f63a2433ff80074..06cd882101dbe10705251d25b0f0fa1c8fd31e6e 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -641,12 +641,6 @@ bind_unix_address(int sock_fd, const char *addr, int flags)
     return 0;
   }
 
-  /* Allow access to everyone with access to the directory if requested */
-  if (flags & SCK_FLAG_ALL_PERMISSIONS && chmod(addr, 0666) < 0) {
-    DEBUG_LOG("Could not change permissions of %s : %s", addr, strerror(errno));
-    return 0;
-  }
-
   return 1;
 }
 
index 8b178e2f7afc7dcb2cce23d841706d866cc1661d..99192c140712f5923625981623d68d3eb49085c7 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -34,8 +34,7 @@
 #define SCK_FLAG_BLOCK 1
 #define SCK_FLAG_BROADCAST 2
 #define SCK_FLAG_RX_DEST_ADDR 4
-#define SCK_FLAG_ALL_PERMISSIONS 8
-#define SCK_FLAG_PRIV_BIND 16
+#define SCK_FLAG_PRIV_BIND 8
 
 /* Flags for receiving and sending messages */
 #define SCK_FLAG_MSG_ERRQUEUE 1