mirror of
https://github.com/curl/curl.git
synced 2026-08-25 00:13:34 +03:00
build: address some -Weverything warnings, update picky warnings
`-Weverything` is not enabled by curl, and not recommended by LLVM, because it may enable experimental options, and will result in new fallouts after toolchain upgrades. This patch aims to fix/silence as much as possible as found with llvm/clang 21.1.0. It also permanently enables warnings that were fixed in source and deemed manageable in the future. `-Wformat` warnings are addressed separately via #18343. Fix/silence warnings in the source: - typecheck-gcc.h: fix `-Wreserved-identifier`. - lib: silence `-Wcast-function-type-strict`. For llvm 16+ or Apple clang 16+. - asyn-ares: limit `HAPPY_EYEBALLS_DNS_TIMEOUT` to old c-ares versions. - curl_trc: fix `-Wc++-hidden-decl`. - doh: fix `-Wc++-keyword`. - ftp: fix `-Wreserved-identifier`. - ldap: fix `-Wreserved-identifier`. - mqtt: comment unused macro to avoid warning. - multi_ev: drop unused macros to avoid warnings. - setopt: fix useless `break;` after `return;`. - gtls, mbedtls, rustls: silence `-Wconditional-uninitialized`. - socks_sspi, schannel, x509asn1: fix `-Wimplicit-int-enum-cast`. - x509asn1: fix `-Wc++-keyword`. - openssl: scope `OSSL_UI_METHOD_CAST` to avoid unused macro warning. - libssh2, wolfssl: drop unused macros. - curl_ngtcp2, curl_quiche, httpsrr, urlapi: drop/limit unused macros. - tool_getparam: fix useless `break;` after `return;` or `break;`. Not normally enabled because it doesn't work with unity. https://github.com/llvm/llvm-project/issues/71046 - tool_operate: fix `-Wc++-keyword`. - curlinfo: fix a `-Wunsafe-buffer-usage`. - tests: silence `-Wformat-non-iso`. - lib557: fix `-Wreserved-identifier`. - lib1565: silence `-Wconditional-uninitialized`. Enable the above clang warnings permanently in picky mode: - `-Wc++-hidden-decl` - `-Wc++-keyword` (except for Windows, where it collides with `wchar_t`) - `-Wcast-function-type-strict` - `-Wcast-function-type` - `-Wconditional-uninitialized` - `-Wformat-non-iso` (except for clang-cl) - `-Wreserved-identifier` - `-Wtentative-definition-compat` Silence problematic `-Weverything` warnings globally (in picky mode): - `-Wused-but-marked-unused` (88000+ hits) and `-Wdisabled-macro-expansion` (2600+ hits). Triggered by `typecheck-gcc.h` when building with clang 14+. Maybe there exists a way to fix within that header? Ref: https://discourse.llvm.org/t/removing-wused-but-marked-unused/55310 - `-Wunsafe-buffer-usage`. clang 16+. 7000+ hits. May be useful in theory, but such high volume of hits makes it impractical to review and possibly address. Meant for C++. Ref: https://clang.llvm.org/docs/SafeBuffers.html Ref: https://stackoverflow.com/questions/77017567/how-to-fix-code-to-avoid-warning-wunsafe-buffer-usage Ref: https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 Ref: https://github.com/llvm/llvm-project/pull/111624 - `-Wimplicit-void-ptr-cast`. clang 21+. 1700+ hits. C++ warning, deemed pure noise. Ref: https://github.com/curl/curl/issues/18470#issuecomment-3253506266 - `-Wswitch-default` (180+ hits), `-Wswitch-enum` (190+ hits), `-Wcovered-switch-default` (20+ hits). Next to impossible to fix cleanly, esp. when the covered `case` branches depend on compile-time options. - `-Wdocumentation-unknown-command` (8+ hits). Triggered in a few sources. Seems arbitrary and bogus. - `-Wpadded` (550+ hits). - `-Wc++-keyword` on Windows, where it collides with `wchar_t`. (100+ hits) Ref: https://github.com/llvm/llvm-project/issues/155988 - `-Wreserved-macro-identifier`. clang 13+. 5+ hits. Sometimes it's necessary to set external macros that use the reserved namespace. E.g. `_CRT_NONSTDC_NO_DEPRECATE`, `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, `__NO_NET_API`, possibly `_REENTRANT`, and more. It's not worth trying to silence them individually. - `-Wnonportable-system-include-path` with `clang-cl`. It'd be broken by doing what the warning suggests. - `-Wformat-non-iso` for clang-cl. CMake `PICKY_COMPILER=ON` (the default) or `./configure` `--enable-warnings` (not the default) is required to enable these silencing rules. Also: - autotools, cmake: fix Apple clang and mainline llvm version translations. Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions - autotools, cmake: enable `-Warray-compare` for clang 20+. Follow-up to4b7accda5a#17196 - cmake: fix to enable `-Wmissing-variable-declarations` at an earlier clang version. - cmake: update internal logic to handle warning options with `+` in them. - cmake: fix internal logic to match the whole option when looking into `CMAKE_C_FLAGS` for custom-disabled warnings. Follow-up tob85cb8cb4e#18485 Closes #18477
This commit is contained in:
parent
87cbeecee4
commit
92f215fea1
36 changed files with 533 additions and 360 deletions
|
|
@ -85,6 +85,17 @@
|
|||
#if ARES_VERSION >= 0x011000
|
||||
/* 1.16.0 or later has ares_getaddrinfo */
|
||||
#define HAVE_CARES_GETADDRINFO 1
|
||||
#else
|
||||
/* How long we are willing to wait for additional parallel responses after
|
||||
obtaining a "definitive" one. For old c-ares without getaddrinfo.
|
||||
|
||||
This is intended to equal the c-ares default timeout. cURL always uses that
|
||||
default value. Unfortunately, c-ares does not expose its default timeout in
|
||||
its API, but it is officially documented as 5 seconds.
|
||||
|
||||
See query_completed_cb() for an explanation of how this is used.
|
||||
*/
|
||||
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
|
||||
#endif
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
|
|
@ -99,17 +110,6 @@
|
|||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
/* How long we are willing to wait for additional parallel responses after
|
||||
obtaining a "definitive" one. For old c-ares without getaddrinfo.
|
||||
|
||||
This is intended to equal the c-ares default timeout. cURL always uses that
|
||||
default value. Unfortunately, c-ares does not expose its default timeout in
|
||||
its API, but it is officially documented as 5 seconds.
|
||||
|
||||
See query_completed_cb() for an explanation of how this is used.
|
||||
*/
|
||||
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
|
||||
|
||||
#define CARES_TIMEOUT_PER_ATTEMPT 2000
|
||||
|
||||
static int ares_ver = 0;
|
||||
|
|
|
|||
|
|
@ -640,8 +640,6 @@ void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
|
|||
(void)data; (void)cf; (void)fmt;
|
||||
}
|
||||
|
||||
struct curl_trc_feat;
|
||||
|
||||
void Curl_trc_multi(struct Curl_easy *data, const char *fmt, ...)
|
||||
{
|
||||
(void)data; (void)fmt;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ void Curl_trc_read(struct Curl_easy *data,
|
|||
void Curl_trc_dns(struct Curl_easy *data,
|
||||
const char *fmt, ...) CURL_PRINTF(2, 3);
|
||||
|
||||
struct curl_trc_feat {
|
||||
const char *name;
|
||||
int log_level;
|
||||
};
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
extern struct curl_trc_feat Curl_trc_feat_ftp;
|
||||
void Curl_trc_ftp(struct Curl_easy *data,
|
||||
|
|
@ -184,11 +189,6 @@ void Curl_trc_ws(struct Curl_easy *data,
|
|||
|
||||
#endif /* !CURL_HAVE_C99 */
|
||||
|
||||
struct curl_trc_feat {
|
||||
const char *name;
|
||||
int log_level;
|
||||
};
|
||||
|
||||
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||
/* informational messages enabled */
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,15 @@ bool curlx_verify_windows_version(const unsigned int majorVersion,
|
|||
static bool onetime = TRUE; /* safe because first call is during init */
|
||||
|
||||
if(onetime) {
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
pRtlVerifyVersionInfo = CURLX_FUNCTION_CAST(RTLVERIFYVERSIONINFO_FN,
|
||||
(GetProcAddress(GetModuleHandleA("ntdll"), "RtlVerifyVersionInfo")));
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
onetime = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
10
lib/doh.c
10
lib/doh.c
|
|
@ -759,7 +759,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
|
|||
|
||||
ancount = doh_get16bit(doh, 6);
|
||||
while(ancount) {
|
||||
unsigned short class;
|
||||
unsigned short dnsclass;
|
||||
unsigned int ttl;
|
||||
|
||||
rc = doh_skipqname(doh, dohlen, &index);
|
||||
|
|
@ -779,8 +779,8 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
|
|||
|
||||
if(dohlen < (index + 2))
|
||||
return DOH_DNS_OUT_OF_RANGE;
|
||||
class = doh_get16bit(doh, index);
|
||||
if(DNS_CLASS_IN != class)
|
||||
dnsclass = doh_get16bit(doh, index);
|
||||
if(DNS_CLASS_IN != dnsclass)
|
||||
return DOH_DNS_UNEXPECTED_CLASS; /* unsupported */
|
||||
index += 2;
|
||||
|
||||
|
|
@ -816,7 +816,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
|
|||
if(dohlen < (index + 8))
|
||||
return DOH_DNS_OUT_OF_RANGE;
|
||||
|
||||
index += 2 + 2 + 4; /* type, class and ttl */
|
||||
index += 2 + 2 + 4; /* type, dnsclass and ttl */
|
||||
|
||||
if(dohlen < (index + 2))
|
||||
return DOH_DNS_OUT_OF_RANGE;
|
||||
|
|
@ -838,7 +838,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
|
|||
if(dohlen < (index + 8))
|
||||
return DOH_DNS_OUT_OF_RANGE;
|
||||
|
||||
index += 2 + 2 + 4; /* type, class and ttl */
|
||||
index += 2 + 2 + 4; /* type, dnsclass and ttl */
|
||||
|
||||
if(dohlen < (index + 2))
|
||||
return DOH_DNS_OUT_OF_RANGE;
|
||||
|
|
|
|||
|
|
@ -868,10 +868,17 @@ CURLcode Curl_getformdata(CURL *data,
|
|||
particular, freopen(stdin) by the caller is not guaranteed
|
||||
to result as expected. This feature has been kept for backward
|
||||
compatibility: use of "-" pseudo filename should be avoided. */
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
result = curl_mime_data_cb(part, (curl_off_t) -1,
|
||||
(curl_read_callback) fread,
|
||||
fseeko_wrapper,
|
||||
NULL, (void *) stdin);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
else
|
||||
result = curl_mime_filedata(part, file->contents);
|
||||
|
|
|
|||
12
lib/ftp.c
12
lib/ftp.c
|
|
@ -142,11 +142,11 @@ static const char * const ftp_state_names[]={
|
|||
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
|
||||
|
||||
/* This is the ONLY way to change FTP state! */
|
||||
static void _ftp_state(struct Curl_easy *data,
|
||||
struct ftp_conn *ftpc,
|
||||
ftpstate newstate
|
||||
static void ftp_state_low(struct Curl_easy *data,
|
||||
struct ftp_conn *ftpc,
|
||||
ftpstate newstate
|
||||
#ifdef DEBUGBUILD
|
||||
, int lineno
|
||||
, int lineno
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
|
@ -172,9 +172,9 @@ static void _ftp_state(struct Curl_easy *data,
|
|||
|
||||
/* Local API functions */
|
||||
#ifndef DEBUGBUILD
|
||||
#define ftp_state(x,y,z) _ftp_state(x,y,z)
|
||||
#define ftp_state(x,y,z) ftp_state_low(x,y,z)
|
||||
#else /* !DEBUGBUILD */
|
||||
#define ftp_state(x,y,z) _ftp_state(x,y,z,__LINE__)
|
||||
#define ftp_state(x,y,z) ftp_state_low(x,y,z,__LINE__)
|
||||
#endif /* DEBUGBUILD */
|
||||
|
||||
static CURLcode ftp_sendquote(struct Curl_easy *data,
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@
|
|||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#define MAX_ALPN_LENGTH 255
|
||||
|
||||
static CURLcode httpsrr_decode_alpn(const char *cp, size_t len,
|
||||
unsigned char *alpns)
|
||||
{
|
||||
|
|
|
|||
43
lib/ldap.c
43
lib/ldap.c
|
|
@ -119,30 +119,30 @@ struct ldap_urldesc {
|
|||
char *lud_filter;
|
||||
#endif
|
||||
char **lud_exts;
|
||||
size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
|
||||
"real" struct so can only be used in code
|
||||
without HAVE_LDAP_URL_PARSE defined */
|
||||
size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
|
||||
"real" struct so can only be used in code
|
||||
without HAVE_LDAP_URL_PARSE defined */
|
||||
};
|
||||
|
||||
#undef LDAPURLDesc
|
||||
#define LDAPURLDesc struct ldap_urldesc
|
||||
|
||||
static int _ldap_url_parse(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc **ludp);
|
||||
static void _ldap_free_urldesc(LDAPURLDesc *ludp);
|
||||
static int ldap_url_parse_low(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc **ludp);
|
||||
static void ldap_free_urldesc_low(LDAPURLDesc *ludp);
|
||||
|
||||
#undef ldap_free_urldesc
|
||||
#define ldap_free_urldesc _ldap_free_urldesc
|
||||
#define ldap_free_urldesc ldap_free_urldesc_low
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LDAP
|
||||
#define LDAP_TRACE(x) do { \
|
||||
_ldap_trace("%u: ", __LINE__); \
|
||||
_ldap_trace x; \
|
||||
ldap_trace_low("%u: ", __LINE__); \
|
||||
ldap_trace_low x; \
|
||||
} while(0)
|
||||
|
||||
static void _ldap_trace(const char *fmt, ...) CURL_PRINTF(1, 2);
|
||||
static void ldap_trace_low(const char *fmt, ...) CURL_PRINTF(1, 2);
|
||||
#else
|
||||
#define LDAP_TRACE(x) Curl_nop_stmt
|
||||
#endif
|
||||
|
|
@ -346,7 +346,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
#ifdef HAVE_LDAP_URL_PARSE
|
||||
rc = ldap_url_parse(data->state.url, &ludp);
|
||||
#else
|
||||
rc = _ldap_url_parse(data, conn, &ludp);
|
||||
rc = ldap_url_parse_low(data, conn, &ludp);
|
||||
#endif
|
||||
if(rc) {
|
||||
failf(data, "Bad LDAP URL: %s", ldap_err2string((curl_ldap_num_t)rc));
|
||||
|
|
@ -728,7 +728,7 @@ quit:
|
|||
}
|
||||
|
||||
#ifdef DEBUG_LDAP
|
||||
static void _ldap_trace(const char *fmt, ...)
|
||||
static void ldap_trace_low(const char *fmt, ...)
|
||||
{
|
||||
static int do_trace = -1;
|
||||
va_list args;
|
||||
|
|
@ -795,8 +795,9 @@ static size_t num_entries(const char *s)
|
|||
*
|
||||
* Defined in RFC4516 section 2.
|
||||
*/
|
||||
static int _ldap_url_parse2(struct Curl_easy *data,
|
||||
const struct connectdata *conn, LDAPURLDesc *ludp)
|
||||
static int ldap_url_parse2_low(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc *ludp)
|
||||
{
|
||||
int rc = LDAP_SUCCESS;
|
||||
char *p;
|
||||
|
|
@ -999,9 +1000,9 @@ quit:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int _ldap_url_parse(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc **ludpp)
|
||||
static int ldap_url_parse_low(struct Curl_easy *data,
|
||||
const struct connectdata *conn,
|
||||
LDAPURLDesc **ludpp)
|
||||
{
|
||||
LDAPURLDesc *ludp = calloc(1, sizeof(*ludp));
|
||||
int rc;
|
||||
|
|
@ -1010,16 +1011,16 @@ static int _ldap_url_parse(struct Curl_easy *data,
|
|||
if(!ludp)
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
rc = _ldap_url_parse2(data, conn, ludp);
|
||||
rc = ldap_url_parse2_low(data, conn, ludp);
|
||||
if(rc != LDAP_SUCCESS) {
|
||||
_ldap_free_urldesc(ludp);
|
||||
ldap_free_urldesc_low(ludp);
|
||||
ludp = NULL;
|
||||
}
|
||||
*ludpp = ludp;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void _ldap_free_urldesc(LDAPURLDesc *ludp)
|
||||
static void ldap_free_urldesc_low(LDAPURLDesc *ludp)
|
||||
{
|
||||
if(!ludp)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
#define MQTT_MSG_SUBSCRIBE 0x82
|
||||
#define MQTT_MSG_SUBACK 0x90
|
||||
#define MQTT_MSG_DISCONNECT 0xe0
|
||||
#define MQTT_MSG_PINGREQ 0xC0
|
||||
/* #define MQTT_MSG_PINGREQ 0xC0 */
|
||||
#define MQTT_MSG_PINGRESP 0xD0
|
||||
|
||||
#define MQTT_CONNACK_LEN 2
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ static void mev_in_callback(struct Curl_multi *multi, bool value)
|
|||
multi->in_callback = value;
|
||||
}
|
||||
|
||||
#define CURL_MEV_CONN_HASH_SIZE 3
|
||||
|
||||
/* Information about a socket for which we inform the libcurl application
|
||||
* what to supervise (CURL_POLL_IN/CURL_POLL_OUT/CURL_POLL_REMOVE)
|
||||
*/
|
||||
|
|
@ -636,8 +634,6 @@ void Curl_multi_ev_conn_done(struct Curl_multi *multi,
|
|||
Curl_conn_meta_remove(conn, CURL_META_MEV_POLLSET);
|
||||
}
|
||||
|
||||
#define CURL_MEV_PS_HASH_SLOTS (991) /* nice prime */
|
||||
|
||||
void Curl_multi_ev_init(struct Curl_multi *multi, size_t hashsize)
|
||||
{
|
||||
Curl_hash_init(&multi->ev.sh_entries, hashsize, mev_sh_entry_hash,
|
||||
|
|
|
|||
|
|
@ -878,7 +878,14 @@ static CURLcode cr_in_rewind(struct Curl_easy *data,
|
|||
/* If no CURLOPT_READFUNCTION is used, we know that we operate on a
|
||||
given FILE * stream and we can actually attempt to rewind that
|
||||
ourselves with fseek() */
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
if(data->state.fread_func == (curl_read_callback)fread) {
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
int err = fseek(data->state.in, 0, SEEK_SET);
|
||||
CURL_TRC_READ(data, "cr_in, rewind via fseek -> %d(%d)",
|
||||
(int)err, (int)errno);
|
||||
|
|
|
|||
16
lib/setopt.c
16
lib/setopt.c
|
|
@ -818,10 +818,10 @@ static CURLcode setopt_bool(struct Curl_easy *data, CURLoption option,
|
|||
#if defined(CONNECT_DATA_IDEMPOTENT) || defined(MSG_FASTOPEN) || \
|
||||
defined(TCP_FASTOPEN_CONNECT)
|
||||
s->tcp_fastopen = enabled;
|
||||
break;
|
||||
#else
|
||||
return CURLE_NOT_BUILT_IN;
|
||||
#endif
|
||||
break;
|
||||
case CURLOPT_SSL_ENABLE_ALPN:
|
||||
s->ssl_enable_alpn = enabled;
|
||||
break;
|
||||
|
|
@ -2637,8 +2637,15 @@ static CURLcode setopt_func(struct Curl_easy *data, CURLoption option,
|
|||
*/
|
||||
s->fwrite_func = va_arg(param, curl_write_callback);
|
||||
if(!s->fwrite_func)
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
/* When set to NULL, reset to our internal default function */
|
||||
s->fwrite_func = (curl_write_callback)fwrite;
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
break;
|
||||
case CURLOPT_READFUNCTION:
|
||||
/*
|
||||
|
|
@ -2647,8 +2654,15 @@ static CURLcode setopt_func(struct Curl_easy *data, CURLoption option,
|
|||
s->fread_func_set = va_arg(param, curl_read_callback);
|
||||
if(!s->fread_func_set) {
|
||||
s->is_fread_set = 0;
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
/* When set to NULL, reset to our internal default function */
|
||||
s->fread_func_set = (curl_read_callback)fread;
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
else
|
||||
s->is_fread_set = 1;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
CURLcode code;
|
||||
size_t actualread;
|
||||
size_t written;
|
||||
int result;
|
||||
CURLcode result;
|
||||
int err;
|
||||
/* Needs GSS-API authentication */
|
||||
SECURITY_STATUS status;
|
||||
unsigned long sspi_ret_flags = 0;
|
||||
|
|
@ -236,8 +237,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
* +----+------+-----+----------------+
|
||||
*/
|
||||
|
||||
result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
|
||||
if(result || (actualread != 4)) {
|
||||
err = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
|
||||
if(err || (actualread != 4)) {
|
||||
failf(data, "Failed to receive SSPI authentication response.");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
|
|
@ -268,10 +269,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
result = Curl_blockread_all(cf, data, (char *)sspi_recv_token.pvBuffer,
|
||||
sspi_recv_token.cbBuffer, &actualread);
|
||||
err = Curl_blockread_all(cf, data, (char *)sspi_recv_token.pvBuffer,
|
||||
sspi_recv_token.cbBuffer, &actualread);
|
||||
|
||||
if(result || (actualread != us_length)) {
|
||||
if(err || (actualread != us_length)) {
|
||||
failf(data, "Failed to receive SSPI authentication token.");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
|
|
@ -452,8 +453,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
Curl_safefree(etbuf);
|
||||
}
|
||||
|
||||
result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
|
||||
if(result || (actualread != 4)) {
|
||||
err = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
|
||||
if(err || (actualread != 4)) {
|
||||
failf(data, "Failed to receive SSPI encryption response.");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
|
|
@ -484,10 +485,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
goto error;
|
||||
}
|
||||
|
||||
result = Curl_blockread_all(cf, data, (char *)sspi_w_token[0].pvBuffer,
|
||||
sspi_w_token[0].cbBuffer, &actualread);
|
||||
err = Curl_blockread_all(cf, data, (char *)sspi_w_token[0].pvBuffer,
|
||||
sspi_w_token[0].cbBuffer, &actualread);
|
||||
|
||||
if(result || (actualread != us_length)) {
|
||||
if(err || (actualread != us_length)) {
|
||||
failf(data, "Failed to receive SSPI encryption type.");
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
|
|
|
|||
|
|
@ -365,11 +365,18 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
|
|||
set->in_set = stdin; /* default input from stdin */
|
||||
set->err = stderr; /* default stderr to stderr */
|
||||
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
/* use fwrite as default function to store output */
|
||||
set->fwrite_func = (curl_write_callback)fwrite;
|
||||
|
||||
/* use fread as default function to read input */
|
||||
set->fread_func_set = (curl_read_callback)fread;
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
set->is_fread_set = 0;
|
||||
|
||||
set->seek_client = ZERO_NULL;
|
||||
|
|
|
|||
|
|
@ -42,11 +42,13 @@
|
|||
#include "curl_memory.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
/* MS-DOS/Windows style drive prefix, eg c: in c:foo */
|
||||
#define STARTS_WITH_DRIVE_PREFIX(str) \
|
||||
((('a' <= str[0] && str[0] <= 'z') || \
|
||||
('A' <= str[0] && str[0] <= 'Z')) && \
|
||||
(str[1] == ':'))
|
||||
#endif
|
||||
|
||||
/* MS-DOS/Windows style drive prefix, optionally with
|
||||
* a '|' instead of ':', followed by a slash or NUL */
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@
|
|||
|
||||
|
||||
#define QUIC_MAX_STREAMS (256*1024)
|
||||
#define QUIC_MAX_DATA (1*1024*1024)
|
||||
#define QUIC_HANDSHAKE_TIMEOUT (10*NGTCP2_SECONDS)
|
||||
|
||||
/* A stream window is the maximum amount we need to buffer for
|
||||
|
|
@ -102,8 +101,6 @@
|
|||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE ) / 2
|
||||
/* Receive and Send max number of chunks just follows from the
|
||||
* chunk size and window size */
|
||||
#define H3_STREAM_RECV_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
#define H3_STREAM_SEND_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
|
|
@ -1445,10 +1442,6 @@ cb_h3_read_req_body(nghttp3_conn *conn, int64_t stream_id,
|
|||
return (nghttp3_ssize)nvecs;
|
||||
}
|
||||
|
||||
/* Index where :authority header field will appear in request header
|
||||
field list. */
|
||||
#define AUTHORITY_DST_IDX 3
|
||||
|
||||
static CURLcode h3_stream_open(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
const void *buf, size_t len,
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@
|
|||
* chunk size and window size */
|
||||
#define H3_STREAM_RECV_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
#define H3_STREAM_SEND_CHUNKS \
|
||||
(H3_STREAM_WINDOW_SIZE / H3_STREAM_CHUNK_SIZE)
|
||||
|
||||
/*
|
||||
* Store quiche version info in this buffer.
|
||||
|
|
@ -955,10 +953,6 @@ static CURLcode cf_quiche_send_body(struct Curl_cfilter *cf,
|
|||
}
|
||||
}
|
||||
|
||||
/* Index where :authority header field will appear in request header
|
||||
field list. */
|
||||
#define AUTHORITY_DST_IDX 3
|
||||
|
||||
static CURLcode h3_open_stream(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
const char *buf, size_t blen, bool eos,
|
||||
|
|
|
|||
|
|
@ -1216,9 +1216,6 @@ sftp_upload_init(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/* make sure that this does not collide with an actual libssh2 error code */
|
||||
#define ERROR_LIBBSH2 1
|
||||
|
||||
static CURLcode ssh_state_pkey_init(struct Curl_easy *data,
|
||||
struct ssh_conn *sshc)
|
||||
{
|
||||
|
|
@ -3411,12 +3408,19 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
|
|||
*/
|
||||
#if LIBSSH2_VERSION_NUM >= 0x010b01
|
||||
infof(data, "Uses HTTPS proxy");
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
libssh2_session_callback_set2(sshc->ssh_session,
|
||||
LIBSSH2_CALLBACK_RECV,
|
||||
(libssh2_cb_generic *)ssh_tls_recv);
|
||||
libssh2_session_callback_set2(sshc->ssh_session,
|
||||
LIBSSH2_CALLBACK_SEND,
|
||||
(libssh2_cb_generic *)ssh_tls_send);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* This crazy union dance is here to avoid assigning a void pointer a
|
||||
|
|
|
|||
|
|
@ -2064,7 +2064,7 @@ static CURLcode gtls_shutdown(struct Curl_cfilter *cf,
|
|||
(struct gtls_ssl_backend_data *)connssl->backend;
|
||||
char buf[1024];
|
||||
CURLcode result = CURLE_OK;
|
||||
ssize_t nread;
|
||||
ssize_t nread = 0;
|
||||
size_t i;
|
||||
|
||||
DEBUGASSERT(backend);
|
||||
|
|
|
|||
|
|
@ -1160,7 +1160,7 @@ static CURLcode mbedtls_shutdown(struct Curl_cfilter *cf,
|
|||
(struct mbed_ssl_backend_data *)connssl->backend;
|
||||
unsigned char buf[1024];
|
||||
CURLcode result = CURLE_OK;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
size_t i;
|
||||
|
||||
DEBUGASSERT(backend);
|
||||
|
|
|
|||
|
|
@ -137,13 +137,13 @@ static void ossl_provider_cleanup(struct Curl_easy *data);
|
|||
|
||||
#if defined(USE_OPENSSL_ENGINE) || defined(OPENSSL_HAS_PROVIDERS)
|
||||
#include <openssl/ui.h>
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
#define OSSL_UI_METHOD_CAST(x) (x)
|
||||
#else
|
||||
#define OSSL_UI_METHOD_CAST(x) CURL_UNCONST(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L /* OpenSSL 1.1.0+ and LibreSSL */
|
||||
#define HAVE_X509_GET0_EXTENSIONS 1 /* added in 1.1.0 -pre1 */
|
||||
|
|
@ -1631,7 +1631,14 @@ static int pkcs12load(struct Curl_easy *data,
|
|||
fail:
|
||||
EVP_PKEY_free(pri);
|
||||
X509_free(x509);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
sk_X509_pop_free(ca, X509_free);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
if(!cert_done)
|
||||
return 0; /* failure! */
|
||||
return 1;
|
||||
|
|
@ -3158,7 +3165,14 @@ static CURLcode load_cacert_from_memory(X509_STORE *store,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
sk_X509_INFO_pop_free(inf, X509_INFO_free);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
BIO_free(cbio);
|
||||
|
||||
/* if we did not end up importing anything, treat that as an error */
|
||||
|
|
|
|||
|
|
@ -432,7 +432,7 @@ cr_get_selected_ciphers(struct Curl_easy *data,
|
|||
{
|
||||
const size_t supported_len = *selected_size;
|
||||
const size_t default_len = rustls_default_crypto_provider_ciphersuites_len();
|
||||
const struct rustls_supported_ciphersuite *entry;
|
||||
const struct rustls_supported_ciphersuite *entry = NULL;
|
||||
const char *ciphers = ciphers12;
|
||||
size_t count = 0, default13_count = 0, i, j;
|
||||
const char *ptr, *end;
|
||||
|
|
@ -1315,7 +1315,7 @@ cr_shutdown(struct Curl_cfilter *cf,
|
|||
struct rustls_ssl_backend_data *backend =
|
||||
(struct rustls_ssl_backend_data *)connssl->backend;
|
||||
CURLcode result = CURLE_OK;
|
||||
size_t i, nread, nwritten;
|
||||
size_t i, nread = 0, nwritten;
|
||||
|
||||
DEBUGASSERT(backend);
|
||||
if(!backend->conn || cf->shutdown) {
|
||||
|
|
|
|||
|
|
@ -771,7 +771,9 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
|
|||
|
||||
SCH_CREDENTIALS credentials = { 0 };
|
||||
TLS_PARAMETERS tls_parameters = { 0 };
|
||||
CRYPTO_SETTINGS crypto_settings[1] = { { 0 } };
|
||||
CRYPTO_SETTINGS crypto_settings[1];
|
||||
|
||||
memset(crypto_settings, 0, sizeof(crypto_settings));
|
||||
|
||||
tls_parameters.pDisabledCrypto = crypto_settings;
|
||||
|
||||
|
|
@ -2551,10 +2553,17 @@ static int schannel_init(void)
|
|||
{
|
||||
#if defined(HAS_ALPN_SCHANNEL) && !defined(UNDER_CE)
|
||||
typedef const char *(APIENTRY *WINE_GET_VERSION_FN)(void);
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type-strict"
|
||||
#endif
|
||||
WINE_GET_VERSION_FN p_wine_get_version =
|
||||
CURLX_FUNCTION_CAST(WINE_GET_VERSION_FN,
|
||||
(GetProcAddress(GetModuleHandleA("ntdll"),
|
||||
"wine_get_version")));
|
||||
#if defined(__clang__) && __clang_major__ >= 16
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
if(p_wine_get_version) { /* WINE detected */
|
||||
const char *wine_version = p_wine_get_version(); /* e.g. "6.0.2" */
|
||||
/* Assume ALPN support with WINE 6.0 or upper */
|
||||
|
|
|
|||
|
|
@ -1095,9 +1095,6 @@ static CURLcode ssl_version(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
|
||||
#define QUIC_CIPHERS \
|
||||
"TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_" \
|
||||
"POLY1305_SHA256:TLS_AES_128_CCM_SHA256"
|
||||
#define QUIC_GROUPS "P-256:P-384:P-521"
|
||||
|
||||
CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ static const char *getASN1Element_(struct Curl_asn1Element *elem,
|
|||
elem->header = beg;
|
||||
b = (unsigned char) *beg++;
|
||||
elem->constructed = (b & 0x20) != 0;
|
||||
elem->class = (b >> 6) & 3;
|
||||
elem->eclass = (b >> 6) & 3;
|
||||
b &= 0x1F;
|
||||
if(b == 0x1F)
|
||||
return NULL; /* Long tag values not supported here. */
|
||||
|
|
@ -456,7 +456,7 @@ static CURLcode encodeOID(struct dynbuf *store,
|
|||
x = 0;
|
||||
do {
|
||||
if(x & 0xFF000000)
|
||||
return 0;
|
||||
return CURLE_OK;
|
||||
y = *(const unsigned char *) beg++;
|
||||
x = (x << 7) | (y & 0x7F);
|
||||
} while(y & 0x80);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct Curl_asn1Element {
|
|||
const char *header; /* Pointer to header byte. */
|
||||
const char *beg; /* Pointer to element data. */
|
||||
const char *end; /* Pointer to 1st byte after element. */
|
||||
unsigned char class; /* ASN.1 element class. */
|
||||
unsigned char eclass; /* ASN.1 element class. */
|
||||
unsigned char tag; /* ASN.1 element tag. */
|
||||
BIT(constructed); /* Element is constructed. */
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue