Skip to content

Commit

Permalink
Add Key Fingerprints to rpmsinfoMsg()
Browse files Browse the repository at this point in the history
  • Loading branch information
ffesti committed Sep 20, 2024
1 parent f585dcb commit 3f239a8
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/rpmvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,30 @@ const char *rpmsinfoDescr(struct rpmsinfo_s *sinfo)
char *rpmsinfoMsg(struct rpmsinfo_s *sinfo)
{
char *msg = NULL;
char *fphex = NULL;
char *fpmsg = NULL;
if (sinfo->rc == RPMRC_OK && sinfo->key) {
uint8_t *fp;
size_t fplen;
if (!rpmPubkeyFingerPrint(sinfo->key, &fp, &fplen)) {
fphex = rpmhex(fp, fplen);
free(fp);
}
}
if (fphex)
rasprintf(&fpmsg, _(", Key Fingerprint: %s"), fphex);
else
rstrcat(&fpmsg, "");

if (sinfo->msg) {
rasprintf(&msg, "%s: %s (%s)",
rpmsinfoDescr(sinfo), rpmSigString(sinfo->rc), sinfo->msg);
rasprintf(&msg, "%s: %s%s (%s)",
rpmsinfoDescr(sinfo), rpmSigString(sinfo->rc), fpmsg, sinfo->msg);
} else {
rasprintf(&msg, "%s: %s",
rpmsinfoDescr(sinfo), rpmSigString(sinfo->rc));
rasprintf(&msg, "%s: %s%s",
rpmsinfoDescr(sinfo), rpmSigString(sinfo->rc), fpmsg);
}
free(fphex);
free(fpmsg);
return msg;
}

Expand Down

0 comments on commit 3f239a8

Please sign in to comment.