Skip to content

Commit

Permalink
Plug the last data "leak" from rpmlead
Browse files Browse the repository at this point in the history
Up to commit 45c2f3f we were still
using the lead to confirm source vs binary package, but now we dont
need even that. Means the zombie data structure that's supposedly been
dead for the last 20+ years is truly gone now. We still dutifully
read/write and validate it, but no actual data from it is used.
  • Loading branch information
pmatilai committed Apr 18, 2018
1 parent 7e5043a commit 05b233d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/rpmchecksig.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ rpmRC rpmpkgRead(struct rpmvs_s *sigset, FD_t fd,
memset(&blob, 0, sizeof(blob));
memset(&sigblob, 0, sizeof(sigblob));

if ((xx = rpmLeadRead(fd, NULL, &msg)) != RPMRC_OK) {
if ((xx = rpmLeadRead(fd, &msg)) != RPMRC_OK) {
/* Avoid message spew on manifests */
if (xx == RPMRC_NOTFOUND)
msg = _free(msg);
Expand Down
7 changes: 2 additions & 5 deletions lib/rpmlead.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static rpmRC rpmLeadCheck(struct rpmlead_s *lead, char **msg)
return RPMRC_OK;
}

rpmRC rpmLeadRead(FD_t fd, int *type, char **emsg)
rpmRC rpmLeadRead(FD_t fd, char **emsg)
{
rpmRC rc = RPMRC_OK;
struct rpmlead_s l;
Expand All @@ -129,10 +129,7 @@ rpmRC rpmLeadRead(FD_t fd, int *type, char **emsg)
rc = rpmLeadCheck(&l, &err);
}

if (rc == RPMRC_OK) {
if (type != NULL)
*type = l.type;
} else {
if (rc != RPMRC_OK) {
if (emsg != NULL)
*emsg = err;
else
Expand Down
3 changes: 1 addition & 2 deletions lib/rpmlead.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ rpmRC rpmLeadWrite(FD_t fd, Header h);
/** \ingroup lead
* Read lead from file handle.
* @param fd file handle
* @retval type RPMLEAD_BINARY or RPMLEAD_SOURCE on success
* @retval emsg failure message on error (malloced)
* @return RPMRC_OK on success, RPMRC_FAIL/RPMRC_NOTFOUND on error
*/
rpmRC rpmLeadRead(FD_t fd, int *type, char **emsg);
rpmRC rpmLeadRead(FD_t fd, char **emsg);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion sign/rpmgensig.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ static int rpmSign(const char *rpm, int deleting, int signfiles)
if (manageFile(&fd, rpm, O_RDWR))
goto exit;

if ((rc = rpmLeadRead(fd, NULL, &msg)) != RPMRC_OK) {
if ((rc = rpmLeadRead(fd, &msg)) != RPMRC_OK) {
rpmlog(RPMLOG_ERR, "%s: %s\n", rpm, msg);
goto exit;
}
Expand Down

0 comments on commit 05b233d

Please sign in to comment.