Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oidc_child: use CURLOPT_PROTOCOLS_STR if available #7575

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/external/libcurl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,15 @@ AC_SUBST(CURL_LIBS)
AC_SUBST(CURL_CFLAGS)

PKG_CHECK_MODULES([CURL], [libcurl], [found_libcurl=yes], [found_libcurl=no])

AC_MSG_CHECKING([whether libcurl knows CURLOPT_PROTOCOLS_STR])

AC_LINK_IFELSE(
[AC_LANG_SOURCE([
#include <curl/curl.h>
int main () {
return CURLOPT_PROTOCOLS_STR;
alexey-tikhonov marked this conversation as resolved.
Show resolved Hide resolved
}])],
[AC_MSG_RESULT([yes]); AC_DEFINE_UNQUOTED([HAVE_CURLOPT_PROTOCOLS_STR], [1], [CURLOPT_PROTOCOLS_STR available]) ],
[AC_MSG_RESULT([no])]
)
4 changes: 4 additions & 0 deletions src/oidc_child/oidc_child_curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ static errno_t set_http_opts(CURL *curl_ctx, struct devicecode_ctx *dc_ctx,
int ret;

/* Only allow https */
#ifdef HAVE_CURLOPT_PROTOCOLS_STR
res = curl_easy_setopt(curl_ctx, CURLOPT_PROTOCOLS_STR, "https");
#else
res = curl_easy_setopt(curl_ctx, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
#endif
if (res != CURLE_OK) {
DEBUG(SSSDBG_OP_FAILURE, "Failed to enforce HTTPS.\n");
ret = EIO;
Expand Down
Loading