Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around buggy signature region preventing resigning (RhBug:1851508) #1330

Merged
merged 1 commit into from Aug 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions sign/rpmgensig.c
Expand Up @@ -399,11 +399,19 @@ static int replaceSignature(Header sigh, sigTarget sigt_v3, sigTarget sigt_v4)
static void unloadImmutableRegion(Header *hdrp, rpmTagVal tag)
{
struct rpmtd_s td;
Header oh = NULL;

if (headerGet(*hdrp, tag, &td, HEADERGET_DEFAULT)) {
Header oh = headerCopyLoad(td.data);
Header nh = headerCopy(oh);
oh = headerCopyLoad(td.data);
rpmtdFreeData(&td);
} else {
/* XXX should we warn if the immutable region is corrupt/missing? */
oh = headerLink(*hdrp);
}

if (oh) {
/* Perform a copy to eliminate crud from buggy signing tools etc */
Header nh = headerCopy(oh);
headerFree(*hdrp);
*hdrp = headerLink(nh);
headerFree(nh);
Expand Down