From ae26a83ad27b03c08df6fdd757e1ee29141330cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= Date: Tue, 1 Oct 2019 21:18:25 +0200 Subject: [PATCH] Preserve meta-index data on change of signing key --- bin/xbps-rindex/sign.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/xbps-rindex/sign.c b/bin/xbps-rindex/sign.c index 949dbe62..96e028b9 100644 --- a/bin/xbps-rindex/sign.c +++ b/bin/xbps-rindex/sign.c @@ -242,7 +242,6 @@ sign_repo(struct xbps_handle *xhp, const char *repodir, rv = EINVAL; goto out; } - meta = xbps_dictionary_create(); data = xbps_data_create_data(buf, strlen(buf)); rpubkey = xbps_dictionary_get(repo->idxmeta, "public-key"); @@ -263,6 +262,10 @@ sign_repo(struct xbps_handle *xhp, const char *repodir, if (!flush) goto out; + meta = xbps_dictionary_copy_mutable(repo->idxmeta); + if (meta == NULL) { + meta = xbps_dictionary_create(); + } xbps_dictionary_set(meta, "public-key", data); xbps_dictionary_set_uint16(meta, "public-key-size", pubkeysize); xbps_dictionary_set_cstring_nocopy(meta, "signature-by", signedby);