# 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)
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.
int | verifyHeader (QVA_t qva, Header h)
| Check file info from header against what's actually installed.
int | verifyDependencies (rpmdb rpmdb, Header h)
| Check installed package dependencies for problems.
int | showVerifyPackage (QVA_t qva, rpmdb rpmdb, Header h)
int | rpmVerify (QVA_t qva, rpmQVSources source, const char *arg)

## 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(), DIGEST_CTX, Header, HFD_t, HGE_t, int_32, PGPHASHALGO_SHA1, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), RPMTAG_BADSHA1HEADER, RPMTAG_HEADERIMMUTABLE, RPMTAG_SHA1HEADER, RPMTAG_SHA1RHN, and rpmTagType.

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(), FD_t, fdLink, freeFi(), Header, loadFi(), PSM_SCRIPT, PSM_t, psmStage(), rpmdb, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, rpmTransactionSet, rpmtransCreateSet(), rpmtransFree(), rpmTransactionSet_s::scriptFd, TFI_t, TFIMAGIC, and xcalloc().

Referenced by showVerifyPackage().

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(), Header, headerNVR(), rpmDependencyConflict_s::needsFlags, rpmdb, rpmdepCheck(), rpmDependencyConflict, rpmdepFreeConflicts(), RPMMESS_NORMAL, rpmMessage, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, rpmTransactionSet, rpmtransAddPackage(), rpmtransCreateSet(), rpmtransFree(), and stpcpy().

Referenced by showVerifyPackage().

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, Header, headerIsEntry(), HGE_t, int_32, rpmQVArguments_s::qva_fflags, rpmQVArguments_s::qva_flags, rpmQVArguments_s::qva_prefix, QVA_t, rpmBuildFileList(), RPMFILE_CONFIG, RPMFILE_DOC, RPMFILE_GHOST, RPMFILE_LICENSE, RPMFILE_MISSINGOK, RPMFILE_README, rpmfileAttrs, rpmIsVerbose, RPMMESS_NORMAL, rpmMessage, RPMTAG_BASENAMES, RPMTAG_FILEFLAGS, RPMVERIFY_FILESIZE, RPMVERIFY_GROUP, RPMVERIFY_LINKTO, RPMVERIFY_MD5, RPMVERIFY_MODE, RPMVERIFY_MTIME, RPMVERIFY_RDEV, RPMVERIFY_USER, rpmVerifyAttrs, rpmVerifyFile(), and VERIFY_ATTRS.

Referenced by showVerifyPackage().