- merge signature returns into rpmRC.
- python: exceptions on NOKEY/NOTTRUSTED. CVS patchset: 5667 CVS date: 2002/08/23 21:01:59
This commit is contained in:
parent
4e245109ad
commit
f5a546f580
2
CHANGES
2
CHANGES
|
@ -260,6 +260,8 @@
|
||||||
- fix: region trailer offset sanity check wrong (#71996).
|
- fix: region trailer offset sanity check wrong (#71996).
|
||||||
- fix: don't stop if db1 database is currently in /var/lib/rpm (#72224).
|
- fix: don't stop if db1 database is currently in /var/lib/rpm (#72224).
|
||||||
- add a macro to create a sub-package with debugging symbols.
|
- add a macro to create a sub-package with debugging symbols.
|
||||||
|
- merge signature returns into rpmRC.
|
||||||
|
- python: exceptions on NOKEY/NOTTRUSTED.
|
||||||
|
|
||||||
4.0.3 -> 4.0.4:
|
4.0.3 -> 4.0.4:
|
||||||
- solaris: translate i86pc to i386 (#57182).
|
- solaris: translate i86pc to i386 (#57182).
|
||||||
|
|
10
build/pack.c
10
build/pack.c
|
@ -338,15 +338,15 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
case RPMRC_OK:
|
||||||
|
case RPMRC_NOKEY:
|
||||||
|
case RPMRC_NOTTRUSTED:
|
||||||
|
break;
|
||||||
case RPMRC_NOTFOUND:
|
case RPMRC_NOTFOUND:
|
||||||
rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
|
rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
|
||||||
(fileName ? fileName : "<stdin>"));
|
(fileName ? fileName : "<stdin>"));
|
||||||
return RPMERR_BADMAGIC;
|
return RPMERR_BADMAGIC;
|
||||||
case RPMRC_OK:
|
|
||||||
break;
|
|
||||||
case RPMRC_FAIL:
|
case RPMRC_FAIL:
|
||||||
case RPMRC_BADSIZE:
|
|
||||||
case RPMRC_SHORTREAD:
|
|
||||||
default:
|
default:
|
||||||
rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"),
|
rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"),
|
||||||
(fileName ? fileName : "<stdin>"));
|
(fileName ? fileName : "<stdin>"));
|
||||||
|
@ -624,7 +624,7 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
|
||||||
strncpy(lead.name, buf, sizeof(lead.name));
|
strncpy(lead.name, buf, sizeof(lead.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeLead(fd, &lead)) {
|
if (writeLead(fd, &lead) != RPMRC_OK) {
|
||||||
rc = RPMERR_NOSPACE;
|
rc = RPMERR_NOSPACE;
|
||||||
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
|
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
|
||||||
Fstrerror(fd));
|
Fstrerror(fd));
|
||||||
|
|
|
@ -563,22 +563,7 @@ verifyinfo_exit:
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
switch (rpmVerifySignature(ts, buf)) {
|
rc = rpmVerifySignature(ts, buf);
|
||||||
case RPMSIG_OK: /* Signature is OK. */
|
|
||||||
rc = RPMRC_OK;
|
|
||||||
break;
|
|
||||||
case RPMSIG_NOTTRUSTED: /* Signature is OK, but key is not trusted. */
|
|
||||||
case RPMSIG_NOKEY: /* Key is unavailable. */
|
|
||||||
rc = RPMRC_OK;
|
|
||||||
break;
|
|
||||||
case RPMSIG_UNKNOWN: /* Signature is unknown type. */
|
|
||||||
rc = RPMRC_OK;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case RPMSIG_BAD: /* Signature does not verify. */
|
|
||||||
rc = RPMRC_FAIL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
if (msg != NULL)
|
if (msg != NULL)
|
||||||
|
@ -619,7 +604,8 @@ int rpmReadPackageFile(rpmts ts, FD_t fd,
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(l, 0, sizeof(*l));
|
memset(l, 0, sizeof(*l));
|
||||||
if (readLead(fd, l)) {
|
rc = readLead(fd, l);
|
||||||
|
if (rc != RPMRC_OK) {
|
||||||
rc = RPMRC_NOTFOUND;
|
rc = RPMRC_NOTFOUND;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -643,14 +629,18 @@ int rpmReadPackageFile(rpmts ts, FD_t fd,
|
||||||
|
|
||||||
/* Read the signature header. */
|
/* Read the signature header. */
|
||||||
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
||||||
if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE)) {
|
switch (rc) {
|
||||||
|
default:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), fn);
|
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), fn);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
/*@notreached@*/ break;
|
||||||
if (sigh == NULL) {
|
case RPMRC_OK:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
|
if (sigh == NULL) {
|
||||||
rc = RPMRC_FAIL;
|
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
|
||||||
goto exit;
|
rc = RPMRC_FAIL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _chk(_mask) (sigtag == 0 && !(vsflags & (_mask)))
|
#define _chk(_mask) (sigtag == 0 && !(vsflags & (_mask)))
|
||||||
|
@ -818,24 +808,24 @@ int rpmReadPackageFile(rpmts ts, FD_t fd,
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
switch (rpmVerifySignature(ts, buf)) {
|
rc = rpmVerifySignature(ts, buf);
|
||||||
case RPMSIG_OK: /* Signature is OK. */
|
switch (rc) {
|
||||||
|
case RPMRC_OK: /* Signature is OK. */
|
||||||
rpmMessage(RPMMESS_DEBUG, "%s: %s", fn, buf);
|
rpmMessage(RPMMESS_DEBUG, "%s: %s", fn, buf);
|
||||||
rc = RPMRC_OK;
|
|
||||||
break;
|
break;
|
||||||
case RPMSIG_NOTTRUSTED: /* Signature is OK, but key is not trusted. */
|
case RPMRC_NOTTRUSTED: /* Signature is OK, but key is not trusted. */
|
||||||
case RPMSIG_NOKEY: /* Key is unavailable. */
|
case RPMRC_NOKEY: /* Public key is unavailable. */
|
||||||
/* XXX Print NOKEY/NOTTRUSTED warning only once. */
|
/* XXX Print NOKEY/NOTTRUSTED warning only once. */
|
||||||
{ int lvl = (rpmtsStashKeyid(ts) ? RPMMESS_DEBUG : RPMMESS_WARNING);
|
{ int lvl = (rpmtsStashKeyid(ts) ? RPMMESS_DEBUG : RPMMESS_WARNING);
|
||||||
rpmMessage(lvl, "%s: %s", fn, buf);
|
rpmMessage(lvl, "%s: %s", fn, buf);
|
||||||
rc = RPMRC_OK;
|
rc = RPMRC_OK;
|
||||||
} break;
|
} break;
|
||||||
case RPMSIG_UNKNOWN: /* Signature is unknown type. */
|
case RPMRC_NOTFOUND: /* Signature is unknown type. */
|
||||||
rpmMessage(RPMMESS_WARNING, "%s: %s", fn, buf);
|
rpmMessage(RPMMESS_WARNING, "%s: %s", fn, buf);
|
||||||
rc = RPMRC_OK;
|
rc = RPMRC_OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case RPMSIG_BAD: /* Signature does not verify. */
|
case RPMRC_FAIL: /* Signature does not verify. */
|
||||||
rpmMessage(RPMMESS_ERROR, "%s: %s", fn, buf);
|
rpmMessage(RPMMESS_ERROR, "%s: %s", fn, buf);
|
||||||
rc = RPMRC_FAIL;
|
rc = RPMRC_FAIL;
|
||||||
break;
|
break;
|
||||||
|
|
68
lib/psm.c
68
lib/psm.c
|
@ -155,10 +155,10 @@ static int rpmInstallLoadMacros(rpmfi fi, Header h)
|
||||||
* @param fi transaction element file info
|
* @param fi transaction element file info
|
||||||
* @param h header from
|
* @param h header from
|
||||||
* @param newH header to
|
* @param newH header to
|
||||||
* @return 0 on success, 1 on failure
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
static int mergeFiles(rpmfi fi, Header h, Header newH)
|
static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
|
||||||
/*@modifies h @*/
|
/*@modifies h @*/
|
||||||
{
|
{
|
||||||
HGE_t hge = (HGE_t)fi->hge;
|
HGE_t hge = (HGE_t)fi->hge;
|
||||||
|
@ -249,7 +249,7 @@ static int mergeFiles(rpmfi fi, Header h, Header newH)
|
||||||
default:
|
default:
|
||||||
rpmError(RPMERR_DATATYPE, _("Data type %d not supported\n"),
|
rpmError(RPMERR_DATATYPE, _("Data type %d not supported\n"),
|
||||||
(int) type);
|
(int) type);
|
||||||
return 1;
|
return RPMRC_FAIL;
|
||||||
/*@notreached@*/ /*@switchbreak@*/ break;
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
data = hfd(data, type);
|
data = hfd(data, type);
|
||||||
|
@ -333,7 +333,7 @@ static int mergeFiles(rpmfi fi, Header h, Header newH)
|
||||||
newEVR = hfd(newEVR, nvt);
|
newEVR = hfd(newEVR, nvt);
|
||||||
Names = hfd(Names, rnt);
|
Names = hfd(Names, rnt);
|
||||||
}
|
}
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
}
|
}
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ static int mergeFiles(rpmfi fi, Header h, Header newH)
|
||||||
* @return 0 always
|
* @return 0 always
|
||||||
*/
|
*/
|
||||||
/*@-bounds@*/
|
/*@-bounds@*/
|
||||||
static int markReplacedFiles(const rpmpsm psm)
|
static rpmRC markReplacedFiles(const rpmpsm psm)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ static int markReplacedFiles(const rpmpsm psm)
|
||||||
int num, xx;
|
int num, xx;
|
||||||
|
|
||||||
if (!(rpmfiFC(fi) > 0 && fi->replaced))
|
if (!(rpmfiFC(fi) > 0 && fi->replaced))
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
|
|
||||||
num = prev = 0;
|
num = prev = 0;
|
||||||
for (sfi = replaced; sfi->otherPkg; sfi++) {
|
for (sfi = replaced; sfi->otherPkg; sfi++) {
|
||||||
|
@ -369,7 +369,7 @@ static int markReplacedFiles(const rpmpsm psm)
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
|
|
||||||
offsets = alloca(num * sizeof(*offsets));
|
offsets = alloca(num * sizeof(*offsets));
|
||||||
offsets[0] = 0;
|
offsets[0] = 0;
|
||||||
|
@ -414,7 +414,7 @@ static int markReplacedFiles(const rpmpsm psm)
|
||||||
}
|
}
|
||||||
mi = rpmdbFreeIterator(mi);
|
mi = rpmdbFreeIterator(mi);
|
||||||
|
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
}
|
}
|
||||||
/*@=bounds@*/
|
/*@=bounds@*/
|
||||||
|
|
||||||
|
@ -436,10 +436,20 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rc = rpmReadPackageFile(ts, fd, "InstallSourcePackage", &h);
|
rc = rpmReadPackageFile(ts, fd, "InstallSourcePackage", &h);
|
||||||
if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE) || h == NULL) {
|
switch (rc) {
|
||||||
|
case RPMRC_NOTTRUSTED:
|
||||||
|
case RPMRC_NOKEY:
|
||||||
|
case RPMRC_OK:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
goto exit;
|
goto exit;
|
||||||
|
/*@notreached@*/ break;
|
||||||
}
|
}
|
||||||
rc = RPMRC_OK; /* XXX HACK */
|
if (h == NULL)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
rc = RPMRC_OK;
|
||||||
|
|
||||||
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
|
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
|
||||||
|
|
||||||
if (!isSource) {
|
if (!isSource) {
|
||||||
|
@ -934,9 +944,9 @@ static const char * ldconfig_path = "/sbin/ldconfig";
|
||||||
* @param arg1 no. instances of package installed after scriptlet exec
|
* @param arg1 no. instances of package installed after scriptlet exec
|
||||||
* (-1 is no arg)
|
* (-1 is no arg)
|
||||||
* @param arg2 ditto, but for the target package
|
* @param arg2 ditto, but for the target package
|
||||||
* @return 0 on success, 1 on error
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
static int runScript(rpmpsm psm, Header h,
|
static rpmRC runScript(rpmpsm psm, Header h,
|
||||||
const char * sln,
|
const char * sln,
|
||||||
int progArgc, const char ** progArgv,
|
int progArgc, const char ** progArgv,
|
||||||
const char * script, int arg1, int arg2)
|
const char * script, int arg1, int arg2)
|
||||||
|
@ -967,7 +977,7 @@ static int runScript(rpmpsm psm, Header h,
|
||||||
const char *n, *v, *r;
|
const char *n, *v, *r;
|
||||||
|
|
||||||
if (progArgv == NULL && script == NULL)
|
if (progArgv == NULL && script == NULL)
|
||||||
return 0;
|
return rc;
|
||||||
|
|
||||||
psm->child = 0;
|
psm->child = 0;
|
||||||
psm->reaped = 0;
|
psm->reaped = 0;
|
||||||
|
@ -1030,7 +1040,7 @@ static int runScript(rpmpsm psm, Header h,
|
||||||
/*@-branchstate@*/
|
/*@-branchstate@*/
|
||||||
if (makeTempFile((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn, &fd)) {
|
if (makeTempFile((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn, &fd)) {
|
||||||
if (freePrefixes) free(prefixes);
|
if (freePrefixes) free(prefixes);
|
||||||
return 1;
|
return RPMRC_FAIL;
|
||||||
}
|
}
|
||||||
/*@=branchstate@*/
|
/*@=branchstate@*/
|
||||||
|
|
||||||
|
@ -1083,7 +1093,7 @@ static int runScript(rpmpsm psm, Header h,
|
||||||
} else {
|
} else {
|
||||||
out = fdDup(STDOUT_FILENO);
|
out = fdDup(STDOUT_FILENO);
|
||||||
}
|
}
|
||||||
if (out == NULL) return 1; /* XXX can't happen */
|
if (out == NULL) return RPMRC_FAIL; /* XXX can't happen */
|
||||||
|
|
||||||
/*@-branchstate@*/
|
/*@-branchstate@*/
|
||||||
if (!psmFork(psm)) {
|
if (!psmFork(psm)) {
|
||||||
|
@ -1259,7 +1269,8 @@ exit:
|
||||||
* @param triggersAlreadyRun
|
* @param triggersAlreadyRun
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static int handleOneTrigger(const rpmpsm psm, Header sourceH, Header triggeredH,
|
static rpmRC handleOneTrigger(const rpmpsm psm,
|
||||||
|
Header sourceH, Header triggeredH,
|
||||||
int arg2, unsigned char * triggersAlreadyRun)
|
int arg2, unsigned char * triggersAlreadyRun)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState@*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState@*/
|
||||||
/*@modifies psm, sourceH, triggeredH, *triggersAlreadyRun,
|
/*@modifies psm, sourceH, triggeredH, *triggersAlreadyRun,
|
||||||
|
@ -1356,9 +1367,9 @@ static int handleOneTrigger(const rpmpsm psm, Header sourceH, Header triggeredH,
|
||||||
/**
|
/**
|
||||||
* Run trigger scripts in the database that are fired by this header.
|
* Run trigger scripts in the database that are fired by this header.
|
||||||
* @param psm package state machine data
|
* @param psm package state machine data
|
||||||
* @return 0 on success, 1 on error
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
static int runTriggers(rpmpsm psm)
|
static rpmRC runTriggers(rpmpsm psm)
|
||||||
/*@globals rpmGlobalMacroContext,
|
/*@globals rpmGlobalMacroContext,
|
||||||
fileSystem, internalState @*/
|
fileSystem, internalState @*/
|
||||||
/*@modifies psm, rpmGlobalMacroContext,
|
/*@modifies psm, rpmGlobalMacroContext,
|
||||||
|
@ -1397,9 +1408,9 @@ static int runTriggers(rpmpsm psm)
|
||||||
/**
|
/**
|
||||||
* Run triggers from this header that are fired by headers in the database.
|
* Run triggers from this header that are fired by headers in the database.
|
||||||
* @param psm package state machine data
|
* @param psm package state machine data
|
||||||
* @return 0 on success, 1 on error
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
static int runImmedTriggers(rpmpsm psm)
|
static rpmRC runImmedTriggers(rpmpsm psm)
|
||||||
/*@globals rpmGlobalMacroContext,
|
/*@globals rpmGlobalMacroContext,
|
||||||
fileSystem, internalState @*/
|
fileSystem, internalState @*/
|
||||||
/*@modifies psm, rpmGlobalMacroContext,
|
/*@modifies psm, rpmGlobalMacroContext,
|
||||||
|
@ -1417,14 +1428,14 @@ static int runImmedTriggers(rpmpsm psm)
|
||||||
unsigned char * triggersRun;
|
unsigned char * triggersRun;
|
||||||
rpmRC rc = RPMRC_OK;
|
rpmRC rc = RPMRC_OK;
|
||||||
|
|
||||||
if (fi->h == NULL) return 0; /* XXX can't happen */
|
if (fi->h == NULL) return rc; /* XXX can't happen */
|
||||||
|
|
||||||
if (!( hge(fi->h, RPMTAG_TRIGGERNAME, &tnt,
|
if (!( hge(fi->h, RPMTAG_TRIGGERNAME, &tnt,
|
||||||
(void **) &triggerNames, &numTriggers) &&
|
(void **) &triggerNames, &numTriggers) &&
|
||||||
hge(fi->h, RPMTAG_TRIGGERINDEX, &tit,
|
hge(fi->h, RPMTAG_TRIGGERINDEX, &tit,
|
||||||
(void **) &triggerIndices, &numTriggerIndices))
|
(void **) &triggerIndices, &numTriggerIndices))
|
||||||
)
|
)
|
||||||
return 0;
|
return rc;
|
||||||
|
|
||||||
triggersRun = alloca(sizeof(*triggersRun) * numTriggerIndices);
|
triggersRun = alloca(sizeof(*triggersRun) * numTriggerIndices);
|
||||||
memset(triggersRun, 0, sizeof(*triggersRun) * numTriggerIndices);
|
memset(triggersRun, 0, sizeof(*triggersRun) * numTriggerIndices);
|
||||||
|
@ -1571,7 +1582,7 @@ rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
|
||||||
* on install with -v.
|
* on install with -v.
|
||||||
*/
|
*/
|
||||||
/*@-bounds -nullpass@*/ /* FIX: testing null annotation for fi->h */
|
/*@-bounds -nullpass@*/ /* FIX: testing null annotation for fi->h */
|
||||||
int rpmpsmStage(rpmpsm psm, pkgStage stage)
|
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
|
||||||
{
|
{
|
||||||
const rpmts ts = psm->ts;
|
const rpmts ts = psm->ts;
|
||||||
rpmfi fi = psm->fi;
|
rpmfi fi = psm->fi;
|
||||||
|
@ -1642,8 +1653,8 @@ assert(psm->mi == NULL);
|
||||||
* need the leading / stripped.
|
* need the leading / stripped.
|
||||||
*/
|
*/
|
||||||
{ const char * p;
|
{ const char * p;
|
||||||
rc = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &p, NULL);
|
xx = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &p, NULL);
|
||||||
fi->striplen = (rc ? strlen(p) + 1 : 1);
|
fi->striplen = (xx ? strlen(p) + 1 : 1);
|
||||||
}
|
}
|
||||||
fi->mapflags =
|
fi->mapflags =
|
||||||
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||||
|
@ -1670,7 +1681,7 @@ assert(psm->mi == NULL);
|
||||||
|
|
||||||
/* Retrieve installed header. */
|
/* Retrieve installed header. */
|
||||||
rc = rpmpsmStage(psm, PSM_RPMDB_LOAD);
|
rc = rpmpsmStage(psm, PSM_RPMDB_LOAD);
|
||||||
if (rc == 0)
|
if (rc == RPMRC_OK)
|
||||||
if (psm->te)
|
if (psm->te)
|
||||||
psm->te->h = headerLink(fi->h);
|
psm->te->h = headerLink(fi->h);
|
||||||
}
|
}
|
||||||
|
@ -1710,7 +1721,7 @@ psm->te->h = headerLink(fi->h);
|
||||||
|
|
||||||
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRE)) {
|
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRE)) {
|
||||||
rc = rpmpsmStage(psm, PSM_SCRIPT);
|
rc = rpmpsmStage(psm, PSM_SCRIPT);
|
||||||
if (rc) {
|
if (rc != RPMRC_OK) {
|
||||||
rpmError(RPMERR_SCRIPT,
|
rpmError(RPMERR_SCRIPT,
|
||||||
_("%s: %s scriptlet failed (%d), skipping %s\n"),
|
_("%s: %s scriptlet failed (%d), skipping %s\n"),
|
||||||
psm->stepName, tag2sln(psm->scriptTag), rc,
|
psm->stepName, tag2sln(psm->scriptTag), rc,
|
||||||
|
@ -1808,10 +1819,9 @@ psm->te->h = headerLink(fi->h);
|
||||||
strncpy(lead.name, rpmteNEVR(psm->te), sizeof(lead.name));
|
strncpy(lead.name, rpmteNEVR(psm->te), sizeof(lead.name));
|
||||||
|
|
||||||
rc = writeLead(psm->fd, &lead);
|
rc = writeLead(psm->fd, &lead);
|
||||||
if (rc) {
|
if (rc != RPMRC_OK) {
|
||||||
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
|
rpmError(RPMERR_NOSPACE, _("Unable to write package: %s\n"),
|
||||||
Fstrerror(psm->fd));
|
Fstrerror(psm->fd));
|
||||||
rc = RPMRC_FAIL;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
|
||||||
* @param stage next stage
|
* @param stage next stage
|
||||||
* @return 0 on success
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
int rpmpsmStage(rpmpsm psm, pkgStage stage)
|
rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
|
/*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/;
|
||||||
|
|
||||||
|
|
27
lib/query.c
27
lib/query.c
|
@ -573,25 +573,32 @@ restart:
|
||||||
|
|
||||||
(void) Fclose(fd);
|
(void) Fclose(fd);
|
||||||
|
|
||||||
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_NOTFOUND)) {
|
res = 0;
|
||||||
|
switch (rpmrc) {
|
||||||
|
default:
|
||||||
rpmError(RPMERR_QUERY, _("query of %s failed\n"), fileURL);
|
rpmError(RPMERR_QUERY, _("query of %s failed\n"), fileURL);
|
||||||
res = 1;
|
res = 1;
|
||||||
/*@loopbreak@*/ break;
|
/*@switchbreak@*/ break;
|
||||||
}
|
case RPMRC_OK:
|
||||||
if (rpmrc == RPMRC_OK && h == NULL) {
|
if (h == NULL) {
|
||||||
rpmError(RPMERR_QUERY,
|
rpmError(RPMERR_QUERY,
|
||||||
_("old format source packages cannot be queried\n"));
|
_("old format source packages cannot be queried\n"));
|
||||||
res = 1;
|
res = 1;
|
||||||
/*@loopbreak@*/ break;
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Query a package file. */
|
/* Query a package file. */
|
||||||
if (rpmrc == RPMRC_OK) {
|
|
||||||
res = qva->qva_showPackage(qva, ts, h);
|
res = qva->qva_showPackage(qva, ts, h);
|
||||||
h = headerFree(h);
|
h = headerFree(h);
|
||||||
rpmtsEmpty(ts);
|
rpmtsEmpty(ts);
|
||||||
continue;
|
continue;
|
||||||
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
|
case RPMRC_NOTFOUND:
|
||||||
|
res = 0;
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
if (res)
|
||||||
|
/*@loopbreak@*/ break;
|
||||||
|
|
||||||
/* Try to read a package manifest. */
|
/* Try to read a package manifest. */
|
||||||
fd = Fopen(fileURL, "r.fpio");
|
fd = Fopen(fileURL, "r.fpio");
|
||||||
|
|
|
@ -204,7 +204,8 @@ static int rpmReSign(/*@unused@*/ rpmts ts,
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
memset(l, 0, sizeof(*l));
|
memset(l, 0, sizeof(*l));
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
if (readLead(fd, l)) {
|
rc = readLead(fd, l);
|
||||||
|
if (rc != RPMRC_OK) {
|
||||||
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), rpm);
|
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), rpm);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -222,13 +223,17 @@ static int rpmReSign(/*@unused@*/ rpmts ts,
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
||||||
if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE)) {
|
switch (rc) {
|
||||||
|
default:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), rpm);
|
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), rpm);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
if (sigh == NULL) {
|
case RPMRC_OK:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), rpm);
|
if (sigh == NULL) {
|
||||||
goto exit;
|
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), rpm);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the header and archive to a temp file */
|
/* Write the header and archive to a temp file */
|
||||||
|
@ -343,7 +348,8 @@ static int rpmReSign(/*@unused@*/ rpmts ts,
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
l->signature_type = RPMSIGTYPE_HEADERSIG;
|
l->signature_type = RPMSIGTYPE_HEADERSIG;
|
||||||
if (writeLead(ofd, l)) {
|
rc = writeLead(ofd, l);
|
||||||
|
if (rc != RPMRC_OK) {
|
||||||
rpmError(RPMERR_WRITELEAD, _("%s: writeLead failed: %s\n"), trpm,
|
rpmError(RPMERR_WRITELEAD, _("%s: writeLead failed: %s\n"), trpm,
|
||||||
Fstrerror(ofd));
|
Fstrerror(ofd));
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -687,7 +693,8 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
memset(l, 0, sizeof(*l));
|
memset(l, 0, sizeof(*l));
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
if (readLead(fd, l)) {
|
rc = readLead(fd, l);
|
||||||
|
if (rc != RPMRC_OK) {
|
||||||
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), fn);
|
rpmError(RPMERR_READLEAD, _("%s: not an rpm package\n"), fn);
|
||||||
res++;
|
res++;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
@ -703,15 +710,19 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
rc = rpmReadSignature(fd, &sigh, l->signature_type);
|
||||||
if (!(rc == RPMRC_OK || rc == RPMRC_BADSIZE)) {
|
switch (rc) {
|
||||||
|
default:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), fn);
|
rpmError(RPMERR_SIGGEN, _("%s: rpmReadSignature failed\n"), fn);
|
||||||
res++;
|
res++;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
if (sigh == NULL) {
|
case RPMRC_OK:
|
||||||
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
|
if (sigh == NULL) {
|
||||||
res++;
|
rpmError(RPMERR_SIGGEN, _("%s: No signature available\n"), fn);
|
||||||
goto exit;
|
res++;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab a hint of what needs doing to avoid duplication. */
|
/* Grab a hint of what needs doing to avoid duplication. */
|
||||||
|
@ -844,10 +855,10 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
|
||||||
case RPMSIGTAG_PGP5: /* XXX legacy */
|
case RPMSIGTAG_PGP5: /* XXX legacy */
|
||||||
case RPMSIGTAG_PGP:
|
case RPMSIGTAG_PGP:
|
||||||
switch (res3) {
|
switch (res3) {
|
||||||
case RPMSIG_NOKEY:
|
case RPMRC_NOKEY:
|
||||||
res2 = 1;
|
res2 = 1;
|
||||||
/*@fallthrough@*/
|
/*@fallthrough@*/
|
||||||
case RPMSIG_NOTTRUSTED:
|
case RPMRC_NOTTRUSTED:
|
||||||
{ int offset = 6;
|
{ int offset = 6;
|
||||||
b = stpcpy(b, "(MD5) (PGP) ");
|
b = stpcpy(b, "(MD5) (PGP) ");
|
||||||
tempKey = strstr(result, "ey ID");
|
tempKey = strstr(result, "ey ID");
|
||||||
|
@ -856,7 +867,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
|
||||||
offset = 9;
|
offset = 9;
|
||||||
}
|
}
|
||||||
if (tempKey) {
|
if (tempKey) {
|
||||||
if (res3 == RPMSIG_NOKEY) {
|
if (res3 == RPMRC_NOKEY) {
|
||||||
m = stpcpy(m, " PGP#");
|
m = stpcpy(m, " PGP#");
|
||||||
m = stpncpy(m, tempKey + offset, 8);
|
m = stpncpy(m, tempKey + offset, 8);
|
||||||
*m = '\0';
|
*m = '\0';
|
||||||
|
@ -880,7 +891,7 @@ int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
|
||||||
case RPMSIGTAG_GPG:
|
case RPMSIGTAG_GPG:
|
||||||
/* Do not consider this a failure */
|
/* Do not consider this a failure */
|
||||||
switch (res3) {
|
switch (res3) {
|
||||||
case RPMSIG_NOKEY:
|
case RPMRC_NOKEY:
|
||||||
b = stpcpy(b, "(GPG) ");
|
b = stpcpy(b, "(GPG) ");
|
||||||
m = stpcpy(m, " GPG#");
|
m = stpcpy(m, " GPG#");
|
||||||
tempKey = strstr(result, "ey ID");
|
tempKey = strstr(result, "ey ID");
|
||||||
|
|
194
lib/rpminstall.c
194
lib/rpminstall.c
|
@ -463,20 +463,26 @@ if (fileURL[0] == '=') {
|
||||||
tvsflags = rpmtsSetVSFlags(ts, vsflags);
|
tvsflags = rpmtsSetVSFlags(ts, vsflags);
|
||||||
eiu->rpmrc = rpmReadPackageFile(ts, eiu->fd, *eiu->fnp, &eiu->h);
|
eiu->rpmrc = rpmReadPackageFile(ts, eiu->fd, *eiu->fnp, &eiu->h);
|
||||||
tvsflags = rpmtsSetVSFlags(ts, tvsflags);
|
tvsflags = rpmtsSetVSFlags(ts, tvsflags);
|
||||||
|
|
||||||
eiu->isSource = headerIsEntry(eiu->h, RPMTAG_SOURCEPACKAGE);
|
|
||||||
|
|
||||||
xx = Fclose(eiu->fd);
|
xx = Fclose(eiu->fd);
|
||||||
eiu->fd = NULL;
|
eiu->fd = NULL;
|
||||||
|
|
||||||
if (eiu->rpmrc == RPMRC_FAIL || eiu->rpmrc == RPMRC_SHORTREAD) {
|
switch (eiu->rpmrc) {
|
||||||
|
case RPMRC_FAIL:
|
||||||
|
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *eiu->fnp);
|
||||||
eiu->numFailed++; *eiu->fnp = NULL;
|
eiu->numFailed++; *eiu->fnp = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
|
case RPMRC_NOTFOUND:
|
||||||
|
goto maybe_manifest;
|
||||||
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
|
case RPMRC_OK:
|
||||||
|
default:
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eiu->isSource &&
|
eiu->isSource = headerIsEntry(eiu->h, RPMTAG_SOURCEPACKAGE);
|
||||||
(eiu->rpmrc == RPMRC_OK || eiu->rpmrc == RPMRC_BADSIZE))
|
|
||||||
{
|
if (eiu->isSource) {
|
||||||
rpmMessage(RPMMESS_DEBUG, "\tadded source package [%d]\n",
|
rpmMessage(RPMMESS_DEBUG, "\tadded source package [%d]\n",
|
||||||
eiu->numSRPMS);
|
eiu->numSRPMS);
|
||||||
eiu->sourceURL = xrealloc(eiu->sourceURL,
|
eiu->sourceURL = xrealloc(eiu->sourceURL,
|
||||||
|
@ -488,95 +494,87 @@ if (fileURL[0] == '=') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eiu->rpmrc == RPMRC_OK || eiu->rpmrc == RPMRC_BADSIZE) {
|
if (eiu->relocations) {
|
||||||
|
const char ** paths;
|
||||||
|
int pft;
|
||||||
|
int c;
|
||||||
|
|
||||||
if (eiu->relocations) {
|
if (headerGetEntry(eiu->h, RPMTAG_PREFIXES, &pft,
|
||||||
const char ** paths;
|
|
||||||
int pft;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
if (headerGetEntry(eiu->h, RPMTAG_PREFIXES, &pft,
|
|
||||||
(void **) &paths, &c) && (c == 1))
|
(void **) &paths, &c) && (c == 1))
|
||||||
{
|
{
|
||||||
eiu->relocations->oldPath = xstrdup(paths[0]);
|
eiu->relocations->oldPath = xstrdup(paths[0]);
|
||||||
paths = headerFreeData(paths, pft);
|
paths = headerFreeData(paths, pft);
|
||||||
} else {
|
} else {
|
||||||
const char * name;
|
|
||||||
xx = headerNVR(eiu->h, &name, NULL, NULL);
|
|
||||||
rpmMessage(RPMMESS_ERROR,
|
|
||||||
_("package %s is not relocateable\n"), name);
|
|
||||||
eiu->numFailed++;
|
|
||||||
goto exit;
|
|
||||||
/*@notreached@*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On --freshen, verify package is installed and newer */
|
|
||||||
if (ia->installInterfaceFlags & INSTALL_FRESHEN) {
|
|
||||||
rpmdbMatchIterator mi;
|
|
||||||
const char * name;
|
const char * name;
|
||||||
Header oldH;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
xx = headerNVR(eiu->h, &name, NULL, NULL);
|
xx = headerNVR(eiu->h, &name, NULL, NULL);
|
||||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, name, 0);
|
rpmMessage(RPMMESS_ERROR,
|
||||||
count = rpmdbGetIteratorCount(mi);
|
_("package %s is not relocateable\n"), name);
|
||||||
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
|
eiu->numFailed++;
|
||||||
if (rpmVersionCompare(oldH, eiu->h) < 0)
|
goto exit;
|
||||||
/*@innercontinue@*/ continue;
|
/*@notreached@*/
|
||||||
/* same or newer package already installed */
|
|
||||||
count = 0;
|
|
||||||
/*@innerbreak@*/ break;
|
|
||||||
}
|
|
||||||
mi = rpmdbFreeIterator(mi);
|
|
||||||
if (count == 0) {
|
|
||||||
eiu->h = headerFree(eiu->h);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Package is newer than those currently installed. */
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*@-abstract@*/
|
/* On --freshen, verify package is installed and newer */
|
||||||
rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)fileName,
|
if (ia->installInterfaceFlags & INSTALL_FRESHEN) {
|
||||||
|
rpmdbMatchIterator mi;
|
||||||
|
const char * name;
|
||||||
|
Header oldH;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
xx = headerNVR(eiu->h, &name, NULL, NULL);
|
||||||
|
mi = rpmtsInitIterator(ts, RPMTAG_NAME, name, 0);
|
||||||
|
count = rpmdbGetIteratorCount(mi);
|
||||||
|
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
|
||||||
|
if (rpmVersionCompare(oldH, eiu->h) < 0)
|
||||||
|
/*@innercontinue@*/ continue;
|
||||||
|
/* same or newer package already installed */
|
||||||
|
count = 0;
|
||||||
|
/*@innerbreak@*/ break;
|
||||||
|
}
|
||||||
|
mi = rpmdbFreeIterator(mi);
|
||||||
|
if (count == 0) {
|
||||||
|
eiu->h = headerFree(eiu->h);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Package is newer than those currently installed. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@-abstract@*/
|
||||||
|
rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)fileName,
|
||||||
(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
|
(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
|
||||||
relocations);
|
relocations);
|
||||||
/*@=abstract@*/
|
/*@=abstract@*/
|
||||||
|
|
||||||
/* XXX reference held by transaction set */
|
/* XXX reference held by transaction set */
|
||||||
eiu->h = headerFree(eiu->h);
|
eiu->h = headerFree(eiu->h);
|
||||||
if (eiu->relocations)
|
if (eiu->relocations)
|
||||||
eiu->relocations->oldPath = _free(eiu->relocations->oldPath);
|
eiu->relocations->oldPath = _free(eiu->relocations->oldPath);
|
||||||
|
|
||||||
switch(rc) {
|
switch(rc) {
|
||||||
case 0:
|
case 0:
|
||||||
rpmMessage(RPMMESS_DEBUG, "\tadded binary package [%d]\n",
|
rpmMessage(RPMMESS_DEBUG, "\tadded binary package [%d]\n",
|
||||||
eiu->numRPMS);
|
eiu->numRPMS);
|
||||||
/*@switchbreak@*/ break;
|
/*@switchbreak@*/ break;
|
||||||
case 1:
|
case 1:
|
||||||
rpmMessage(RPMMESS_ERROR,
|
rpmMessage(RPMMESS_ERROR,
|
||||||
_("error reading from file %s\n"), *eiu->fnp);
|
_("error reading from file %s\n"), *eiu->fnp);
|
||||||
eiu->numFailed++;
|
eiu->numFailed++;
|
||||||
goto exit;
|
goto exit;
|
||||||
/*@notreached@*/ /*@switchbreak@*/ break;
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
case 2:
|
case 2:
|
||||||
rpmMessage(RPMMESS_ERROR,
|
rpmMessage(RPMMESS_ERROR,
|
||||||
_("file %s requires a newer version of RPM\n"),
|
_("file %s requires a newer version of RPM\n"),
|
||||||
*eiu->fnp);
|
*eiu->fnp);
|
||||||
eiu->numFailed++;
|
eiu->numFailed++;
|
||||||
goto exit;
|
goto exit;
|
||||||
/*@notreached@*/ /*@switchbreak@*/ break;
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
}
|
|
||||||
|
|
||||||
eiu->numRPMS++;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eiu->rpmrc != RPMRC_NOTFOUND) {
|
eiu->numRPMS++;
|
||||||
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *eiu->fnp);
|
continue;
|
||||||
eiu->numFailed++; *eiu->fnp = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
maybe_manifest:
|
||||||
/* Try to read a package manifest. */
|
/* Try to read a package manifest. */
|
||||||
eiu->fd = Fopen(*eiu->fnp, "r.fpio");
|
eiu->fd = Fopen(*eiu->fnp, "r.fpio");
|
||||||
if (eiu->fd == NULL || Ferror(eiu->fd)) {
|
if (eiu->fd == NULL || Ferror(eiu->fd)) {
|
||||||
|
@ -599,7 +597,7 @@ if (fileURL[0] == '=') {
|
||||||
eiu->fd = NULL;
|
eiu->fd = NULL;
|
||||||
|
|
||||||
/* If successful, restart the query loop. */
|
/* If successful, restart the query loop. */
|
||||||
if (rc == 0) {
|
if (rc == RPMRC_OK) {
|
||||||
eiu->prevx++;
|
eiu->prevx++;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
@ -971,19 +969,18 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
|
||||||
FD_t fd;
|
FD_t fd;
|
||||||
const char ** av = NULL;
|
const char ** av = NULL;
|
||||||
int ac = 0;
|
int ac = 0;
|
||||||
int rc;
|
rpmRC rpmrc;
|
||||||
int xx;
|
int xx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
av = NULL; ac = 0;
|
av = NULL; ac = 0;
|
||||||
rc = rpmGlob(globstr, &ac, &av);
|
xx = rpmGlob(globstr, &ac, &av);
|
||||||
|
|
||||||
if (rc == 0)
|
if (xx == 0)
|
||||||
for (i = 0; i < ac; i++) {
|
for (i = 0; i < ac; i++) {
|
||||||
rpmTagType type;
|
rpmTagType type;
|
||||||
int_32 count;
|
int_32 count;
|
||||||
int isSource;
|
int isSource;
|
||||||
rpmRC rpmrc;
|
|
||||||
|
|
||||||
fd = Fopen(av[i], "r.ufdio");
|
fd = Fopen(av[i], "r.ufdio");
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
|
@ -993,13 +990,17 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
xx = rpmReadPackageFile(ts, fd, av[i], &h);
|
rpmrc = rpmReadPackageFile(ts, fd, av[i], &h);
|
||||||
rpmrc = (xx ? RPMRC_FAIL : RPMRC_OK); /* XXX HACK */
|
(void) Fclose(fd);
|
||||||
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
|
switch (rpmrc) {
|
||||||
|
default:
|
||||||
if (rpmrc != RPMRC_OK || isSource) {
|
goto bottom;
|
||||||
(void) Fclose(fd);
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
continue;
|
case RPMRC_OK:
|
||||||
|
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
|
||||||
|
if (isSource)
|
||||||
|
goto bottom;
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tidp = NULL;
|
tidp = NULL;
|
||||||
|
@ -1007,11 +1008,9 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
|
||||||
if (hge(h, tag, &type, (void **) &tidp, &count) && tidp) {
|
if (hge(h, tag, &type, (void **) &tidp, &count) && tidp) {
|
||||||
|
|
||||||
idtx = IDTXgrow(idtx, 1);
|
idtx = IDTXgrow(idtx, 1);
|
||||||
if (idtx == NULL || idtx->idt == NULL) {
|
if (idtx == NULL || idtx->idt == NULL)
|
||||||
h = headerFree(h);
|
goto bottom;
|
||||||
(void) Fclose(fd);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
{ IDT idt;
|
{ IDT idt;
|
||||||
idt = idtx->idt + idtx->nidt;
|
idt = idtx->idt + idtx->nidt;
|
||||||
idt->h = headerLink(h);
|
idt->h = headerLink(h);
|
||||||
|
@ -1023,9 +1022,8 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
|
||||||
idtx->nidt++;
|
idtx->nidt++;
|
||||||
}
|
}
|
||||||
/*@=branchstate@*/
|
/*@=branchstate@*/
|
||||||
|
bottom:
|
||||||
h = headerFree(h);
|
h = headerFree(h);
|
||||||
(void) Fclose(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ac; i++)
|
for (i = 0; i < ac; i++)
|
||||||
|
|
|
@ -22,7 +22,7 @@ static unsigned char lead_magic[] = {
|
||||||
|
|
||||||
/* The lead needs to be 8 byte aligned */
|
/* The lead needs to be 8 byte aligned */
|
||||||
|
|
||||||
int writeLead(FD_t fd, const struct rpmlead *lead)
|
rpmRC writeLead(FD_t fd, const struct rpmlead *lead)
|
||||||
{
|
{
|
||||||
struct rpmlead l;
|
struct rpmlead l;
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ int writeLead(FD_t fd, const struct rpmlead *lead)
|
||||||
|
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
if (Fwrite(&l, 1, sizeof(l), fd) != sizeof(l))
|
if (Fwrite(&l, 1, sizeof(l), fd) != sizeof(l))
|
||||||
return 1;
|
return RPMRC_FAIL;
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
|
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readLead(FD_t fd, struct rpmlead *lead)
|
rpmRC readLead(FD_t fd, struct rpmlead *lead)
|
||||||
{
|
{
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
memset(lead, 0, sizeof(*lead));
|
memset(lead, 0, sizeof(*lead));
|
||||||
|
@ -53,12 +53,12 @@ int readLead(FD_t fd, struct rpmlead *lead)
|
||||||
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
|
if (timedRead(fd, (char *)lead, sizeof(*lead)) != sizeof(*lead)) {
|
||||||
rpmError(RPMERR_READ, _("read failed: %s (%d)\n"), Fstrerror(fd),
|
rpmError(RPMERR_READ, _("read failed: %s (%d)\n"), Fstrerror(fd),
|
||||||
errno);
|
errno);
|
||||||
return 1;
|
return RPMRC_FAIL;
|
||||||
}
|
}
|
||||||
/*@=type@*/
|
/*@=type@*/
|
||||||
|
|
||||||
if (memcmp(lead->magic, lead_magic, sizeof(lead_magic)))
|
if (memcmp(lead->magic, lead_magic, sizeof(lead_magic)))
|
||||||
return 1;
|
return RPMRC_FAIL;
|
||||||
|
|
||||||
lead->type = ntohs(lead->type);
|
lead->type = ntohs(lead->type);
|
||||||
lead->archnum = ntohs(lead->archnum);
|
lead->archnum = ntohs(lead->archnum);
|
||||||
|
@ -67,5 +67,5 @@ int readLead(FD_t fd, struct rpmlead *lead)
|
||||||
if (lead->major >= 2)
|
if (lead->major >= 2)
|
||||||
lead->signature_type = ntohs(lead->signature_type);
|
lead->signature_type = ntohs(lead->signature_type);
|
||||||
|
|
||||||
return 0;
|
return RPMRC_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,9 @@ extern "C" {
|
||||||
* Write lead to file handle.
|
* Write lead to file handle.
|
||||||
* @param fd file handle
|
* @param fd file handle
|
||||||
* @param lead data address
|
* @param lead data address
|
||||||
* @return 0 on success, 1 on error
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
int writeLead(FD_t fd, const struct rpmlead *lead)
|
rpmRC writeLead(FD_t fd, const struct rpmlead *lead)
|
||||||
/*@globals fileSystem @*/
|
/*@globals fileSystem @*/
|
||||||
/*@modifies fd, fileSystem @*/;
|
/*@modifies fd, fileSystem @*/;
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ int writeLead(FD_t fd, const struct rpmlead *lead)
|
||||||
* Read lead from file handle.
|
* Read lead from file handle.
|
||||||
* @param fd file handle
|
* @param fd file handle
|
||||||
* @retval lead data address
|
* @retval lead data address
|
||||||
* @return 0 on success, 1 on error
|
* @return 0 on success
|
||||||
*/
|
*/
|
||||||
int readLead(FD_t fd, /*@out@*/ struct rpmlead *lead)
|
rpmRC readLead(FD_t fd, /*@out@*/ struct rpmlead *lead)
|
||||||
/*@modifies fd, *lead @*/;
|
/*@modifies fd, *lead @*/;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
17
lib/rpmlib.h
17
lib/rpmlib.h
|
@ -18,8 +18,8 @@ typedef enum rpmRC_e {
|
||||||
RPMRC_OK = 0, /*!< Generic success code */
|
RPMRC_OK = 0, /*!< Generic success code */
|
||||||
RPMRC_NOTFOUND = 1, /*!< Generic not found code. */
|
RPMRC_NOTFOUND = 1, /*!< Generic not found code. */
|
||||||
RPMRC_FAIL = 2, /*!< Generic failure code. */
|
RPMRC_FAIL = 2, /*!< Generic failure code. */
|
||||||
RPMRC_BADSIZE = 3,
|
RPMRC_NOTTRUSTED = 3, /*!< Signature is OK, but key is not trusted. */
|
||||||
RPMRC_SHORTREAD = 4
|
RPMRC_NOKEY = 4 /*!< Public key is unavailable. */
|
||||||
} rpmRC;
|
} rpmRC;
|
||||||
|
|
||||||
/*@-redecl@*/
|
/*@-redecl@*/
|
||||||
|
@ -1129,17 +1129,6 @@ enum rpmtagSignature {
|
||||||
RPMSIGTAG_RSA = RPMTAG_RSAHEADER /*!< internal RSA header signature. */
|
RPMSIGTAG_RSA = RPMTAG_RSAHEADER /*!< internal RSA header signature. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Return codes from verifySignature().
|
|
||||||
*/
|
|
||||||
typedef enum rpmVerifySignatureReturn_e {
|
|
||||||
RPMSIG_OK = 0, /*!< Signature is OK. */
|
|
||||||
RPMSIG_UNKNOWN = 1, /*!< Signature is unknown. */
|
|
||||||
RPMSIG_BAD = 2, /*!< Signature does not verify. */
|
|
||||||
RPMSIG_NOKEY = 3, /*!< Key is unavailable. */
|
|
||||||
RPMSIG_NOTTRUSTED = 4 /*!< Signature is OK, but key is not trusted. */
|
|
||||||
} rpmVerifySignatureReturn;
|
|
||||||
|
|
||||||
/** \ingroup signature
|
/** \ingroup signature
|
||||||
* Verify a signature from a package.
|
* Verify a signature from a package.
|
||||||
*
|
*
|
||||||
|
@ -1153,7 +1142,7 @@ typedef enum rpmVerifySignatureReturn_e {
|
||||||
* @retval result detailed text result of signature verification
|
* @retval result detailed text result of signature verification
|
||||||
* @return result of signature verification
|
* @return result of signature verification
|
||||||
*/
|
*/
|
||||||
rpmVerifySignatureReturn rpmVerifySignature(const rpmts ts,
|
rpmRC rpmVerifySignature(const rpmts ts,
|
||||||
/*@out@*/ char * result)
|
/*@out@*/ char * result)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
/*@modifies ts, *result, rpmGlobalMacroContext,
|
/*@modifies ts, *result, rpmGlobalMacroContext,
|
||||||
|
|
29
lib/rpmts.c
29
lib/rpmts.c
|
@ -170,17 +170,17 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
rpmRC rpmtsFindPubkey(rpmts ts)
|
||||||
{
|
{
|
||||||
const void * sig = rpmtsSig(ts);
|
const void * sig = rpmtsSig(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
pgpDigParams sigp = rpmtsSignature(ts);
|
pgpDigParams sigp = rpmtsSignature(ts);
|
||||||
pgpDigParams pubp = rpmtsSignature(ts);
|
pgpDigParams pubp = rpmtsSignature(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
int xx;
|
int xx;
|
||||||
|
|
||||||
if (sig == NULL || dig == NULL || sigp == NULL || pubp == NULL) {
|
if (sig == NULL || dig == NULL || sigp == NULL || pubp == NULL) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
||||||
|
|
||||||
/* Was a matching pubkey found? */
|
/* Was a matching pubkey found? */
|
||||||
if (ix < 0 || ts->pkpkt == NULL) {
|
if (ix < 0 || ts->pkpkt == NULL) {
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
||||||
{
|
{
|
||||||
ts->pkpkt = _free(ts->pkpkt);
|
ts->pkpkt = _free(ts->pkpkt);
|
||||||
ts->pkpktlen = 0;
|
ts->pkpktlen = 0;
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
||||||
const char * pkfn = rpmExpand("%{_gpg_pubkey}", NULL);
|
const char * pkfn = rpmExpand("%{_gpg_pubkey}", NULL);
|
||||||
if (pgpReadPkts(pkfn, &ts->pkpkt, &ts->pkpktlen) != PGPARMOR_PUBKEY) {
|
if (pgpReadPkts(pkfn, &ts->pkpkt, &ts->pkpktlen) != PGPARMOR_PUBKEY) {
|
||||||
pkfn = _free(pkfn);
|
pkfn = _free(pkfn);
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
pkfn = _free(pkfn);
|
pkfn = _free(pkfn);
|
||||||
|
@ -274,9 +274,9 @@ rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
||||||
&& sigp->hash_algo == pubp->hash_algo
|
&& sigp->hash_algo == pubp->hash_algo
|
||||||
#endif
|
#endif
|
||||||
&& !memcmp(sigp->signid, pubp->signid, sizeof(sigp->signid)) )
|
&& !memcmp(sigp->signid, pubp->signid, sizeof(sigp->signid)) )
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
else
|
else
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
|
|
||||||
/* XXX Verify the signature signature. */
|
/* XXX Verify the signature signature. */
|
||||||
|
|
||||||
|
@ -449,17 +449,22 @@ int rpmtsSolve(rpmts ts, rpmds ds, /*@unused@*/ const void * data)
|
||||||
}
|
}
|
||||||
rpmrc = rpmReadPackageFile(ts, fd, str, &h);
|
rpmrc = rpmReadPackageFile(ts, fd, str, &h);
|
||||||
xx = Fclose(fd);
|
xx = Fclose(fd);
|
||||||
if (rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE) {
|
switch (rpmrc) {
|
||||||
|
default:
|
||||||
|
str = _free(str);
|
||||||
|
break;
|
||||||
|
case RPMRC_OK:
|
||||||
if (h != NULL &&
|
if (h != NULL &&
|
||||||
!rpmtsAddInstallElement(ts, h, (fnpyKey)str, 1, NULL))
|
!rpmtsAddInstallElement(ts, h, (fnpyKey)str, 1, NULL))
|
||||||
{
|
{
|
||||||
rpmMessage(RPMMESS_DEBUG, _("Adding: %s\n"), str);
|
rpmMessage(RPMMESS_DEBUG, _("Adding: %s\n"), str);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
/* XXX str memory leak */
|
/* XXX str memory leak */
|
||||||
} else
|
break;
|
||||||
str = _free(str);
|
}
|
||||||
} else
|
|
||||||
str = _free(str);
|
str = _free(str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
h = headerFree(h);
|
h = headerFree(h);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,9 +344,9 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
||||||
/**
|
/**
|
||||||
* Retrieve pubkey from rpm database.
|
* Retrieve pubkey from rpm database.
|
||||||
* @param ts rpm transaction
|
* @param ts rpm transaction
|
||||||
* @return RPMSIG_OK on success, RPMSIG_NOKEY if not found
|
* @return RPMRC_OK on success, RPMRC_NOKEY if not found
|
||||||
*/
|
*/
|
||||||
rpmVerifySignatureReturn rpmtsFindPubkey(rpmts ts)
|
rpmRC rpmtsFindPubkey(rpmts ts)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
|
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */;
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ static inline rpmRC checkSize(FD_t fd, int siglen, int pad, int datalen)
|
||||||
rc = RPMRC_OK;
|
rc = RPMRC_OK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rc = RPMRC_BADSIZE;
|
rc = RPMRC_OK; /* XXX repackaging destroys size checks */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
|
||||||
/*@=boundsread@*/
|
/*@=boundsread@*/
|
||||||
}
|
}
|
||||||
if (pad && timedRead(fd, buf, pad) != pad)
|
if (pad && timedRead(fd, buf, pad) != pad)
|
||||||
rc = RPMRC_SHORTREAD;
|
rc = RPMRC_FAIL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -846,37 +846,36 @@ char * rpmGetPassPhrase(const char * prompt, const int sigTag)
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
static /*@observer@*/ const char * rpmSigString(rpmVerifySignatureReturn res)
|
static /*@observer@*/ const char * rpmSigString(rpmRC res)
|
||||||
/*@*/
|
/*@*/
|
||||||
{
|
{
|
||||||
const char * str;
|
const char * str;
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case RPMSIG_OK: str = "OK"; break;
|
case RPMRC_OK: str = "OK"; break;
|
||||||
case RPMSIG_BAD: str = "BAD"; break;
|
case RPMRC_FAIL: str = "BAD"; break;
|
||||||
case RPMSIG_NOKEY: str = "NOKEY"; break;
|
case RPMRC_NOKEY: str = "NOKEY"; break;
|
||||||
case RPMSIG_NOTTRUSTED: str = "NOTRUSTED"; break;
|
case RPMRC_NOTTRUSTED: str = "NOTRUSTED"; break;
|
||||||
default:
|
default:
|
||||||
case RPMSIG_UNKNOWN: str = "UNKNOWN"; break;
|
case RPMRC_NOTFOUND: str = "UNKNOWN"; break;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
static rpmVerifySignatureReturn
|
static rpmRC
|
||||||
verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
|
verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
|
||||||
/*@modifies *t @*/
|
/*@modifies *t @*/
|
||||||
{
|
{
|
||||||
const void * sig = rpmtsSig(ts);
|
const void * sig = rpmtsSig(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
int_32 size = 0x7fffffff;
|
int_32 size = 0x7fffffff;
|
||||||
|
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
t = stpcpy(t, _("Header+Payload size: "));
|
t = stpcpy(t, _("Header+Payload size: "));
|
||||||
|
|
||||||
if (sig == NULL || dig == NULL || dig->nbytes == 0) {
|
if (sig == NULL || dig == NULL || dig->nbytes == 0) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
res = RPMSIG_NOKEY;
|
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -884,11 +883,11 @@ verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
|
||||||
memcpy(&size, sig, sizeof(size));
|
memcpy(&size, sig, sizeof(size));
|
||||||
|
|
||||||
if (size != dig->nbytes) {
|
if (size != dig->nbytes) {
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
sprintf(t, " Expected(%d) != (%d)\n", size, dig->nbytes);
|
sprintf(t, " Expected(%d) != (%d)\n", size, dig->nbytes);
|
||||||
} else {
|
} else {
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
sprintf(t, " (%d)", dig->nbytes);
|
sprintf(t, " (%d)", dig->nbytes);
|
||||||
}
|
}
|
||||||
|
@ -900,7 +899,7 @@ exit:
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
|
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
static rpmVerifySignatureReturn
|
static rpmRC
|
||||||
verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
|
verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
/*@null@*/ DIGEST_CTX md5ctx)
|
/*@null@*/ DIGEST_CTX md5ctx)
|
||||||
/*@modifies *t @*/
|
/*@modifies *t @*/
|
||||||
|
@ -908,7 +907,7 @@ verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
const void * sig = rpmtsSig(ts);
|
const void * sig = rpmtsSig(ts);
|
||||||
int_32 siglen = rpmtsSiglen(ts);
|
int_32 siglen = rpmtsSiglen(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
byte * md5sum = NULL;
|
byte * md5sum = NULL;
|
||||||
size_t md5len = 0;
|
size_t md5len = 0;
|
||||||
|
|
||||||
|
@ -916,7 +915,7 @@ verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
t = stpcpy(t, _("MD5 digest: "));
|
t = stpcpy(t, _("MD5 digest: "));
|
||||||
|
|
||||||
if (md5ctx == NULL || sig == NULL || dig == NULL) {
|
if (md5ctx == NULL || sig == NULL || dig == NULL) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -925,14 +924,14 @@ verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
(void **)&md5sum, &md5len, 0);
|
(void **)&md5sum, &md5len, 0);
|
||||||
|
|
||||||
if (md5len != siglen || memcmp(md5sum, sig, md5len)) {
|
if (md5len != siglen || memcmp(md5sum, sig, md5len)) {
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
t = stpcpy(t, " Expected(");
|
t = stpcpy(t, " Expected(");
|
||||||
(void) pgpHexCvt(t, sig, siglen);
|
(void) pgpHexCvt(t, sig, siglen);
|
||||||
t += strlen(t);
|
t += strlen(t);
|
||||||
t = stpcpy(t, ") != (");
|
t = stpcpy(t, ") != (");
|
||||||
} else {
|
} else {
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
t = stpcpy(t, " (");
|
t = stpcpy(t, " (");
|
||||||
}
|
}
|
||||||
|
@ -953,9 +952,9 @@ exit:
|
||||||
* @param ts transaction set
|
* @param ts transaction set
|
||||||
* @retval t verbose success/failure text
|
* @retval t verbose success/failure text
|
||||||
* @param sha1ctx
|
* @param sha1ctx
|
||||||
* @return RPMSIG_OK on success
|
* @return RPMRC_OK on success
|
||||||
*/
|
*/
|
||||||
static rpmVerifySignatureReturn
|
static rpmRC
|
||||||
verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
|
verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
/*@null@*/ DIGEST_CTX sha1ctx)
|
/*@null@*/ DIGEST_CTX sha1ctx)
|
||||||
/*@modifies *t @*/
|
/*@modifies *t @*/
|
||||||
|
@ -965,14 +964,14 @@ verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
int_32 siglen = rpmtsSiglen(ts);
|
int_32 siglen = rpmtsSiglen(ts);
|
||||||
#endif
|
#endif
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
const char * SHA1 = NULL;
|
const char * SHA1 = NULL;
|
||||||
|
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
t = stpcpy(t, _("Header SHA1 digest: "));
|
t = stpcpy(t, _("Header SHA1 digest: "));
|
||||||
|
|
||||||
if (sha1ctx == NULL || sig == NULL || dig == NULL) {
|
if (sha1ctx == NULL || sig == NULL || dig == NULL) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -981,13 +980,13 @@ verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
|
||||||
(void **)&SHA1, NULL, 1);
|
(void **)&SHA1, NULL, 1);
|
||||||
|
|
||||||
if (SHA1 == NULL || strlen(SHA1) != strlen(sig) || strcmp(SHA1, sig)) {
|
if (SHA1 == NULL || strlen(SHA1) != strlen(sig) || strcmp(SHA1, sig)) {
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
t = stpcpy(t, " Expected(");
|
t = stpcpy(t, " Expected(");
|
||||||
t = stpcpy(t, sig);
|
t = stpcpy(t, sig);
|
||||||
t = stpcpy(t, ") != (");
|
t = stpcpy(t, ") != (");
|
||||||
} else {
|
} else {
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
t = stpcpy(t, " (");
|
t = stpcpy(t, " (");
|
||||||
}
|
}
|
||||||
|
@ -1025,9 +1024,9 @@ static inline unsigned char nibble(char c)
|
||||||
* @param ts transaction set
|
* @param ts transaction set
|
||||||
* @retval t verbose success/failure text
|
* @retval t verbose success/failure text
|
||||||
* @param md5ctx
|
* @param md5ctx
|
||||||
* @return RPMSIG_OK on success
|
* @return RPMRC_OK on success
|
||||||
*/
|
*/
|
||||||
static rpmVerifySignatureReturn
|
static rpmRC
|
||||||
verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
/*@null@*/ DIGEST_CTX md5ctx)
|
/*@null@*/ DIGEST_CTX md5ctx)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
|
@ -1040,14 +1039,14 @@ verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
int_32 sigtag = rpmtsSigtag(ts);
|
int_32 sigtag = rpmtsSigtag(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
pgpDigParams sigp = rpmtsSignature(ts);
|
pgpDigParams sigp = rpmtsSignature(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
int xx;
|
int xx;
|
||||||
|
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
t = stpcpy(t, _("V3 RSA/MD5 signature: "));
|
t = stpcpy(t, _("V3 RSA/MD5 signature: "));
|
||||||
|
|
||||||
if (md5ctx == NULL || sig == NULL || dig == NULL || sigp == NULL) {
|
if (md5ctx == NULL || sig == NULL || dig == NULL || sigp == NULL) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,7 +1055,7 @@ verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
&& sigp->pubkey_algo == PGPPUBKEYALGO_RSA
|
&& sigp->pubkey_algo == PGPPUBKEYALGO_RSA
|
||||||
&& sigp->hash_algo == PGPHASHALGO_MD5))
|
&& sigp->hash_algo == PGPHASHALGO_MD5))
|
||||||
{
|
{
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,7 +1085,7 @@ verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
signhash16[0] = (nibble(s[0]) << 4) | nibble(s[1]);
|
signhash16[0] = (nibble(s[0]) << 4) | nibble(s[1]);
|
||||||
signhash16[1] = (nibble(s[2]) << 4) | nibble(s[3]);
|
signhash16[1] = (nibble(s[2]) << 4) | nibble(s[3]);
|
||||||
if (memcmp(signhash16, sigp->signhash16, sizeof(signhash16))) {
|
if (memcmp(signhash16, sigp->signhash16, sizeof(signhash16))) {
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,13 +1114,13 @@ verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
|
|
||||||
/* Retrieve the matching public key. */
|
/* Retrieve the matching public key. */
|
||||||
res = rpmtsFindPubkey(ts);
|
res = rpmtsFindPubkey(ts);
|
||||||
if (res != RPMSIG_OK)
|
if (res != RPMRC_OK)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (rsavrfy(&dig->rsa_pk, &dig->rsahm, &dig->c))
|
if (rsavrfy(&dig->rsa_pk, &dig->rsahm, &dig->c))
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
else
|
else
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
|
@ -1140,10 +1139,10 @@ exit:
|
||||||
* @param ts transaction set
|
* @param ts transaction set
|
||||||
* @retval t verbose success/failure text
|
* @retval t verbose success/failure text
|
||||||
* @param sha1ctx
|
* @param sha1ctx
|
||||||
* @return RPMSIG_OK on success
|
* @return RPMRC_OK on success
|
||||||
*/
|
*/
|
||||||
/*@-boundswrite@*/
|
/*@-boundswrite@*/
|
||||||
static rpmVerifySignatureReturn
|
static rpmRC
|
||||||
verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
/*@null@*/ DIGEST_CTX sha1ctx)
|
/*@null@*/ DIGEST_CTX sha1ctx)
|
||||||
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
|
||||||
|
@ -1156,7 +1155,7 @@ verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
int_32 sigtag = rpmtsSigtag(ts);
|
int_32 sigtag = rpmtsSigtag(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
pgpDigParams sigp = rpmtsSignature(ts);
|
pgpDigParams sigp = rpmtsSignature(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
int xx;
|
int xx;
|
||||||
|
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
|
@ -1165,7 +1164,7 @@ verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
t = stpcpy(t, _("V3 DSA signature: "));
|
t = stpcpy(t, _("V3 DSA signature: "));
|
||||||
|
|
||||||
if (sha1ctx == NULL || sig == NULL || dig == NULL || sigp == NULL) {
|
if (sha1ctx == NULL || sig == NULL || dig == NULL || sigp == NULL) {
|
||||||
res = RPMSIG_NOKEY; /* XXX RPMSIG_ARGS */
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1173,7 @@ verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
&& sigp->pubkey_algo == PGPPUBKEYALGO_DSA
|
&& sigp->pubkey_algo == PGPPUBKEYALGO_DSA
|
||||||
&& sigp->hash_algo == PGPHASHALGO_SHA1))
|
&& sigp->hash_algo == PGPHASHALGO_SHA1))
|
||||||
{
|
{
|
||||||
res = RPMSIG_NOKEY;
|
res = RPMRC_NOKEY;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,21 +1202,21 @@ verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
|
||||||
signhash16[0] = (*dig->hm.data >> 24) & 0xff;
|
signhash16[0] = (*dig->hm.data >> 24) & 0xff;
|
||||||
signhash16[1] = (*dig->hm.data >> 16) & 0xff;
|
signhash16[1] = (*dig->hm.data >> 16) & 0xff;
|
||||||
if (memcmp(signhash16, sigp->signhash16, sizeof(signhash16))) {
|
if (memcmp(signhash16, sigp->signhash16, sizeof(signhash16))) {
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve the matching public key. */
|
/* Retrieve the matching public key. */
|
||||||
res = rpmtsFindPubkey(ts);
|
res = rpmtsFindPubkey(ts);
|
||||||
if (res != RPMSIG_OK)
|
if (res != RPMRC_OK)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (dsavrfy(&dig->p, &dig->q, &dig->g,
|
if (dsavrfy(&dig->p, &dig->q, &dig->g,
|
||||||
&dig->hm, &dig->y, &dig->r, &dig->s))
|
&dig->hm, &dig->y, &dig->r, &dig->s))
|
||||||
res = RPMSIG_OK;
|
res = RPMRC_OK;
|
||||||
else
|
else
|
||||||
res = RPMSIG_BAD;
|
res = RPMRC_FAIL;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
t = stpcpy(t, rpmSigString(res));
|
t = stpcpy(t, rpmSigString(res));
|
||||||
|
@ -1231,18 +1230,18 @@ exit:
|
||||||
}
|
}
|
||||||
/*@=boundswrite@*/
|
/*@=boundswrite@*/
|
||||||
|
|
||||||
rpmVerifySignatureReturn
|
rpmRC
|
||||||
rpmVerifySignature(const rpmts ts, char * result)
|
rpmVerifySignature(const rpmts ts, char * result)
|
||||||
{
|
{
|
||||||
const void * sig = rpmtsSig(ts);
|
const void * sig = rpmtsSig(ts);
|
||||||
int_32 siglen = rpmtsSiglen(ts);
|
int_32 siglen = rpmtsSiglen(ts);
|
||||||
int_32 sigtag = rpmtsSigtag(ts);
|
int_32 sigtag = rpmtsSigtag(ts);
|
||||||
pgpDig dig = rpmtsDig(ts);
|
pgpDig dig = rpmtsDig(ts);
|
||||||
rpmVerifySignatureReturn res;
|
rpmRC res;
|
||||||
|
|
||||||
if (sig == NULL || siglen <= 0 || dig == NULL) {
|
if (sig == NULL || siglen <= 0 || dig == NULL) {
|
||||||
sprintf(result, _("Verify signature: BAD PARAMETERS\n"));
|
sprintf(result, _("Verify signature: BAD PARAMETERS\n"));
|
||||||
return RPMSIG_UNKNOWN;
|
return RPMRC_NOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sigtag) {
|
switch (sigtag) {
|
||||||
|
@ -1269,11 +1268,11 @@ rpmVerifySignature(const rpmts ts, char * result)
|
||||||
case RPMSIGTAG_LEMD5_1:
|
case RPMSIGTAG_LEMD5_1:
|
||||||
case RPMSIGTAG_LEMD5_2:
|
case RPMSIGTAG_LEMD5_2:
|
||||||
sprintf(result, _("Broken MD5 digest: UNSUPPORTED\n"));
|
sprintf(result, _("Broken MD5 digest: UNSUPPORTED\n"));
|
||||||
res = RPMSIG_UNKNOWN;
|
res = RPMRC_NOTFOUND;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(result, _("Signature: UNKNOWN (%d)\n"), sigtag);
|
sprintf(result, _("Signature: UNKNOWN (%d)\n"), sigtag);
|
||||||
res = RPMSIG_UNKNOWN;
|
res = RPMRC_NOTFOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1422,7 +1422,8 @@ rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n"));
|
||||||
rpmteNEVR(p), &p->h);
|
rpmteNEVR(p), &p->h);
|
||||||
vsflags = rpmtsSetVSFlags(ts, ovsflags);
|
vsflags = rpmtsSetVSFlags(ts, ovsflags);
|
||||||
|
|
||||||
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE)) {
|
switch (rpmrc) {
|
||||||
|
default:
|
||||||
/*@-noeffectuncon@*/ /* FIX: notify annotations */
|
/*@-noeffectuncon@*/ /* FIX: notify annotations */
|
||||||
p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
|
p->fd = ts->notify(p->h, RPMCALLBACK_INST_CLOSE_FILE,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -1430,6 +1431,9 @@ rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n"));
|
||||||
/*@=noeffectuncon@*/
|
/*@=noeffectuncon@*/
|
||||||
p->fd = NULL;
|
p->fd = NULL;
|
||||||
ourrc++;
|
ourrc++;
|
||||||
|
/*@innerbreak@*/ break;
|
||||||
|
case RPMRC_OK:
|
||||||
|
/*@innerbreak@*/ break;
|
||||||
}
|
}
|
||||||
if (rpmteFd(p) != NULL) gotfd = 1;
|
if (rpmteFd(p) != NULL) gotfd = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -721,7 +721,7 @@ rpmts_HdrFromFdno(rpmtsObject * s, PyObject * args)
|
||||||
/*@globals _Py_NoneStruct, fileSystem @*/
|
/*@globals _Py_NoneStruct, fileSystem @*/
|
||||||
/*@modifies s, _Py_NoneStruct, fileSystem @*/
|
/*@modifies s, _Py_NoneStruct, fileSystem @*/
|
||||||
{
|
{
|
||||||
hdrObject * hdr;
|
PyObject * result = NULL;
|
||||||
Header h;
|
Header h;
|
||||||
FD_t fd;
|
FD_t fd;
|
||||||
int fdno;
|
int fdno;
|
||||||
|
@ -737,25 +737,32 @@ fprintf(stderr, "*** rpmts_HdrFromFdno(%p) ts %p\n", s, s->ts);
|
||||||
Fclose(fd);
|
Fclose(fd);
|
||||||
|
|
||||||
switch (rpmrc) {
|
switch (rpmrc) {
|
||||||
case RPMRC_BADSIZE:
|
|
||||||
case RPMRC_OK:
|
case RPMRC_OK:
|
||||||
hdr = hdr_Wrap(h);
|
if (h)
|
||||||
h = headerFree(h); /* XXX ref held by hdr */
|
result = Py_BuildValue("N", hdr_Wrap(h));
|
||||||
|
h = headerFree(h); /* XXX ref held by result */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RPMRC_NOTFOUND:
|
case RPMRC_NOTFOUND:
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
hdr = (hdrObject *) Py_None;
|
result = Py_None;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RPMRC_NOKEY:
|
||||||
|
PyErr_SetString(pyrpmError, "public key not availaiable");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RPMRC_NOTTRUSTED:
|
||||||
|
PyErr_SetString(pyrpmError, "public key not trusted");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RPMRC_FAIL:
|
case RPMRC_FAIL:
|
||||||
case RPMRC_SHORTREAD:
|
|
||||||
default:
|
default:
|
||||||
PyErr_SetString(pyrpmError, "error reading package header");
|
PyErr_SetString(pyrpmError, "error reading package header");
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Py_BuildValue("N", hdr);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \ingroup python
|
/** \ingroup python
|
||||||
|
@ -794,8 +801,17 @@ fprintf(stderr, "*** rpmts_HdrCheck(%p) ts %p\n", s, s->ts);
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
result = Py_None;
|
result = Py_None;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
case RPMRC_NOKEY:
|
||||||
|
PyErr_SetString(pyrpmError, "public key not availaiable");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RPMRC_NOTTRUSTED:
|
||||||
|
PyErr_SetString(pyrpmError, "public key not trusted");
|
||||||
|
break;
|
||||||
|
|
||||||
case RPMRC_FAIL:
|
case RPMRC_FAIL:
|
||||||
|
default:
|
||||||
PyErr_SetString(pyrpmError, msg);
|
PyErr_SetString(pyrpmError, msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ Name: rpm
|
||||||
%define version @VERSION@
|
%define version @VERSION@
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
%{expand: %%define rpm_version %{version}}
|
%{expand: %%define rpm_version %{version}}
|
||||||
Release: 0.87
|
Release: 0.88
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
|
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
|
||||||
Copyright: GPL
|
Copyright: GPL
|
||||||
|
@ -522,6 +522,10 @@ fi
|
||||||
%{__prefix}/include/popt.h
|
%{__prefix}/include/popt.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 22 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.88
|
||||||
|
- merge signature returns into rpmRC.
|
||||||
|
- python: exceptions on NOKEY/NOTTRUSTED.
|
||||||
|
|
||||||
* Thu Aug 21 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.87
|
* Thu Aug 21 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.87
|
||||||
- fix: don't stop if db1 database is currently in /var/lib/rpm (#72224).
|
- fix: don't stop if db1 database is currently in /var/lib/rpm (#72224).
|
||||||
- add a macro to create a sub-package with debugging symbols.
|
- add a macro to create a sub-package with debugging symbols.
|
||||||
|
|
|
@ -47,15 +47,15 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case RPMRC_BADSIZE:
|
|
||||||
case RPMRC_OK:
|
case RPMRC_OK:
|
||||||
|
case RPMRC_NOKEY:
|
||||||
|
case RPMRC_NOTTRUSTED:
|
||||||
break;
|
break;
|
||||||
case RPMRC_NOTFOUND:
|
case RPMRC_NOTFOUND:
|
||||||
fprintf(stderr, _("argument is not an RPM package\n"));
|
fprintf(stderr, _("argument is not an RPM package\n"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
break;
|
break;
|
||||||
case RPMRC_FAIL:
|
case RPMRC_FAIL:
|
||||||
case RPMRC_SHORTREAD:
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, _("error reading header from package\n"));
|
fprintf(stderr, _("error reading header from package\n"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -14,7 +14,7 @@ INCLUDES = -I. \
|
||||||
@INCPATH@ \
|
@INCPATH@ \
|
||||||
-I$(top_srcdir)/misc
|
-I$(top_srcdir)/misc
|
||||||
|
|
||||||
EXTRA_DIST = rpminject.c rpmsort.c
|
EXTRA_DIST = rpminject.c rpmsort.c sections.h utils.h
|
||||||
|
|
||||||
EXTRA_PROGRAMS = rpminject rpmsort
|
EXTRA_PROGRAMS = rpminject rpmsort
|
||||||
|
|
||||||
|
|
|
@ -141,23 +141,23 @@ restart:
|
||||||
Fclose(fd);
|
Fclose(fd);
|
||||||
fd = NULL;
|
fd = NULL;
|
||||||
|
|
||||||
if (rpmrc == RPMRC_FAIL || rpmrc == RPMRC_SHORTREAD) {
|
switch (rpmrc) {
|
||||||
numFailed++; *fnp = NULL;
|
case RPMRC_FAIL:
|
||||||
continue;
|
default:
|
||||||
}
|
|
||||||
|
|
||||||
if (rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE) {
|
|
||||||
rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName, 0, NULL);
|
|
||||||
h = headerFree(h);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rpmrc != RPMRC_NOTFOUND) {
|
|
||||||
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *fnp);
|
rpmMessage(RPMMESS_ERROR, _("%s cannot be installed\n"), *fnp);
|
||||||
numFailed++; *fnp = NULL;
|
numFailed++; *fnp = NULL;
|
||||||
break;
|
/*@switchbreak@*/ break;
|
||||||
|
case RPMRC_OK:
|
||||||
|
rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName, 0, NULL);
|
||||||
|
/*@switchbreak@*/ break;
|
||||||
|
case RPMRC_NOTFOUND:
|
||||||
|
goto maybe_manifest;
|
||||||
|
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||||
}
|
}
|
||||||
|
h = headerFree(h);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
maybe_manifest:
|
||||||
/* Try to read a package manifest. */
|
/* Try to read a package manifest. */
|
||||||
fd = Fopen(*fnp, "r.fpio");
|
fd = Fopen(*fnp, "r.fpio");
|
||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
|
|
Loading…
Reference in New Issue