Blame SOURCES/bz2116838-01-fix-ruby-socket-permissions.patch

d8d769
From 667f7bb5c6221037f40dd44bc89527e478ad7f7e Mon Sep 17 00:00:00 2001
d8d769
From: Tomas Jelinek <tojeline@redhat.com>
d8d769
Date: Wed, 10 Aug 2022 14:47:53 +0200
d8d769
Subject: [PATCH 1/2] fix ruby socket permissions
d8d769
d8d769
---
d8d769
 pcsd/rserver.rb | 23 +++++++++++++++++++++++
d8d769
 1 file changed, 23 insertions(+)
d8d769
d8d769
diff --git a/pcsd/rserver.rb b/pcsd/rserver.rb
d8d769
index c37f9df4..a54509fe 100644
d8d769
--- a/pcsd/rserver.rb
d8d769
+++ b/pcsd/rserver.rb
d8d769
@@ -7,6 +7,29 @@ require 'thin'
d8d769
 
d8d769
 require 'settings.rb'
d8d769
 
d8d769
+# Replace Thin::Backends::UnixServer:connect
d8d769
+# The only change is 'File.umask(0o777)' instead of 'File.umask(0)' to properly
d8d769
+# set python-ruby socket permissions
d8d769
+module Thin
d8d769
+  module Backends
d8d769
+    class UnixServer < Base
d8d769
+      def connect
d8d769
+        at_exit { remove_socket_file } # In case it crashes
d8d769
+        old_umask = File.umask(0o077)
d8d769
+        begin
d8d769
+          EventMachine.start_unix_domain_server(@socket, UnixConnection, &method(:initialize_connection))
d8d769
+          # HACK EventMachine.start_unix_domain_server doesn't return the connection signature
d8d769
+          #      so we have to go in the internal stuff to find it.
d8d769
+        @signature = EventMachine.instance_eval{@acceptors.keys.first}
d8d769
+        ensure
d8d769
+          File.umask(old_umask)
d8d769
+        end
d8d769
+      end
d8d769
+    end
d8d769
+  end
d8d769
+end
d8d769
+
d8d769
+
d8d769
 def pack_response(response)
d8d769
   return [200, {}, [response.to_json.to_str]]
d8d769
 end
d8d769
-- 
d8d769
2.37.2
d8d769