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:
parent
6b82ed990c
commit
4ca8dfa37d
@ -1249,7 +1249,7 @@ func unmarshalUsername(rawUsername string) (username, client, network string) {
|
|||||||
|
|
||||||
func (dc *downstreamConn) setUser(username, clientName, networkName string) error {
|
func (dc *downstreamConn) setUser(username, clientName, networkName string) error {
|
||||||
dc.user = dc.srv.getUser(username)
|
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()
|
ctx := context.TODO()
|
||||||
if _, err := dc.user.srv.db.GetUser(ctx, username); err != nil {
|
if _, err := dc.user.srv.db.GetUser(ctx, username); err != nil {
|
||||||
// Can't find the user in the DB -- try to create it
|
// Can't find the user in the DB -- try to create it
|
||||||
|
Loading…
Reference in New Issue
Block a user