mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 23:55:27 +00:00
Report file and line when converting OpenSSL errors
This provides more detail about which instance of specific OpenSSL calls that have failed by reporting the file name and line numbers involved when dst__openssl_toresult2 and dst__openssl_toresult3 are called.
This commit is contained in:
@@ -29,12 +29,17 @@ ISC_LANG_BEGINDECLS
|
|||||||
isc_result_t
|
isc_result_t
|
||||||
dst__openssl_toresult(isc_result_t fallback);
|
dst__openssl_toresult(isc_result_t fallback);
|
||||||
|
|
||||||
|
#define dst__openssl_toresult2(A, B) \
|
||||||
|
dst___openssl_toresult2(A, B, __FILE__, __LINE__)
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dst__openssl_toresult2(const char *funcname, isc_result_t fallback);
|
dst___openssl_toresult2(const char *funcname, isc_result_t fallback,
|
||||||
|
const char *file, int line);
|
||||||
|
|
||||||
|
#define dst__openssl_toresult3(A, B, C) \
|
||||||
|
dst___openssl_toresult3(A, B, C, __FILE__, __LINE__)
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dst__openssl_toresult3(isc_logcategory_t *category, const char *funcname,
|
dst___openssl_toresult3(isc_logcategory_t *category, const char *funcname,
|
||||||
isc_result_t fallback);
|
isc_result_t fallback, const char *file, int line);
|
||||||
|
|
||||||
#if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000
|
#if !defined(OPENSSL_NO_ENGINE) && OPENSSL_API_LEVEL < 30000
|
||||||
ENGINE *
|
ENGINE *
|
||||||
|
@@ -175,24 +175,26 @@ dst__openssl_toresult(isc_result_t fallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dst__openssl_toresult2(const char *funcname, isc_result_t fallback) {
|
dst___openssl_toresult2(const char *funcname, isc_result_t fallback,
|
||||||
return (dst__openssl_toresult3(DNS_LOGCATEGORY_GENERAL, funcname,
|
const char *file, int line) {
|
||||||
fallback));
|
return (dst___openssl_toresult3(DNS_LOGCATEGORY_GENERAL, funcname,
|
||||||
|
fallback, file, line));
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
dst__openssl_toresult3(isc_logcategory_t *category, const char *funcname,
|
dst___openssl_toresult3(isc_logcategory_t *category, const char *funcname,
|
||||||
isc_result_t fallback) {
|
isc_result_t fallback, const char *file, int line) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
unsigned long err;
|
unsigned long err;
|
||||||
const char *file, *func, *data;
|
const char *func, *data;
|
||||||
int line, flags;
|
int flags;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
result = toresult(fallback);
|
result = toresult(fallback);
|
||||||
|
|
||||||
isc_log_write(dns_lctx, category, DNS_LOGMODULE_CRYPTO, ISC_LOG_WARNING,
|
isc_log_write(dns_lctx, category, DNS_LOGMODULE_CRYPTO, ISC_LOG_WARNING,
|
||||||
"%s failed (%s)", funcname, isc_result_totext(result));
|
"%s (%s:%d) failed (%s)", funcname, file, line,
|
||||||
|
isc_result_totext(result));
|
||||||
|
|
||||||
if (result == ISC_R_NOMEMORY) {
|
if (result == ISC_R_NOMEMORY) {
|
||||||
goto done;
|
goto done;
|
||||||
|
Reference in New Issue
Block a user