Skip to content

Commit eb86f08

Browse files
committed
check authEnabled
1 parent 4372bf2 commit eb86f08

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

error_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ func TestCorruptDbErrors(t *testing.T) {
4343
_, err = db.Exec("drop table foo")
4444
}
4545

46-
sqliteErr := err.(Error)
46+
sqliteErr, ok := err.(Error)
47+
if !ok {
48+
t.Fatal(err)
49+
}
4750
if sqliteErr.Code != ErrNotADB {
4851
t.Error("wrong error code for corrupted DB")
4952
}

sqlite3.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,9 +1568,11 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
15681568
}
15691569
}
15701570

1571-
// Preform Authentication
1572-
if err := conn.Authenticate(authUser, authPass); err != nil {
1573-
return nil, err
1571+
if conn.AuthEnabled() {
1572+
// Preform Authentication
1573+
if err := conn.Authenticate(authUser, authPass); err != nil {
1574+
return nil, err
1575+
}
15741576
}
15751577

15761578
// Register: authenticate

sqlite3_opt_userauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (c *SQLiteConn) AuthEnabled() (exists bool) {
161161
// 0 - Disabled
162162
// 1 - Enabled
163163
func (c *SQLiteConn) authEnabled() int {
164-
return 1
164+
return 0
165165
}
166166

167167
// EOF

0 commit comments

Comments
 (0)