From: Nick Porter Date: Fri, 9 Dec 2022 10:20:55 +0000 (+0000) Subject: Handle changes in libcurl options X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37ea407b9f366249bd5b8bfc1b740614c6bd5438;p=thirdparty%2Ffreeradius-server.git Handle changes in libcurl options --- diff --git a/src/lib/curl/base.c b/src/lib/curl/base.c index 2f6d02267e3..081ebeeb060 100644 --- a/src/lib/curl/base.c +++ b/src/lib/curl/base.c @@ -82,7 +82,9 @@ int fr_curl_easy_tls_init(fr_curl_io_request_t *randle, fr_curl_tls_t const *con if (conf->ca_file) FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_CAINFO, conf->ca_file); if (conf->ca_issuer_file) FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_ISSUERCERT, conf->ca_issuer_file); if (conf->ca_path) FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_CAPATH, conf->ca_path); +#if !CURL_AT_LEAST_VERSION(7,84,0) if (conf->random_file) FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_RANDOM_FILE, conf->random_file); +#endif FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_USE_SSL, conf->require_cert); FR_CURL_ROPTIONAL_SET_OPTION(CURLOPT_SSL_VERIFYPEER, (conf->check_cert == true) ? 1L : 0L); diff --git a/src/modules/rlm_imap/rlm_imap.c b/src/modules/rlm_imap/rlm_imap.c index 9fe2a2a9478..72e7713889f 100644 --- a/src/modules/rlm_imap/rlm_imap.c +++ b/src/modules/rlm_imap/rlm_imap.c @@ -177,7 +177,11 @@ static unlang_action_t CC_HINT(nonnull(1,2)) mod_authenticate(rlm_rcode_t *p_res FR_CURL_REQUEST_SET_OPTION(CURLOPT_DEFAULT_PROTOCOL, "imap"); #endif FR_CURL_REQUEST_SET_OPTION(CURLOPT_URL, inst->uri); +#if CURL_AT_LEAST_VERSION(7,85,0) + FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS_STR, "imap,imaps"); +#else FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS, CURLPROTO_IMAP | CURLPROTO_IMAPS); +#endif FR_CURL_REQUEST_SET_OPTION(CURLOPT_CONNECTTIMEOUT_MS, fr_time_delta_to_msec(inst->timeout)); FR_CURL_REQUEST_SET_OPTION(CURLOPT_TIMEOUT_MS, fr_time_delta_to_msec(inst->timeout)); diff --git a/src/modules/rlm_rest/rest.c b/src/modules/rlm_rest/rest.c index 1f1273cdc0b..37f7884dccc 100644 --- a/src/modules/rlm_rest/rest.c +++ b/src/modules/rlm_rest/rest.c @@ -1752,7 +1752,11 @@ int rest_request_config(module_ctx_t const *mctx, rlm_rest_section_t const *sect * Setup any header options and generic headers. */ FR_CURL_REQUEST_SET_OPTION(CURLOPT_URL, uri); +#if CURL_AT_LEAST_VERSION(7,85,0) + FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS_STR, "http,https"); +#else FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); +#endif if (section->proxy) { if (section->proxy == rest_no_proxy) { FR_CURL_REQUEST_SET_OPTION(CURLOPT_NOPROXY, "*"); diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index e34b1efd80b..b282ca32c02 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -875,7 +875,11 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod #endif /* Set the generic curl request conditions */ FR_CURL_REQUEST_SET_OPTION(CURLOPT_URL, inst->uri); +#if CURL_AT_LEAST_VERSION(7,85,0) + FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS_STR, "smtp,smtps"); +#else FR_CURL_REQUEST_SET_OPTION(CURLOPT_PROTOCOLS, CURLPROTO_SMTP | CURLPROTO_SMTPS); +#endif FR_CURL_REQUEST_SET_OPTION(CURLOPT_CONNECTTIMEOUT_MS, fr_time_delta_to_msec(inst->timeout)); FR_CURL_REQUEST_SET_OPTION(CURLOPT_TIMEOUT_MS, fr_time_delta_to_msec(inst->timeout)); FR_CURL_REQUEST_SET_OPTION(CURLOPT_UPLOAD, 1L);