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

[WIP] Strip a trailing . when present in name - #4348 #4614

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 19 additions & 1 deletion src/rdkafka_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,25 @@ static int rd_kafka_transport_ssl_set_endpoint_id(rd_kafka_transport_t *rktrans,
return 0;

#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_IS_BORINGSSL)
if (!SSL_set1_host(rktrans->rktrans_ssl, name))
char *token, *hostname;
token = strtok(name, ":");
int ctr = 0;
while (token != NULL) {
if (ctr >= 2) {
hostname = &name;
break;
}
token = strtok(NULL, ":");
last_char = strlen(token) - 1
if (last_char > 0 && token[last_char] == '.') {
token[last_char] = '\0';
hostname = strncat(hostname, token, last_char);
} else {
hostname = strncat(hostname, token, strlen(token));
}
ctr += 1;
}
if (!SSL_set1_host(rktrans->rktrans_ssl, hostname))
goto fail;
#elif OPENSSL_VERSION_NUMBER >= 0x1000200fL /* 1.0.2 */
{
Expand Down