@lbalaceanu commented on this pull request.
Hello @xkaraman ,
Thank you for your contribution. I will also test minimally the code and give an input
after that as well.
+#include "../../core/dprint.h"
+#include "utils.h"
+
+/*
+ * Get any leftover errors from OpenSSL and print them.
+ * ERR_get_error() also removes the error from the OpenSSL error stack.
+ * This is useful to call before any SSL_* IO calls to make sure
+ * we don't have any leftover errors from previous calls (OpenSSL docs).
+ */
+void cdp_openssl_clear_errors(void)
+{
+ int i;
+ char err[160];
+ while((i = ERR_get_error())) {
+ ERR_error_string(i, err);
+ INFO("clearing leftover error before SSL_* calls: %s", err);
Hello,
Just a cosmetic change, but maybe this should be a LM_INFO call.
+#include <openssl/ssl.h>
+#include
<openssl/err.h>
+
+#include "../../core/dprint.h"
+#include "utils.h"
+
+/*
+ * Get any leftover errors from OpenSSL and print them.
+ * ERR_get_error() also removes the error from the OpenSSL error stack.
+ * This is useful to call before any SSL_* IO calls to make sure
+ * we don't have any leftover errors from previous calls (OpenSSL docs).
+ */
+void cdp_openssl_clear_errors(void)
+{
+ int i;
+ char err[160];
Maybe 256 should be a better value, or maybe use ERR_error_string_n? I saw in
https://www.openssl.org/docs/man3.0/man3/ERR_error_string.html they suggest 256 for the
buffer.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3612#pullrequestreview-1692747227
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3612/review/1692747227(a)github.com>