gpg: centralize signature check
verify-commit and verify-tag both share a central codepath for verifying commits: check_signature. However, verify-tag exited successfully for untrusted signature, while verify-commit exited unsuccessfully. Centralize this signature check and make verify-commit adopt the older verify-tag behavior. This behavior is more logical anyway, as the signature is in fact valid, whether or not there's a path of trust to the author. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8e98e5f27a
commit
434060ec6d
@ -60,7 +60,7 @@ void parse_gpg_output(struct signature_check *sigc)
|
||||
}
|
||||
}
|
||||
|
||||
void check_signature(const char *payload, size_t plen, const char *signature,
|
||||
int check_signature(const char *payload, size_t plen, const char *signature,
|
||||
size_t slen, struct signature_check *sigc)
|
||||
{
|
||||
struct strbuf gpg_output = STRBUF_INIT;
|
||||
@ -81,6 +81,8 @@ void check_signature(const char *payload, size_t plen, const char *signature,
|
||||
out:
|
||||
strbuf_release(&gpg_status);
|
||||
strbuf_release(&gpg_output);
|
||||
|
||||
return sigc->result != 'G' && sigc->result != 'U';
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user