Skip to content

Commit

Permalink
cleaning up logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JobseRyan committed Mar 15, 2024
1 parent 01147ef commit 16da4cf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/src/main/scala/kafka/server/KafkaApis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand All @@ -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")
Expand Down

0 comments on commit 16da4cf

Please sign in to comment.