From 1b8d8d08c91e2f54e8e95ec9ccdbf7d08971c2f7 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 5 Oct 2021 11:10:48 +0200 Subject: [PATCH] db_sqlite: fix realname not fetched in ListUsers This fixes per-user realname not being used on bouncer startup. --- db_sqlite.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db_sqlite.go b/db_sqlite.go index 01d1d58..21c8382 100644 --- a/db_sqlite.go +++ b/db_sqlite.go @@ -216,7 +216,7 @@ func (db *SqliteDB) ListUsers() ([]User, error) { db.lock.RLock() defer db.lock.RUnlock() - rows, err := db.db.Query("SELECT id, username, password, admin FROM User") + rows, err := db.db.Query("SELECT id, username, password, admin, realname FROM User") if err != nil { return nil, err } @@ -225,11 +225,12 @@ func (db *SqliteDB) ListUsers() ([]User, error) { var users []User for rows.Next() { var user User - var password sql.NullString - if err := rows.Scan(&user.ID, &user.Username, &password, &user.Admin); err != nil { + var password, realname sql.NullString + if err := rows.Scan(&user.ID, &user.Username, &password, &user.Admin, &realname); err != nil { return nil, err } user.Password = password.String + user.Realname = realname.String users = append(users, user) } if err := rows.Err(); err != nil {