Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-06-22 02:14:40 +0300
committerJunio C Hamano <gitster@pobox.com>2015-06-23 00:20:46 +0300
commit434060ec6d9bf50f095db901da3fb9b557e11df1 (patch)
tree7a7dc99fb6b8e1e5eaa566ec4eb5e29ff807e8f2 /commit.c
parent8e98e5f27aba812c0f095b7e546871e14a4139f6 (diff)
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/commit.c b/commit.c
index d07a984985..909419a13b 100644
--- a/commit.c
+++ b/commit.c
@@ -1227,20 +1227,24 @@ free_return:
free(buf);
}
-void check_commit_signature(const struct commit *commit, struct signature_check *sigc)
+int check_commit_signature(const struct commit *commit, struct signature_check *sigc)
{
struct strbuf payload = STRBUF_INIT;
struct strbuf signature = STRBUF_INIT;
+ int ret = 1;
sigc->result = 'N';
if (parse_signed_commit(commit, &payload, &signature) <= 0)
goto out;
- check_signature(payload.buf, payload.len, signature.buf, signature.len, sigc);
+ ret = check_signature(payload.buf, payload.len, signature.buf,
+ signature.len, sigc);
out:
strbuf_release(&payload);
strbuf_release(&signature);
+
+ return ret;
}