From 1b54c8ab931c4248339e57c538519f8b70c1babb Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Tue, 30 Apr 2024 13:26:54 +0200 Subject: [PATCH 1/3] http/client: add setter to disable tls server verification (#1114) --- include/re_http.h | 1 + src/http/client.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/re_http.h b/include/re_http.h index 3e8ed965d..322eb1abf 100644 --- a/include/re_http.h +++ b/include/re_http.h @@ -173,6 +173,7 @@ int http_client_set_keypem(struct http_cli *cli, const char *pem); int http_client_set_session_reuse(struct http_cli *cli, bool enabled); int http_client_set_tls_min_version(struct http_cli *cli, int version); int http_client_set_tls_max_version(struct http_cli *cli, int version); +int http_client_disable_verify_server(struct http_cli *cli); #endif /* Server */ diff --git a/src/http/client.c b/src/http/client.c index 87ebedfb7..58a1e9302 100644 --- a/src/http/client.c +++ b/src/http/client.c @@ -1227,7 +1227,25 @@ int http_client_set_tls_max_version(struct http_cli *cli, int version) return tls_set_max_proto_version(cli->tls, version); } -#endif + + +/** + * Disable TLS server certificate verification + * + * @param cli HTTP Client + * + * @return 0 if success, otherwise errorcode + */ +int http_client_disable_verify_server(struct http_cli *cli) +{ + if (!cli) + return EINVAL; + + tls_disable_verify_server(cli->tls); + + return 0; +} +#endif /* USE_TLS */ /** From 411208e5ef75db4905463d2de8e3c9ec64a5eb2d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:13:41 +0200 Subject: [PATCH 2/3] dbg: mutex should be unlocked while calling print handler (#1113) * dbg: mutex should be unlocked while calling print handler * dbg_handler_set: add mutex --- src/dbg/dbg.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/dbg/dbg.c b/src/dbg/dbg.c index df3e74847..0e84cf3d2 100644 --- a/src/dbg/dbg.c +++ b/src/dbg/dbg.c @@ -91,8 +91,10 @@ void dbg_close(void) */ void dbg_handler_set(dbg_print_h *ph, void *arg) { + dbg_lock(); dbg.ph = ph; dbg.arg = arg; + dbg_unlock(); } @@ -151,27 +153,24 @@ static void dbg_vprintf(int level, const char *fmt, va_list ap) static void dbg_fmt_vprintf(int level, const char *fmt, va_list ap) { char buf[256]; - int len; dbg_lock(); + int dbg_level = dbg.level; + dbg_print_h *ph = dbg.ph; + void *arg = dbg.arg; + dbg_unlock(); - if (level > dbg.level) - goto out; - - if (!dbg.ph) - goto out; - - len = re_vsnprintf(buf, sizeof(buf), fmt, ap); - if (len <= 0) - goto out; + if (level > dbg_level) + return; /* Print handler? */ - if (dbg.ph) { - dbg.ph(level, buf, len, dbg.arg); - } + if (ph) { + int len = re_vsnprintf(buf, sizeof(buf), fmt, ap); + if (len <= 0) + return; - out: - dbg_unlock(); + ph(level, buf, len, arg); + } } From 01c4613fd4d51574cf396070ad3cc905ef95330f Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Wed, 1 May 2024 12:37:14 +0200 Subject: [PATCH 3/3] Update README.md (#1115) --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e39700d39..bac0db318 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,6 @@ legend: * [RFC 1321](https://tools.ietf.org/html/rfc1321) - The MD5 Message-Digest Algorithm * [RFC 1886](https://tools.ietf.org/html/rfc1886) - DNS Extensions to support IP version 6 -* [RFC 2032](https://tools.ietf.org/html/rfc2032) - RTP Payload Format for H.261 Video Streams * [RFC 2616](https://tools.ietf.org/html/rfc2616) - Hypertext Transfer Protocol -- HTTP/1.1 * [RFC 2617](https://tools.ietf.org/html/rfc2617) - HTTP Authentication: Basic and Digest Access Authentication * [RFC 2782](https://tools.ietf.org/html/rfc2782) - A DNS RR for Specifying the Location of Services (DNS SRV)