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.

git-svn-id: file:///srv/svn/repo/suika/trunk@789 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2022-03-03 07:35:34 +00:00
parent 488107b3d4
commit 0327068bdd

View File

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