]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Handle changes in libcurl options
authorNick Porter <nick@portercomputing.co.uk>
Fri, 9 Dec 2022 10:20:55 +0000 (10:20 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Fri, 9 Dec 2022 10:20:55 +0000 (10:20 +0000)
src/lib/curl/base.c
src/modules/rlm_imap/rlm_imap.c
src/modules/rlm_rest/rest.c
src/modules/rlm_smtp/rlm_smtp.c

index 2f6d02267e30ddaeb4f37c3e925bea01c4364fb4..081ebeeb0603870fc40cc6026f7dc65d1c912218 100644 (file)
@@ -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);
index 9fe2a2a9478960b98a8aeeaa2368c48f11fd1ad5..72e7713889f66e1c875ce50260111354f168932e 100644 (file)
@@ -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));
 
index 1f1273cdc0ba25e1d8e68c583e41fec69075eeec..37f7884dccc9b467fb4584e43090f77eae4e1319 100644 (file)
@@ -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, "*");
index e34b1efd80bd78e874825f5f6e5fe0fd0855e34f..b282ca32c02942b5775ec4ae607d1f3d388925ed 100644 (file)
@@ -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);