From 97e836696be2b8aef3531d5e58cf72c4080f04ce Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 22 Apr 2014 01:17:34 +0200 Subject: [PATCH] Return human readable error message from cert:issued() --- src/x509.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/x509.c b/src/x509.c index a71608c..7e1550f 100644 --- a/src/x509.c +++ b/src/x509.c @@ -400,8 +400,13 @@ static int meth_issued(lua_State *L) { X509* issuer = lsec_checkx509(L, 1); X509* subject = lsec_checkx509(L, 2); - lua_pushboolean(L, X509_check_issued(issuer, subject) == X509_V_OK); - return 1; + int ret = X509_check_issued(issuer, subject); + lua_pushboolean(L, ret == X509_V_OK); + if (ret != X509_V_OK) { + lua_pushstring(L, X509_verify_cert_error_string(ret)); + return 2; + } + return 1; } /**