Resolves: rhbz#2123389

- Fixed ruby socket permissions
This commit is contained in:
Miroslav Lisik 2022-09-07 16:37:27 +02:00
parent e364a48be5
commit 09490deee9
2 changed files with 53 additions and 1 deletions

View File

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

View File

@ -1,6 +1,6 @@
Name: pcs
Version: 0.11.3
Release: 3%{?dist}
Release: 4%{?dist}
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPLv2: pcs
@ -49,6 +49,7 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm
# pcs patches: <= 200
# Patch0: name.patch
Patch0: bz2123389-01-fix-ruby-socket-permissions.patch
# ui patches: >200
# Patch201: name.patch
@ -248,6 +249,7 @@ update_times_patch(){
# patch pcs sources
%autosetup -S git -n %{pcs_source_name} -N
%autopatch -p1 -M 200
update_times_patch %{PATCH0}
# prepare dirs/files necessary for building all bundles
# -----------------------------------------------------
@ -421,6 +423,10 @@ run_all_tests
%license pyagentx_LICENSE.txt
%changelog
* Wed Sep 07 2022 Miroslav Lisik <mlisik@redhat.com> - 0.11.3-4
- Fixed ruby socket permissions
- Resolves: rhbz#2123389
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild