403 /** |
403 /** |
404 * Return the validation state of the peer chain |
404 * Return the validation state of the peer chain |
405 */ |
405 */ |
406 static int meth_getpeerchainvalid(lua_State *L) |
406 static int meth_getpeerchainvalid(lua_State *L) |
407 { |
407 { |
408 p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); |
408 p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); |
409 long result = SSL_get_verify_result(ssl->ssl); |
409 long result = SSL_get_verify_result(ssl->ssl); |
410 |
410 |
411 if (result == X509_V_OK) { |
411 if (result == X509_V_OK) { |
412 lua_pushboolean(L, 1); |
412 lua_pushboolean(L, 1); |
413 return 1; |
413 return 1; |
414 } |
414 } |
415 |
415 |
416 lua_pushboolean(L, 0); |
416 lua_pushboolean(L, 0); |
417 lua_pushstring(L, X509_verify_cert_error_string(result)); |
417 lua_pushstring(L, X509_verify_cert_error_string(result)); |
418 return 2; |
418 return 2; |
419 } |
419 } |
420 |
420 |
421 static void luasec_push_cert(lua_State *L, X509 *cert) |
421 static void luasec_push_cert(lua_State *L, X509 *cert) |
422 { |
422 { |
423 if (cert == NULL) { |
423 if (cert == NULL) { |