Skip to content

Commit ec4cf93

Browse files
authored
https.ca.pem requires CURLOPT_CAINFO_BLOB so at least CURL 7.77.0 (#5133)
1 parent 5cdc6ec commit ec4cf93

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ sasl.oauthbearer.assertion.file | * | |
117117
sasl.oauthbearer.assertion.claim.aud | * | | | low | JWT audience claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*
118118
sasl.oauthbearer.assertion.claim.exp.seconds | * | 1 .. 2147483647 | 300 | low | Assertion expiration time in seconds. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: integer*
119119
sasl.oauthbearer.assertion.claim.iss | * | | | low | JWT issuer claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*
120-
sasl.oauthbearer.assertion.claim.jti.include | * | true, false | false | low | JWT ID claim. When set to `true`a random UUID is generated. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: boolean*
120+
sasl.oauthbearer.assertion.claim.jti.include | * | true, false | false | low | JWT ID claim. When set to `true`, a random UUID is generated. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: boolean*
121121
sasl.oauthbearer.assertion.claim.nbf.seconds | * | 0 .. 2147483647 | 60 | low | Assertion not before time in seconds. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: integer*
122122
sasl.oauthbearer.assertion.claim.sub | * | | | low | JWT subject claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*
123123
sasl.oauthbearer.assertion.jwt.template.file | * | | | low | Path to the JWT template file. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*

src/rdhttp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ static void rd_http_ssl_configure(rd_kafka_t *rk, CURL *hreq_curl) {
248248
curl_easy_setopt(hreq_curl, CURLOPT_CAPATH, NULL);
249249
}
250250
} else if (!force_probe && rk->rk_conf.https.ca_pem) {
251+
#if CURL_AT_LEAST_VERSION(7, 77, 0)
251252
struct curl_blob ca_blob = {
252253
.data = rk->rk_conf.https.ca_pem,
253254
.len = strlen(rk->rk_conf.https.ca_pem),
@@ -256,6 +257,7 @@ static void rd_http_ssl_configure(rd_kafka_t *rk, CURL *hreq_curl) {
256257
"Setting `https` CA certs from "
257258
"configured PEM string");
258259
curl_easy_setopt(hreq_curl, CURLOPT_CAINFO_BLOB, &ca_blob);
260+
#endif
259261
/* Only the blob should be set, no default paths. */
260262
curl_easy_setopt(hreq_curl, CURLOPT_CAINFO, NULL);
261263
curl_easy_setopt(hreq_curl, CURLOPT_CAPATH, NULL);

src/rdkafka_conf.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
#include <windows.h>
5757
#endif
5858

59+
#ifdef WITH_OAUTHBEARER_OIDC
60+
#include <curl/curl.h>
61+
#endif
62+
5963
struct rd_kafka_property {
6064
rd_kafka_conf_scope_t scope;
6165
const char *name;
@@ -1179,7 +1183,7 @@ static const struct rd_kafka_property rd_kafka_properties[] = {
11791183
_UNSUPPORTED_OIDC},
11801184
{_RK_GLOBAL, "sasl.oauthbearer.assertion.claim.jti.include", _RK_C_BOOL,
11811185
_RK(sasl.oauthbearer.assertion.claim.jti_include),
1182-
"JWT ID claim. When set to `true`a random UUID is generated. "
1186+
"JWT ID claim. When set to `true`, a random UUID is generated. "
11831187
"Only used when `sasl.oauthbearer.method` is set to \"oidc\" and JWT "
11841188
"assertion is needed.",
11851189
0, 1, 0, _UNSUPPORTED_OIDC},
@@ -3960,11 +3964,17 @@ const char *rd_kafka_conf_finalize(rd_kafka_type_t cltype,
39603964
if (conf->https.ca_location && conf->https.ca_pem)
39613965
return "`https.ca.location` and `https.ca.pem` "
39623966
"are mutually exclusive";
3967+
39633968
if (conf->https.ca_location &&
39643969
rd_strcmp(conf->https.ca_location, "probe") &&
39653970
!rd_file_stat(conf->https.ca_location, NULL))
39663971
return "`https.ca.location` must be "
39673972
"an existing file or directory";
3973+
3974+
#if !CURL_AT_LEAST_VERSION(7, 77, 0)
3975+
if (conf->https.ca_pem)
3976+
return "`https.ca.pem` requires libcurl 7.77.0 or later";
3977+
#endif
39683978
#endif
39693979

39703980

0 commit comments

Comments
 (0)