mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/openssl] ossl.c: use ERR_get_error_all() if available
OpenSSL 3.0 deprecated ERR_get_error_line_data() in favor of ERR_get_error_all(), as part of the error queue structure changes. https://github.com/ruby/openssl/commit/8e98d2ecc8
This commit is contained in:
parent
32d49e93cf
commit
3d16401508
2 changed files with 22 additions and 17 deletions
|
@ -172,6 +172,7 @@ have_func("EVP_PKEY_check")
|
|||
|
||||
# added in 3.0.0
|
||||
have_func("SSL_set0_tmp_dh_pkey")
|
||||
have_func("ERR_get_error_all")
|
||||
|
||||
Logging::message "=== Checking done. ===\n"
|
||||
|
||||
|
|
|
@ -313,27 +313,31 @@ void
|
|||
ossl_clear_error(void)
|
||||
{
|
||||
if (dOSSL == Qtrue) {
|
||||
unsigned long e;
|
||||
const char *file, *data, *errstr;
|
||||
int line, flags;
|
||||
unsigned long e;
|
||||
const char *file, *data, *func, *lib, *reason;
|
||||
char append[256] = "";
|
||||
int line, flags;
|
||||
|
||||
while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
|
||||
errstr = ERR_error_string(e, NULL);
|
||||
if (!errstr)
|
||||
errstr = "(null)";
|
||||
#ifdef HAVE_ERR_GET_ERROR_ALL
|
||||
while ((e = ERR_get_error_all(&file, &line, &func, &data, &flags))) {
|
||||
#else
|
||||
while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
|
||||
func = ERR_func_error_string(e);
|
||||
#endif
|
||||
lib = ERR_lib_error_string(e);
|
||||
reason = ERR_reason_error_string(e);
|
||||
|
||||
if (flags & ERR_TXT_STRING) {
|
||||
if (!data)
|
||||
data = "(null)";
|
||||
rb_warn("error on stack: %s (%s)", errstr, data);
|
||||
}
|
||||
else {
|
||||
rb_warn("error on stack: %s", errstr);
|
||||
}
|
||||
}
|
||||
if (flags & ERR_TXT_STRING) {
|
||||
if (!data)
|
||||
data = "(null)";
|
||||
snprintf(append, sizeof(append), " (%s)", data);
|
||||
}
|
||||
rb_warn("error on stack: error:%08lX:%s:%s:%s%s", e, lib ? lib : "",
|
||||
func ? func : "", reason ? reason : "", append);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ERR_clear_error();
|
||||
ERR_clear_error();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue