If CHOWN_FOLLOWS_SYMLINK is set:

1) don't set the owner/group of symlinks during cpio expansion
	2) don't verify the owner/group of symlinks

CVS patchset: 1635
CVS date: 1997/05/15 15:19:56
This commit is contained in:
ewt 1997-05-15 15:19:56 +00:00
parent 50a49ee9ed
commit e324da522d
2 changed files with 12 additions and 3 deletions

View File

@ -197,14 +197,19 @@ static int setInfo(struct cpioHeader * hdr) {
int rc = 0;
struct utimbuf stamp = { hdr->mtime, hdr->mtime };
if (!getuid() && !rc && chown(hdr->path, hdr->uid, hdr->gid))
rc = CPIO_CHOWN_FAILED;
if (!S_ISLNK(hdr->mode)) {
if (!getuid() && !rc && chown(hdr->path, hdr->uid, hdr->gid))
rc = CPIO_CHOWN_FAILED;
if (!rc && chmod(hdr->path, hdr->mode & 07777))
rc = CPIO_CHMOD_FAILED;
if (!rc && utime(hdr->path, &stamp))
rc = CPIO_UTIME_FAILED;
} else {
#if ! CHOWN_FOLLOWS_SYMLINK
if (!getuid() && !rc && chown(hdr->path, hdr->uid, hdr->gid))
rc = CPIO_CHOWN_FAILED;
#endif
}
return rc;

View File

@ -95,8 +95,12 @@ int rpmVerifyFile(char * prefix, Header h, int filenum, int * result,
if (S_ISDIR(sb.st_mode))
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
RPMVERIFY_LINKTO);
else if (S_ISLNK(sb.st_mode))
else if (S_ISLNK(sb.st_mode)) {
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME);
#if CHOWN_FOLLOWS_SYMLINK
flags &= ~(RPMVERIFY_OWNER | RPM_VERIFY_GROUP);
#endif
}
else if (S_ISFIFO(sb.st_mode))
flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
RPMVERIFY_LINKTO);