1 From: Panu Matilainen <pmatilai@redhat.com>
2 Date: Fri, 13 Apr 2012 10:16:51 +0000 (+0300)
3 Subject: Raise file conflicts on differing permissions (user, group, mode)
4 X-Git-Tag: rpm-4.11.0-alpha~426
5 X-Git-Url: http://rpm.org/gitweb?p=rpm.git;a=commitdiff_plain;h=cf1095648194104a81a58abead05974a5bfa3b9a
7 Raise file conflicts on differing permissions (user, group, mode)
9 - Two files (or directories) cannot be correctly shared if their
10 permissions differ, even if the content is identical: either
11 file will end up having wrong permissions, depending on installation
12 order. This means a package can among other things silently
13 eg relax permissions of eg security sensitive directory (accidentally
15 - We now require exact match of user, group and entire file mode
16 (previously only the file type part of mode was tested)
19 diff --git a/lib/rpmfi.c b/lib/rpmfi.c
20 index 42c07db..e6e1fb3 100644
23 @@ -542,13 +542,20 @@ rpmFileTypes rpmfiWhatis(rpm_mode_t mode)
25 int rpmfiCompareIndex(rpmfi afi, int aix, rpmfi bfi, int bix)
27 - rpmFileTypes awhat = rpmfiWhatis(rpmfiFModeIndex(afi, aix));
28 - rpmFileTypes bwhat = rpmfiWhatis(rpmfiFModeIndex(bfi, bix));
29 + mode_t amode = rpmfiFModeIndex(afi, aix);
30 + mode_t bmode = rpmfiFModeIndex(bfi, bix);
31 + rpmFileTypes awhat = rpmfiWhatis(amode);
32 + rpmFileTypes bwhat = rpmfiWhatis(bmode);
34 if ((rpmfiFFlagsIndex(afi, aix) & RPMFILE_GHOST) ||
35 (rpmfiFFlagsIndex(bfi, bix) & RPMFILE_GHOST)) return 0;
37 - if (awhat != bwhat) return 1;
38 + if (amode != bmode) return 1;
40 + if (!rstreq(rpmfiFUserIndex(afi, aix), rpmfiFUserIndex(bfi, bix)))
42 + if (!rstreq(rpmfiFGroupIndex(afi, aix), rpmfiFGroupIndex(bfi, bix)))
46 const char * alink = rpmfiFLinkIndex(afi, aix);