From 16da4cf549392e4a0b34d3a8f1dc8c3488460361 Mon Sep 17 00:00:00 2001 From: Ryan Jobse Date: Fri, 15 Mar 2024 14:14:48 -0400 Subject: [PATCH] cleaning up logic --- core/src/main/scala/kafka/server/KafkaApis.scala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/main/scala/kafka/server/KafkaApis.scala b/core/src/main/scala/kafka/server/KafkaApis.scala index fd0317cbb6d2f..924d17511f7df 100644 --- a/core/src/main/scala/kafka/server/KafkaApis.scala +++ b/core/src/main/scala/kafka/server/KafkaApis.scala @@ -1941,7 +1941,6 @@ class KafkaApis(val requestChannel: RequestChannel, // with client authentication which is performed at an earlier stage of the connection where the // ApiVersionRequest is not available. val apiVersionRequest = request.body[ApiVersionsRequest] - val expectedClientSoftwareNames = config.expectedClientSoftwareNames val softwareName = apiVersionRequest.data.clientSoftwareName().split("-").last var isXinfraClient = false if (softwareName != null && softwareName.toLowerCase.contains("xinfra")) { @@ -1951,8 +1950,7 @@ class KafkaApis(val requestChannel: RequestChannel, if (config.unofficialClientLoggingEnable) { // Check if the last part of clientSoftwareName (after commitId) is an unexpected software name - val softwareName = apiVersionRequest.data.clientSoftwareName().split("-").last - if (!expectedClientSoftwareNames.contains(softwareName)) { + if (!config.expectedClientSoftwareNames.contains(softwareName)) { val clientIdentity = request.context.clientId() + " " + request.context.clientAddress() + " " + request.context.principal() unofficialClientsCache.get(clientIdentity) warn(s"received ApiVersionsRequest from user with unofficial client type. clientId clientAddress principal = $clientIdentity")