rpm/verifynodup.diff

73 lines
2.0 KiB
Diff

--- ./lib/verify.c.orig 2018-06-15 11:25:09.142724319 +0000
+++ ./lib/verify.c 2018-06-15 11:27:32.246363744 +0000
@@ -59,7 +59,7 @@ rpmVerifyAttrs rpmfilesVerify(rpmfiles f
rpmfileAttrs fileAttrs = rpmfilesFFlags(fi, ix);
rpmVerifyAttrs flags = rpmfilesVFlags(fi, ix);
const char * fn = rpmfilesFN(fi, ix);
- struct stat sb;
+ struct stat sb, fsb;
rpmVerifyAttrs vfy = RPMVERIFY_NONE;
/*
@@ -88,7 +88,7 @@ rpmVerifyAttrs rpmfilesVerify(rpmfiles f
break;
}
- if (fn == NULL || lstat(fn, &sb) != 0) {
+ if (fn == NULL || lstat(fn, &sb) != 0 || rpmfilesStat(fi, ix, 0, &fsb)) {
vfy |= RPMVERIFY_LSTATFAIL;
goto exit;
}
@@ -243,47 +243,11 @@ rpmVerifyAttrs rpmfilesVerify(rpmfiles f
vfy |= RPMVERIFY_MTIME;
}
- if (flags & RPMVERIFY_USER) {
- const char * name = rpmugUname(sb.st_uid);
- const char * fuser = rpmfilesFUser(fi, ix);
- uid_t uid;
- int namematch = 0;
- int idmatch = 0;
-
- if (name && fuser)
- namematch = rstreq(name, fuser);
- if (fuser && rpmugUid(fuser, &uid) == 0)
- idmatch = (uid == sb.st_uid);
-
- if (namematch != idmatch) {
- rpmlog(RPMLOG_WARNING,
- _("Duplicate username or UID for user %s\n"), fuser);
- }
-
- if (!(namematch || idmatch))
- vfy |= RPMVERIFY_USER;
- }
-
- if (flags & RPMVERIFY_GROUP) {
- const char * name = rpmugGname(sb.st_gid);
- const char * fgroup = rpmfilesFGroup(fi, ix);
- gid_t gid;
- int namematch = 0;
- int idmatch = 0;
-
- if (name && fgroup)
- namematch = rstreq(name, fgroup);
- if (fgroup && rpmugGid(fgroup, &gid) == 0)
- idmatch = (gid == sb.st_gid);
-
- if (namematch != idmatch) {
- rpmlog(RPMLOG_WARNING,
- _("Duplicate groupname or GID for group %s\n"), fgroup);
- }
+ if ((flags & RPMVERIFY_USER) && (sb.st_uid != fsb.st_uid))
+ vfy |= RPMVERIFY_USER;
- if (!(namematch || idmatch))
- vfy |= RPMVERIFY_GROUP;
- }
+ if ((flags & RPMVERIFY_GROUP) && (sb.st_gid != fsb.st_gid))
+ vfy |= RPMVERIFY_GROUP;
exit:
return vfy;