return error

This commit is contained in:
Yasuhiro Matsumoto
2025-07-30 20:26:53 +09:00
committed by mattn
parent c857a95a18
commit a9775d4d98

View File

@@ -29,6 +29,7 @@ const (
var ( var (
ErrUnauthorized = errors.New("SQLITE_AUTH: Unauthorized") ErrUnauthorized = errors.New("SQLITE_AUTH: Unauthorized")
ErrAdminRequired = errors.New("SQLITE_AUTH: Unauthorized; Admin Privileges Required") ErrAdminRequired = errors.New("SQLITE_AUTH: Unauthorized; Admin Privileges Required")
errUserAuthNoLongerSupported = errors.New("sqlite3: the sqlite_userauth tag is no longer supported as the userauth extension is no longer supported by the SQLite authors, see https://github.com/mattn/go-sqlite3/issues/1341").
) )
// Authenticate will perform an authentication of the provided username // Authenticate will perform an authentication of the provided username
@@ -45,7 +46,7 @@ var (
// If the SQLITE_USER table is not present in the database file, then // If the SQLITE_USER table is not present in the database file, then
// this interface is a harmless no-op returning SQLITE_OK. // this interface is a harmless no-op returning SQLITE_OK.
func (c *SQLiteConn) Authenticate(username, password string) error { func (c *SQLiteConn) Authenticate(username, password string) error {
return ErrUnauthorized return errUserAuthNoLongerSupported
} }
// authenticate provides the actual authentication to SQLite. // authenticate provides the actual authentication to SQLite.
@@ -70,7 +71,7 @@ func (c *SQLiteConn) authenticate(username, password string) int {
// for any ATTACH-ed databases. Any call to AuthUserAdd by a // for any ATTACH-ed databases. Any call to AuthUserAdd by a
// non-admin user results in an error. // non-admin user results in an error.
func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error { func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error {
return ErrUnauthorized return errUserAuthNoLongerSupported
} }
// authUserAdd enables the User Authentication if not enabled. // authUserAdd enables the User Authentication if not enabled.
@@ -97,7 +98,7 @@ func (c *SQLiteConn) authUserAdd(username, password string, admin int) int {
// credentials or admin privilege setting. No user may change their own // credentials or admin privilege setting. No user may change their own
// admin privilege setting. // admin privilege setting.
func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error { func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error {
return ErrUnauthorized return errUserAuthNoLongerSupported
} }
// authUserChange allows to modify a user. // authUserChange allows to modify a user.
@@ -127,7 +128,7 @@ func (c *SQLiteConn) authUserChange(username, password string, admin int) int {
// the database cannot be converted into a no-authentication-required // the database cannot be converted into a no-authentication-required
// database. // database.
func (c *SQLiteConn) AuthUserDelete(username string) error { func (c *SQLiteConn) AuthUserDelete(username string) error {
return ErrUnauthorized return errUserAuthNoLongerSupported
} }
// authUserDelete can be used to delete a user. // authUserDelete can be used to delete a user.