Re: [PATCH 2/2] ipcs: Set SO_PASSCRED also on listening socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK

On 24/10/13 15:05, Jan Friesse wrote:
This patch is needed for kernel patch
http://patchwork.ozlabs.org/patch/284366/

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
  exec/coroipcs.c |   10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/exec/coroipcs.c b/exec/coroipcs.c
index 58f7ae1..e16b473 100644
--- a/exec/coroipcs.c
+++ b/exec/coroipcs.c
@@ -1046,6 +1046,9 @@ static void _corosync_ipc_init(void)
  	int server_fd;
  	struct sockaddr_un un_addr;
  	int res;
+#if SO_PASSCRED
+	int on = 1;
+#endif

  	/*
  	 * Create socket for IPC clients, name socket, listen for connections
@@ -1102,6 +1105,13 @@ static void _corosync_ipc_init(void)
  #if !defined(COROSYNC_LINUX)
  	res = chmod (un_addr.sun_path, S_IRWXU|S_IRWXG|S_IRWXO);
  #endif
+#if SO_PASSCRED
+	res = setsockopt(server_fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof (on));
+	if (res == -1) {
+		LOGSYS_PERROR (errno, LOGSYS_LEVEL_CRIT, "Could not set SO_PASSCRED to AF_UNIX_SOCKET");
+		api->fatal_error ("Could not set SO_PASSCRED to AF_UNIX_SOCKET\n");
+	}
+#endif
  	listen (server_fd, SERVER_BACKLOG);

  	/*


_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux