diff options
author | jbj <devnull@localhost> | 2000-08-19 13:10:34 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2000-08-19 13:10:34 +0000 |
commit | d0e98332d4115aa087e1e1f8e39b80c02c406f10 (patch) | |
tree | 37382b177bb3a11f360eb28c176c328b23bbf41a /lib | |
parent | c96e7513f8dd3ebd4030946720e2dff96a5c3cd2 (diff) | |
download | rpm-d0e98332d4115aa087e1e1f8e39b80c02c406f10.tar.gz rpm-d0e98332d4115aa087e1e1f8e39b80c02c406f10.tar.bz2 rpm-d0e98332d4115aa087e1e1f8e39b80c02c406f10.zip |
- python bindings to query and verify signatures.
CVS patchset: 4085
CVS date: 2000/08/19 13:10:34
Diffstat (limited to 'lib')
-rw-r--r-- | lib/misc.c | 31 | ||||
-rw-r--r-- | lib/rpmlib.h | 18 |
2 files changed, 49 insertions, 0 deletions
diff --git a/lib/misc.c b/lib/misc.c index 5d5b265dd..278ff0196 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -673,6 +673,37 @@ int rpmHeaderGetEntry(Header h, int_32 tag, int_32 *type, } /* + * XXX Yet Another dressed entry to unify signature/header tag retrieval. + */ +int rpmPackageGetEntry(void *leadp, Header sigs, Header h, + int_32 tag, int_32 *type, void **p, int_32 *c) +{ + int_32 sigtag; + + switch (tag) { + case RPMTAG_SIGSIZE: sigtag = RPMSIGTAG_SIZE; break; + case RPMTAG_SIGLEMD5_1: sigtag = RPMSIGTAG_LEMD5_1; break; + case RPMTAG_SIGPGP: sigtag = RPMSIGTAG_PGP; break; + case RPMTAG_SIGLEMD5_2: sigtag = RPMSIGTAG_LEMD5_2; break; + case RPMTAG_SIGMD5: sigtag = RPMSIGTAG_MD5; break; + case RPMTAG_SIGGPG: sigtag = RPMSIGTAG_GPG; break; + case RPMTAG_SIGPGP5: sigtag = RPMSIGTAG_GPG; break; + + default: + return rpmHeaderGetEntry(h, tag, type, p, c); + /*@notreached@*/ break; + } + + if (sigs == NULL) { + if (c) *c = 0; + return 0; + } + + return headerGetEntry(sigs, sigtag, type, p, c); + +} + +/* * Up to rpm 3.0.4, packages implicitly provided their own name-version-release. * Retrofit an explicit "Provides: name = epoch:version-release. */ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 8ead72ab2..d8af9933f 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -45,6 +45,12 @@ void rpmBuildFileList(Header h, /*@out@*/ const char *** fileListPtr, int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type, /*@out@*/ void **p, /*@out@*/int_32 *c); +/* + * XXX Yet Another dressed entry to unify signature/header tag retrieval. + */ +int rpmPackageGetEntry(void *leadp, Header sigs, Header h, + int_32 tag, int_32 *type, void **p, int_32 *c); + /* 0 = success */ /* 1 = bad magic */ /* 2 = error */ @@ -63,6 +69,18 @@ extern const struct headerSprintfExtension rpmHeaderFormats[]; #define RPMDBI_REMOVED 4 #define RPMDBI_AVAILABLE 5 +/* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. */ + +/* XXX underscore prevents tagTable generation */ +#define RPMTAG_SIG_BASE 256 +#define RPMTAG_SIGSIZE RPMTAG_SIG_BASE+1 +/* the md5 sum was broken *twice* on big endian machines */ +#define RPMTAG_SIGLEMD5_1 RPMTAG_SIG_BASE+2 +#define RPMTAG_SIGPGP RPMTAG_SIG_BASE+3 +#define RPMTAG_SIGLEMD5_2 RPMTAG_SIG_BASE+4 +#define RPMTAG_SIGMD5 RPMTAG_SIG_BASE+5 +#define RPMTAG_SIGGPG RPMTAG_SIG_BASE+6 +#define RPMTAG_SIGPGP5 RPMTAG_SIG_BASE+7 /* internal */ /* these tags are found in package headers */ /* none of these can be 0 !! */ |