Fix #25 correctly: compare against repo->signature.
This commit is contained in:
parent
e86f9def03
commit
d98468515a
@ -149,7 +149,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
|||||||
repo = xbps_repo_open(xhp, repodir);
|
repo = xbps_repo_open(xhp, repodir);
|
||||||
if (repo == NULL) {
|
if (repo == NULL) {
|
||||||
fprintf(stderr, "cannot read repository data: %s\n", strerror(errno));
|
fprintf(stderr, "cannot read repository data: %s\n", strerror(errno));
|
||||||
goto out;
|
return -1;
|
||||||
}
|
}
|
||||||
if (xbps_dictionary_count(repo->idx) == 0) {
|
if (xbps_dictionary_count(repo->idx) == 0) {
|
||||||
fprintf(stderr, "invalid number of objects in repository index!\n");
|
fprintf(stderr, "invalid number of objects in repository index!\n");
|
||||||
@ -182,22 +182,22 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
|||||||
free(xml);
|
free(xml);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* If the signature in repo has not changed do not generate the
|
||||||
|
* repodata file again.
|
||||||
|
*/
|
||||||
|
if (xbps_data_equals_data(repo->signature, sig, siglen)) {
|
||||||
|
fprintf(stderr, "Not signing again, matched signature found.\n");
|
||||||
|
rv = 0;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Prepare the XBPS_REPOIDX_META for our repository data.
|
* Prepare the XBPS_REPOIDX_META for our repository data.
|
||||||
*/
|
*/
|
||||||
meta = xbps_dictionary_create();
|
meta = xbps_dictionary_create();
|
||||||
xbps_dictionary_set_cstring_nocopy(meta, "signature-by", signedby);
|
xbps_dictionary_set_cstring_nocopy(meta, "signature-by", signedby);
|
||||||
xbps_dictionary_set_cstring_nocopy(meta, "signature-type", "rsa");
|
xbps_dictionary_set_cstring_nocopy(meta, "signature-type", "rsa");
|
||||||
/*
|
|
||||||
* If the signature in repo has not changed do not generate the
|
|
||||||
* repodata file again.
|
|
||||||
*/
|
|
||||||
data = xbps_data_create_data_nocopy(sig, siglen);
|
data = xbps_data_create_data_nocopy(sig, siglen);
|
||||||
if (xbps_data_equals_data(data, sig, siglen)) {
|
|
||||||
fprintf(stderr, "Not signing again, matched signature found.\n");
|
|
||||||
rv = 0;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
xbps_dictionary_set(meta, "signature", data);
|
xbps_dictionary_set(meta, "signature", data);
|
||||||
|
|
||||||
buf = pubkey_from_privkey(rsa);
|
buf = pubkey_from_privkey(rsa);
|
||||||
|
@ -156,9 +156,6 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url)
|
|||||||
repo = NULL;
|
repo = NULL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!is_remote)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if ((meta = repo_get_dict(repo, XBPS_REPOIDX_META))) {
|
if ((meta = repo_get_dict(repo, XBPS_REPOIDX_META))) {
|
||||||
repo->is_signed = true;
|
repo->is_signed = true;
|
||||||
repo->signature = xbps_dictionary_get(meta, "signature");
|
repo->signature = xbps_dictionary_get(meta, "signature");
|
||||||
|
Loading…
Reference in New Issue
Block a user