package.c File Reference
HEADER.
`#include "system.h"`
`#include <netinet/in.h>`
`#include <rpmio_internal.h>`
`#include <rpmcb.h>`
`#include <rpmtag.h>`
`#include <rpmtypes.h>`
`#include <pkgio.h>`
`#include "signature.h"`
`#include "rpmts.h"`
`#include "debug.h"`
Include dependency graph for package.c:

Go to the source code of this file.

## Macros

#define | alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
#define | _chk(_mask) (she->tag == 0 && !(vsflags & (_mask)))

## Functions

static int | pgpStashKeyid (pgpDig dig)
| Remember current key id. More...
rpmRC | rpmReadPackageFile (rpmts ts, FD_t fd, const char *fn, Header *hdrp)
| Return package header from file handle, verifying digests/signatures. More...

## Variables

static int | _print_pkts = 0
static unsigned int | nkeyids_max = 256
static unsigned int | nkeyids = 0
static unsigned int | nextkeyid = 0
unsigned int * | keyids = NULL

## Macro Definition Documentation

#define _chk | ( |  | _mask | ) | (she->tag == 0 && !(vsflags & (_mask)))

Referenced by rpmReadPackageFile().

#define alloca_strdup | ( |  | _s | ) | strcpy(alloca(strlen(_s)+1), (_s))

Definition at line 21 of file package.c.

## Function Documentation

static int pgpStashKeyid | ( | pgpDig | dig | ) |

static

Remember current key id.

Parameters

  dig | container

Returns
  0 if new keyid, otherwise 1

Definition at line 45 of file package.c.

References keyids, nextkeyid, nkeyids, nkeyids_max, pgpGetSig(), pgpGetSignature(), pgpGrab(), and xrealloc().

Referenced by rpmReadPackageFile().

rpmRC rpmReadPackageFile | ( | rpmts | ts,
|  | FD_t | fd,
|  | const char * | fn,
|  | Header * | hdrp
| ) |  |

Return package header from file handle, verifying digests/signatures.

Todo:
  The rpmts either needs to become void *, or changed to -lrpmdb scope.

Parameters

  ts | transaction set
  fd | file handle
  fn | file name

Return values

  hdrp | address of header (or NULL)

Returns
  RPMRC_OK on success

Todo:
  Implement disable/enable/warn/error/anal policy.

Definition at line 80 of file package.c.

References _, _chk, _free(), _print_pkts, alloca(), _HE_s::c, rpmop_s::count, fdInitDigest(), fdSetDig(), fdstat_op(), FDSTAT_READ, fdStealDigest(), Fread(), Fstrerror(), headerFree(), headerGet(), headerGetMagic(), headerIsEntry(), headerLink(), headerMergeLegacySigs(), _HE_s::p, pgpDigVSFlags, PGPHASHALGO_MD5, PGPHASHALGO_SHA1, pgpPrtPkts(), pgpSetSig(), pgpStashKeyid(), pgpStatsAccumulator(), rpmDataType_u::ptr, RPMDIGEST_NONE, rpmDigestInit(), rpmDigestUpdate(), rpmIsDebug, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_WARNING, rpmpkgRead(), RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, rpmswAdd(), rpmswEnter(), rpmswExit(), rpmswSub(), RPMTAG_HEADERIMMUTABLE, RPMTS_OP_DIGEST, RPMTS_OP_READHDR, rpmtsCleanDig(), rpmtsDig(), rpmtsOp(), rpmVerifySignature(), RPMVSF_NEEDPAYLOAD, RPMVSF_NODSAHEADER, RPMVSF_NOMD5, RPMVSF_NORSAHEADER, RPMVSF_NOSHA1HEADER, _FD_s::stats, _HE_s::t, _HE_s::tag, and vsflags.

Referenced by IDTXglob(), main(), repoReadHeader(), rpmgiReadHeader(), rpmInstallSourcePackage(), rpmts_HdrFromFdno(), rpmtsRun(), and rpmtsSolve().

## Variable Documentation

int _print_pkts = 0

static

Definition at line 29 of file package.c.

Referenced by headerCheck(), rpmReadPackageFile(), and rpmVerifySignatures().

unsigned int* keyids = NULL

Definition at line 38 of file package.c.

Referenced by pgpStashKeyid(), and rpmcliFini().

unsigned int nextkeyid = 0

static

Definition at line 36 of file package.c.

Referenced by pgpStashKeyid().

unsigned int nkeyids = 0

static

Definition at line 34 of file package.c.

Referenced by pgpStashKeyid().

unsigned int nkeyids_max = 256

static

Definition at line 32 of file package.c.

Referenced by pgpStashKeyid().