- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

# lib/verify.c File Reference

Verify installed payload files from package metadata. More...

`#include "system.h"`
`#include "psm.h"`
`#include <rpmcli.h>`
`#include "ugid.h"`
`#include "misc.h"`
`#include "debug.h"`

Go to the source code of this file.

## Defines
#define | S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
#define | _verify(_RPMVERIFY_F, _C) ((verifyResult & _RPMVERIFY_F) ? _C : aok)
#define | _verifylink(_RPMVERIFY_F, _C)
#define | _verifyfile(_RPMVERIFY_F, _C)
## Functions
int | rpmVerifyFile (const char *root, Header h, int filenum, rpmVerifyAttrs *result, rpmVerifyAttrs omitMask)
| Verify file attributes (including MD5 sum).
int | rpmVerifyScript (const char *rootDir, Header h, FD_t scriptFd)
| Return exit code from running verify script from header.
int | rpmVerifyDigest (Header h)
| Check original header digest.
static int | verifyHeader (QVA_t qva, Header h)
| Check file info from header against what's actually installed.
static int | verifyDependencies (rpmdb rpmdb, Header h)
| Check installed package dependencies for problems.
int | showVerifyPackage (QVA_t qva, rpmdb rpmdb, Header h)
| Display results of package verify.
int | rpmVerify (QVA_t qva, rpmQVSources source, const char *arg)
| Verify package install.

## Detailed Description

Verify installed payload files from package metadata.

Definition in file verify.c.

## Define Documentation

#define _verify | ( | _RPMVERIFY_F,
|  | _C |  | ) | ((verifyResult & _RPMVERIFY_F) ? _C : aok)

Referenced by verifyHeader().

#define _verifyfile | ( | _RPMVERIFY_F,
|  | _C |  | ) |

Value:

    ((verifyResult & RPMVERIFY_READFAIL) ? unknown : \
             (verifyResult & _RPMVERIFY_F) ? _C : aok)

Referenced by verifyHeader().

#define _verifylink | ( | _RPMVERIFY_F,
|  | _C |  | ) |

Value:

    ((verifyResult & RPMVERIFY_READLINKFAIL) ? unknown : \
             (verifyResult & _RPMVERIFY_F) ? _C : aok)

Referenced by verifyHeader().

#define S_ISDEV | ( | m |  | ) | (S_ISBLK((m)) || S_ISCHR((m)))

Definition at line 20 of file verify.c.

Referenced by rpmVerifyFile().

## Function Documentation

int rpmVerifyDigest | ( | Header | h | ) |

Check original header digest.

Todo:
  Make digest check part of rpmdb iterator.

Parameters:

  | h | header

Returns:
  0 on success (or unavailable), 1 on digest mismatch

Definition at line 305 of file verify.c.

References _free(), headerFreeData(), headerGetEntry(), PGPHASHALGO_SHA1, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), RPMTAG_BADSHA1HEADER, RPMTAG_HEADERIMMUTABLE, RPMTAG_SHA1HEADER, and RPMTAG_SHA1RHN.

Referenced by rhnLoad(), and showVerifyPackage().

int rpmVerifyScript | ( | const char * | rootDir,
|  | Header | h,
|  | FD_t | scriptFd |
| ) |  |  |

Return exit code from running verify script from header.

Todo:
  gnorpm/kpackage prevents static, should be using VERIFY_SCRIPT flag.

Parameters:

  | rootDir | path to top of install tree
  | h | header
  | scriptFd | file handle to use for stderr (or NULL)

Returns:
  0 on success

Definition at line 279 of file verify.c.

References _free(), fdLink, freeFi(), loadFi(), PSM_SCRIPT, psmStage(), psm_s::rc, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, rpmtransCreateSet(), rpmtransFree(), rpmTransactionSet_s::scriptFd, TFIMAGIC, psm_s::ts, and xcalloc().

Referenced by showVerifyPackage().

static int verifyDependencies | ( | rpmdb | rpmdb,
|  | Header | h |
| ) |  |  | `[static]`

Check installed package dependencies for problems.

Parameters:

  | rpmdb | rpm database
  | h | header

Returns:
  0 no problems, 1 problems found

Definition at line 462 of file verify.c.

References _, alloca(), headerNVR(), rpmDependencyConflict_s::needsFlags, psm_s::rc, rpmdepCheck(), rpmdepFreeConflicts(), RPMMESS_NORMAL, rpmMessage, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, rpmtransAddPackage(), rpmtransCreateSet(), rpmtransFree(), stpcpy(), and psm_s::ts.

Referenced by showVerifyPackage().

static int verifyHeader | ( | QVA_t | qva,
|  | Header | h |
| ) |  |  | `[static]`

Check file info from header against what's actually installed.

Parameters:

  | h | header

Returns:
  0 no problems, 1 problems found

Definition at line 355 of file verify.c.

References _, _free(), _verify, _verifyfile, _verifylink, headerGetEntryMinMemory(), headerIsEntry(), rpmQVArguments_s::qva_fflags, rpmQVArguments_s::qva_flags, rpmQVArguments_s::qva_prefix, psm_s::rc, rpmBuildFileList(), RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_GHOST, RPMFILE_LICENSE, RPMFILE_MISSINGOK, RPMFILE_README, rpmIsVerbose, RPMMESS_NORMAL, rpmMessage, RPMTAG_BASENAMES, RPMTAG_FILEFLAGS, RPMVERIFY_FILESIZE, RPMVERIFY_GROUP, RPMVERIFY_LINKTO, RPMVERIFY_MD5, RPMVERIFY_MODE, RPMVERIFY_MTIME, RPMVERIFY_RDEV, RPMVERIFY_USER, rpmVerifyFile(), and VERIFY_ATTRS.

Referenced by showVerifyPackage().