# 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.
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)
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(), 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(), transactionFileInfo_s::magic, PSM_SCRIPT, psmStage(), RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, rpmtransCreateSet(), rpmtransFree(), rpmTransactionSet_s::scriptFd, TFIMAGIC, 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, rpmdepCheck(), rpmdepFreeConflicts(), RPMMESS_NORMAL, rpmMessage, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, rpmtransAddPackage(), rpmtransCreateSet(), rpmtransFree(), and stpcpy().

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, headerIsEntry(), rpmQVArguments_s::qva_fflags, rpmQVArguments_s::qva_flags, rpmQVArguments_s::qva_prefix, 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().