diff --git a/lib/psm.c b/lib/psm.c index 30e5b96..850cc98 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -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]);