From 1a3d7d4ae6ba7e43e3eeb12aadfb707b808eea6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Fern=C3=A1ndez?= Date: Sat, 14 Dec 2024 02:53:32 -0300 Subject: [PATCH] Fix a few issues with the C generator (part 5) (#20313) * [C] Default to requiring valid SSL * Update samples --------- Co-authored-by: Sam Bingner --- .../src/main/resources/C-libcurl/apiClient.c.mustache | 4 ++-- samples/client/others/c/bearerAuth/src/apiClient.c | 4 ++-- samples/client/petstore/c-useJsonUnformatted/src/apiClient.c | 4 ++-- samples/client/petstore/c/src/apiClient.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache index 59337953359..899cb22ef7a 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache @@ -447,8 +447,8 @@ void apiClient_invoke(apiClient_t *apiClient, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } else { - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } diff --git a/samples/client/others/c/bearerAuth/src/apiClient.c b/samples/client/others/c/bearerAuth/src/apiClient.c index fafdcd49df8..6614016d27a 100644 --- a/samples/client/others/c/bearerAuth/src/apiClient.c +++ b/samples/client/others/c/bearerAuth/src/apiClient.c @@ -363,8 +363,8 @@ void apiClient_invoke(apiClient_t *apiClient, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } else { - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } diff --git a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c index 943e43915a9..302cb8bff34 100644 --- a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c +++ b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c @@ -390,8 +390,8 @@ void apiClient_invoke(apiClient_t *apiClient, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } else { - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index 943e43915a9..302cb8bff34 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -390,8 +390,8 @@ void apiClient_invoke(apiClient_t *apiClient, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } } else { - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L); - curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L); + curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 2L); } }