rpm  5.2.1
Functions
pkgio.h File Reference

Methods to handle package elements. More...

#include <rpmpgp.h>
Include dependency graph for pkgio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

rpmRC headerCheck (pgpDig dig, const void *uh, size_t uc, const char **msg)
 Check header consistency, performing headerGetEntry() the hard way. More...
 
rpmRC rpmReadPackageFile (rpmts ts, FD_t fd, const char *fn, Header *hdrp)
 Return package header from file handle, verifying digests/signatures. More...
 
size_t rpmpkgSizeof (const char *fn, const void *ptr)
 Return size of item in bytes. More...
 
rpmRC rpmpkgWrite (const char *fn, FD_t fd, void *ptr, const char **msg)
 Write item onto file descriptor. More...
 
rpmRC rpmpkgRead (const char *fn, FD_t fd, void *ptr, const char **msg)
 Read item from file descriptor. More...
 
rpmRC rpmpkgCheck (const char *fn, FD_t fd, const void *ptr, const char **msg)
 Verify item integrity. More...
 

Detailed Description

Methods to handle package elements.

Definition in file pkgio.h.

Function Documentation

rpmRC headerCheck ( pgpDig  dig,
const void *  uh,
size_t  uc,
const char **  msg 
)

Check header consistency, performing headerGetEntry() the hard way.

Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.

Parameters
digsignature parameters container
uhunloaded header blob
ucno. of bytes in blob (or 0 to disable)
Return values
*msgverification error message (or NULL)
Returns
RPMRC_OK on success

Check header consistency, performing headerGetEntry() the hard way.

Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.

Parameters
digsignature parameters container
uhunloaded header blob
ucno. of bytes in blob (or 0 to disable)
Return values
*msgsignature verification msg
Returns
RPMRC_OK/RPMRC_NOTFOUND/RPMRC_FAIL

Definition at line 921 of file pkgio.c.

References _, _free(), _pkgio_debug, _print_pkts, alloca(), entryInfo_s::count, headerGetMagic(), headerVerifyInfo(), indexEntry_s::info, entryInfo_s::offset, pgpDigVSFlags, pgpGetSig(), PGPHASHALGO_SHA1, pgpPrtPkts(), pgpSetSig(), pgpStatsAccumulator(), REGION_TAG_COUNT, RPM_BIN_TYPE, RPM_STRING_TYPE, RPMDIGEST_NONE, rpmDigestInit(), rpmDigestUpdate(), rpmIsDebug, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, rpmswEnter(), rpmswExit(), RPMTAG_DSAHEADER, RPMTAG_HEADERIMMUTABLE, RPMTAG_RSAHEADER, RPMTAG_SHA1HEADER, rpmVerifySignature(), RPMVSF_NODSAHEADER, RPMVSF_NORSAHEADER, RPMVSF_NOSHA1HEADER, snprintf(), entryInfo_s::tag, entryInfo_s::type, vsflags, xmalloc(), and xstrdup().

Referenced by miFreeHeader(), rpmdbAdd(), rpmmiNext(), rpmReadHeader(), and rpmts_HdrCheck().

rpmRC rpmpkgCheck ( const char *  fn,
FD_t  fd,
const void *  ptr,
const char **  msg 
)

Verify item integrity.

Parameters
fnitem name
fdfile handle
ptritem buffer
Return values
*msgitem check failure message
Returns
RPMRC_OK on success

Definition at line 1513 of file pkgio.c.

References ckHeader(), and RPMRC_FAIL.

rpmRC rpmpkgRead ( const char *  fn,
FD_t  fd,
void *  ptr,
const char **  msg 
)

Read item from file descriptor.

Parameters
fnitem name
fdfile handle
Return values
*ptritem buffer
*msgitem check failure message
Returns
RPMRC_OK on success

Definition at line 1525 of file pkgio.c.

References rdHeader(), rdLead(), rdSignature(), and RPMRC_FAIL.

Referenced by makeHDRSignature(), readFile(), rpmgiNext(), rpmReadHeaders(), rpmReadPackageFile(), rpmReSign(), rpmSingleHeaderFromFD(), rpmVerifySignatures(), and writeRPM().

size_t rpmpkgSizeof ( const char *  fn,
const void *  ptr 
)

Return size of item in bytes.

Parameters
fnitem name
ptritem buffer
Returns
size of item in bytes.

Definition at line 1497 of file pkgio.c.

References szHeader().

Referenced by printSize(), rpmpsmStage(), and writeRPM().

rpmRC rpmpkgWrite ( const char *  fn,
FD_t  fd,
void *  ptr,
const char **  msg 
)

Write item onto file descriptor.

Parameters
fnitem name
fdfile handle
ptritem buffer
Return values
*msgitem check failure message
Returns
RPMRC_OK on success

Definition at line 1543 of file pkgio.c.

References RPMRC_FAIL, wrHeader(), wrLead(), and wrSignature().

Referenced by makeHDRSignature(), rpmpsmStage(), rpmReSign(), rpmWriteHeaders(), and writeRPM().

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
tstransaction set
fdfile handle
fnfile name
Return values
hdrpaddress 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().