diff options
author | jbj <devnull@localhost> | 2001-08-17 19:38:06 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-08-17 19:38:06 +0000 |
commit | 507f3400be2592b030f76ca144980635cce8d25b (patch) | |
tree | d1920cc278eae5c6171a53346784585704dcd075 /lib/verify.c | |
parent | 3b6b341a44b635e979434572eaf74986385319f5 (diff) | |
download | librpm-tizen-507f3400be2592b030f76ca144980635cce8d25b.tar.gz librpm-tizen-507f3400be2592b030f76ca144980635cce8d25b.tar.bz2 librpm-tizen-507f3400be2592b030f76ca144980635cce8d25b.zip |
- verify perms (but not mode) on %ghost files.
CVS patchset: 5019
CVS date: 2001/08/17 19:38:06
Diffstat (limited to 'lib/verify.c')
-rw-r--r-- | lib/verify.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/verify.c b/lib/verify.c index 4d6cf47ae..cb0e82f22 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -86,8 +86,13 @@ int rpmVerifyFile(const char * root, Header h, int filenum, char * t = alloca(nb); filespec = t; *t = '\0'; - t = stpcpy(t, root); - *t++ = '/'; + if (root && !(root[0] == '/' && root[1] == '\0')) { + t = stpcpy(t, root); + while (t > filespec && t[-1] == '/') { + --t; + *t = '\0'; + } + } t = stpcpy(t, dirNames[dirIndexes[filenum]]); t = stpcpy(t, baseNames[filenum]); } @@ -153,10 +158,9 @@ int rpmVerifyFile(const char * root, Header h, int filenum, /* * Content checks of %ghost files are meaningless. */ - if (fileAttrs & RPMFILE_GHOST) { + if (fileAttrs & RPMFILE_GHOST) flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME | - RPMVERIFY_LINKTO | RPMVERIFY_MODE); - } + RPMVERIFY_LINKTO); /* * Don't verify any features in omitMask. @@ -210,11 +214,24 @@ int rpmVerifyFile(const char * root, Header h, int filenum, } if (flags & RPMVERIFY_MODE) { + unsigned short metamode = modeList[filenum]; + unsigned short filemode; + /* * Platforms (like AIX) where sizeof(unsigned short) != sizeof(mode_t) * need the (unsigned short) cast here. */ - if (modeList[filenum] != (unsigned short)sb.st_mode) + filemode = (unsigned short)sb.st_mode; + + /* + * Comparing the type of %ghost files is meaningless, but perms are OK. + */ + if (fileAttrs & RPMFILE_GHOST) { + metamode &= ~0xf000; + filemode &= ~0xf000; + } + + if (metamode != filemode) *result |= RPMVERIFY_MODE; } |