downstream: fix nil pointer deref in downstreamConn.setUser

References: https://lists.sr.ht/~emersion/soju-dev/%3CCR6PX9SU5FSO.3UR92LHKXOXML%40hades.moritz.sh%3E
This commit is contained in:
Simon Ser 2023-03-15 17:32:44 +01:00
parent 6b82ed990c
commit 4ca8dfa37d
1 changed files with 1 additions and 1 deletions

View File

@ -1249,7 +1249,7 @@ func unmarshalUsername(rawUsername string) (username, client, network string) {
func (dc *downstreamConn) setUser(username, clientName, networkName string) error {
dc.user = dc.srv.getUser(username)
if dc.user == nil && dc.user.srv.Config().EnableUsersOnAuth {
if dc.user == nil && dc.srv.Config().EnableUsersOnAuth {
ctx := context.TODO()
if _, err := dc.user.srv.db.GetUser(ctx, username); err != nil {
// Can't find the user in the DB -- try to create it