psm.[ch]: skip fuser and fgroup test/set for src.rpm

Previous change in loadFi() triggers the code which depends
on fi->fuser and fi->fgroup being NULL for source rpms.
Now I add explicit check for source rpms.

Update: also turn off suid/sgid bits for src.rpm.
(cherry picked from commit 070b65040e)
This commit is contained in:
Alexey Tourbin 2008-06-09 00:29:18 +04:00
parent 75978600ab
commit f9c067a1ad

View File

@ -1680,17 +1680,22 @@ assert(psm->mi == NULL);
if (psm->goal == PSM_PKGINSTALL) {
struct availablePackage * alp = fi->ap;
int i;
int isSource;
if (fi->fc <= 0) break;
if (ts->transFlags & RPMTRANS_FLAG_JUSTDB) break;
isSource = !headerIsEntry(fi->h, RPMTAG_SOURCERPM);
for (i = 0; i < fi->fc; i++) {
uid_t uid;
gid_t gid;
uid = fi->uid;
gid = fi->gid;
if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
if (isSource)
fi->fmodes[i] &= ~S_ISUID;
else if (fi->fuser && unameToUid(fi->fuser[i], &uid)) {
rpmMessage(RPMMESS_WARNING,
_("user %s does not exist - using root\n"),
fi->fuser[i]);
@ -1699,7 +1704,9 @@ assert(psm->mi == NULL);
fi->fmodes[i] &= ~S_ISUID; /* turn off the suid bit */
}
if (fi->fgroup && gnameToGid(fi->fgroup[i], &gid)) {
if (isSource)
fi->fmodes[i] &= ~S_ISGID;
else if (fi->fgroup && gnameToGid(fi->fgroup[i], &gid)) {
rpmMessage(RPMMESS_WARNING,
_("group %s does not exist - using root\n"),
fi->fgroup[i]);