From 23650f1c6614e8bc60303ea909cf626de0144aab Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 3 Jan 2014 10:53:55 +0100 Subject: [PATCH] bin/xbps-rindex/sign.c: add 0.27 compat glue. --- bin/xbps-rindex/sign.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/xbps-rindex/sign.c b/bin/xbps-rindex/sign.c index f889d4c9..6383f04b 100644 --- a/bin/xbps-rindex/sign.c +++ b/bin/xbps-rindex/sign.c @@ -259,6 +259,21 @@ sign_repo(struct xbps_handle *xhp, const char *repodir, xbps_dictionary_set_uint16(meta, "public-key-size", RSA_size(rsa) * 8); free(buf); xbps_object_release(data); + /* + * XXX remove this code when 0.29 is released. + * Sign the index for compatibility with 0.27. + */ + if ((buf = xbps_dictionary_externalize(idx)) == NULL) { + fprintf(stderr, "failed to externalize repository index: %s\n", strerror(errno)); + return errno; + } + if (!rsa_sign_buf(rsa, buf, strlen(buf), &sig, &siglen)) { + fprintf(stderr, "failed to create repository index signature: %s\n", strerror(errno)); + return errno; + } + data = xbps_data_create_data_nocopy(sig, siglen); + xbps_dictionary_set(meta, "signature", data); + free(buf); /* * and finally write our repodata file! */