1 |
commit: 017d20b8f56c2cc9279558f3363d35816fd5c7d3 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 28 22:38:40 2020 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 29 12:46:09 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=017d20b8 |
7 |
|
8 |
kde-frameworks/kio: kio_trash: remove too strict permission check |
9 |
|
10 |
Fixes an upstream Gentoo user report from 2004. |
11 |
|
12 |
Upstream commit 03bcb3d3ff89074a68839b6ebeb8030ef0ee4fd1 |
13 |
|
14 |
KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=76380 |
15 |
Package-Manager: Portage-3.0.8, Repoman-3.0.1 |
16 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
17 |
|
18 |
...o-5.74.1-kio_trash-too-strict-perms-check.patch | 67 +++++++++++++++ |
19 |
kde-frameworks/kio/kio-5.74.1-r1.ebuild | 96 ++++++++++++++++++++++ |
20 |
2 files changed, 163 insertions(+) |
21 |
|
22 |
diff --git a/kde-frameworks/kio/files/kio-5.74.1-kio_trash-too-strict-perms-check.patch b/kde-frameworks/kio/files/kio-5.74.1-kio_trash-too-strict-perms-check.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..d0b0ca0769c |
25 |
--- /dev/null |
26 |
+++ b/kde-frameworks/kio/files/kio-5.74.1-kio_trash-too-strict-perms-check.patch |
27 |
@@ -0,0 +1,67 @@ |
28 |
+From 03bcb3d3ff89074a68839b6ebeb8030ef0ee4fd1 Mon Sep 17 00:00:00 2001 |
29 |
+From: David Faure <faure@×××.org> |
30 |
+Date: Fri, 11 Sep 2020 11:54:09 +0200 |
31 |
+Subject: [PATCH] kio_trash: remove unnecessarily strict permission check |
32 |
+ |
33 |
+Tested with `chmod 0770 /d/.Trash-1000` (where /d is a mount point), |
34 |
+kio_trash complained about security checks before this commit, |
35 |
+and works with it. |
36 |
+ |
37 |
+Also tested with a USB key which ends up mounted as |
38 |
+type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=100,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2). After kio_trash creates .Trash-1000 |
39 |
+it complained about a "strange filesystem", and while this is still true :), |
40 |
+the removal of the code in TrashImpl::initTrashDirectory makes |
41 |
+the trash dir on the USB key usable. |
42 |
+ |
43 |
+BUG: 76380 |
44 |
+FIXED-IN: 5.74 |
45 |
+--- |
46 |
+ src/ioslaves/trash/trashimpl.cpp | 25 ++++--------------------- |
47 |
+ 1 file changed, 4 insertions(+), 21 deletions(-) |
48 |
+ |
49 |
+diff --git a/src/ioslaves/trash/trashimpl.cpp b/src/ioslaves/trash/trashimpl.cpp |
50 |
+index b1ba87a4..9ec7cc7a 100644 |
51 |
+--- a/src/ioslaves/trash/trashimpl.cpp |
52 |
++++ b/src/ioslaves/trash/trashimpl.cpp |
53 |
+@@ -1210,9 +1210,9 @@ QString TrashImpl::trashForMountPoint(const QString &topdir, bool createIfNeeded |
54 |
+ const QByteArray trashDir_c = QFile::encodeName(trashDir); |
55 |
+ if (QT_LSTAT(trashDir_c.constData(), &buff) == 0) { |
56 |
+ if ((buff.st_uid == uid) // must be owned by user |
57 |
+- && (S_ISDIR(buff.st_mode)) // must be a dir |
58 |
+- && (!S_ISLNK(buff.st_mode)) // not a symlink |
59 |
+- && ((buff.st_mode & 0777) == 0700)) { // rwx for user, ------ for group and others |
60 |
++ && S_ISDIR(buff.st_mode) // must be a dir |
61 |
++ && !S_ISLNK(buff.st_mode) // not a symlink |
62 |
++ && ((buff.st_mode & 0700) == 0700)) { // and we need write access to it |
63 |
+ |
64 |
+ if (checkTrashSubdirs(trashDir_c)) { |
65 |
+ return trashDir; |
66 |
+@@ -1248,24 +1248,7 @@ bool TrashImpl::initTrashDirectory(const QByteArray &trashDir_c) const |
67 |
+ return false; |
68 |
+ } |
69 |
+ //qCDebug(KIO_TRASH); |
70 |
+- // This trash dir will be useable only if the directory is owned by user. |
71 |
+- // In theory this is the case, but not on e.g. USB keys... |
72 |
+- uid_t uid = getuid(); |
73 |
+- QT_STATBUF buff; |
74 |
+- if (QT_LSTAT(trashDir_c.constData(), &buff) != 0) { |
75 |
+- return false; // huh? |
76 |
+- } |
77 |
+- if ((buff.st_uid == uid) // must be owned by user |
78 |
+- && ((buff.st_mode & 0777) == 0700)) { // rwx for user, --- for group and others |
79 |
+- |
80 |
+- return checkTrashSubdirs(trashDir_c); |
81 |
+- |
82 |
+- } else { |
83 |
+- qCWarning(KIO_TRASH) << trashDir_c << "just created, by it doesn't have the right permissions, probably some strange unsupported filesystem"; |
84 |
+- ::rmdir(trashDir_c.constData()); |
85 |
+- return false; |
86 |
+- } |
87 |
+- return true; |
88 |
++ return checkTrashSubdirs(trashDir_c); |
89 |
+ } |
90 |
+ |
91 |
+ bool TrashImpl::checkTrashSubdirs(const QByteArray &trashDir_c) const |
92 |
+-- |
93 |
+GitLab |
94 |
+ |
95 |
|
96 |
diff --git a/kde-frameworks/kio/kio-5.74.1-r1.ebuild b/kde-frameworks/kio/kio-5.74.1-r1.ebuild |
97 |
new file mode 100644 |
98 |
index 00000000000..8ba617db566 |
99 |
--- /dev/null |
100 |
+++ b/kde-frameworks/kio/kio-5.74.1-r1.ebuild |
101 |
@@ -0,0 +1,96 @@ |
102 |
+# Copyright 1999-2020 Gentoo Authors |
103 |
+# Distributed under the terms of the GNU General Public License v2 |
104 |
+ |
105 |
+EAPI=7 |
106 |
+ |
107 |
+ECM_DESIGNERPLUGIN="true" |
108 |
+ECM_TEST="forceoptional" |
109 |
+PVCUT=$(ver_cut 1-2) |
110 |
+QTMIN=5.14.2 |
111 |
+VIRTUALX_REQUIRED="test" |
112 |
+inherit ecm kde.org xdg-utils |
113 |
+ |
114 |
+DESCRIPTION="Framework providing transparent file and data management" |
115 |
+LICENSE="LGPL-2+" |
116 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
117 |
+IUSE="acl +handbook kerberos +kwallet X" |
118 |
+ |
119 |
+# drop qtnetwork subslot operator when QT_MINIMAL >= 5.15.0 |
120 |
+RDEPEND=" |
121 |
+ dev-libs/libxml2 |
122 |
+ dev-libs/libxslt |
123 |
+ >=dev-qt/qtdbus-${QTMIN}:5 |
124 |
+ >=dev-qt/qtdeclarative-${QTMIN}:5 |
125 |
+ >=dev-qt/qtgui-${QTMIN}:5 |
126 |
+ >=dev-qt/qtnetwork-${QTMIN}:5=[ssl] |
127 |
+ >=dev-qt/qtwidgets-${QTMIN}:5 |
128 |
+ >=dev-qt/qtxml-${QTMIN}:5 |
129 |
+ =kde-frameworks/kauth-${PVCUT}*:5 |
130 |
+ =kde-frameworks/karchive-${PVCUT}*:5 |
131 |
+ =kde-frameworks/kbookmarks-${PVCUT}*:5 |
132 |
+ =kde-frameworks/kcodecs-${PVCUT}*:5 |
133 |
+ =kde-frameworks/kcompletion-${PVCUT}*:5 |
134 |
+ =kde-frameworks/kconfig-${PVCUT}*:5 |
135 |
+ =kde-frameworks/kconfigwidgets-${PVCUT}*:5 |
136 |
+ =kde-frameworks/kcoreaddons-${PVCUT}*:5 |
137 |
+ =kde-frameworks/kcrash-${PVCUT}*:5 |
138 |
+ =kde-frameworks/kdbusaddons-${PVCUT}*:5 |
139 |
+ =kde-frameworks/ki18n-${PVCUT}*:5 |
140 |
+ =kde-frameworks/kiconthemes-${PVCUT}*:5 |
141 |
+ =kde-frameworks/kitemviews-${PVCUT}*:5 |
142 |
+ =kde-frameworks/kjobwidgets-${PVCUT}*:5 |
143 |
+ =kde-frameworks/knotifications-${PVCUT}*:5 |
144 |
+ =kde-frameworks/kservice-${PVCUT}*:5 |
145 |
+ =kde-frameworks/ktextwidgets-${PVCUT}*:5 |
146 |
+ =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 |
147 |
+ =kde-frameworks/kwindowsystem-${PVCUT}*:5 |
148 |
+ =kde-frameworks/kxmlgui-${PVCUT}*:5 |
149 |
+ =kde-frameworks/solid-${PVCUT}*:5 |
150 |
+ acl? ( |
151 |
+ sys-apps/attr |
152 |
+ virtual/acl |
153 |
+ ) |
154 |
+ handbook? ( =kde-frameworks/kdoctools-${PVCUT}*:5 ) |
155 |
+ kerberos? ( virtual/krb5 ) |
156 |
+ kwallet? ( =kde-frameworks/kwallet-${PVCUT}*:5 ) |
157 |
+ X? ( >=dev-qt/qtx11extras-${QTMIN}:5 ) |
158 |
+" |
159 |
+DEPEND="${RDEPEND} |
160 |
+ >=dev-qt/qtconcurrent-${QTMIN}:5 |
161 |
+ test? ( sys-libs/zlib ) |
162 |
+ X? ( |
163 |
+ x11-base/xorg-proto |
164 |
+ x11-libs/libX11 |
165 |
+ x11-libs/libXrender |
166 |
+ ) |
167 |
+" |
168 |
+PDEPEND=" |
169 |
+ >=kde-frameworks/kded-${PVCUT}:5 |
170 |
+" |
171 |
+ |
172 |
+# tests hang |
173 |
+RESTRICT+=" test" |
174 |
+ |
175 |
+PATCHES=( "${FILESDIR}"/${P}-kio_trash-too-strict-perms-check.patch ) |
176 |
+ |
177 |
+src_configure() { |
178 |
+ local mycmakeargs=( |
179 |
+ $(cmake_use_find_package acl ACL) |
180 |
+ $(cmake_use_find_package handbook KF5DocTools) |
181 |
+ $(cmake_use_find_package kerberos GSSAPI) |
182 |
+ $(cmake_use_find_package kwallet KF5Wallet) |
183 |
+ $(cmake_use_find_package X X11) |
184 |
+ ) |
185 |
+ |
186 |
+ ecm_src_configure |
187 |
+} |
188 |
+ |
189 |
+pkg_postinst() { |
190 |
+ ecm_pkg_postinst |
191 |
+ xdg_desktop_database_update |
192 |
+} |
193 |
+ |
194 |
+pkg_postrm() { |
195 |
+ ecm_pkg_postrm |
196 |
+ xdg_desktop_database_update |
197 |
+} |