downstream: be less strict when picking up client name

Allow e.g. the SASL username to contain "username/network" and the
raw username to contain "username@client", for instance.
This commit is contained in:
Simon Ser 2022-03-03 08:35:34 +01:00
parent df4af1856a
commit 348e6da1fc

View File

@ -1287,8 +1287,12 @@ func (dc *downstreamConn) register(ctx context.Context) error {
} }
} }
if dc.clientName == "" && dc.networkName == "" { _, fallbackClientName, fallbackNetworkName := unmarshalUsername(dc.rawUsername)
_, dc.clientName, dc.networkName = unmarshalUsername(dc.rawUsername) if dc.clientName == "" {
dc.clientName = fallbackClientName
}
if dc.networkName == "" {
dc.networkName = fallbackNetworkName
} }
dc.registered = true dc.registered = true