check authEnabled
This commit is contained in:
committed by
mattn
parent
4372bf2fb0
commit
eb86f084da
@@ -43,7 +43,10 @@ func TestCorruptDbErrors(t *testing.T) {
|
|||||||
_, err = db.Exec("drop table foo")
|
_, err = db.Exec("drop table foo")
|
||||||
}
|
}
|
||||||
|
|
||||||
sqliteErr := err.(Error)
|
sqliteErr, ok := err.(Error)
|
||||||
|
if !ok {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
if sqliteErr.Code != ErrNotADB {
|
if sqliteErr.Code != ErrNotADB {
|
||||||
t.Error("wrong error code for corrupted DB")
|
t.Error("wrong error code for corrupted DB")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1568,10 +1568,12 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if conn.AuthEnabled() {
|
||||||
// Preform Authentication
|
// Preform Authentication
|
||||||
if err := conn.Authenticate(authUser, authPass); err != nil {
|
if err := conn.Authenticate(authUser, authPass); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register: authenticate
|
// Register: authenticate
|
||||||
// Authenticate will perform an authentication of the provided username
|
// Authenticate will perform an authentication of the provided username
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ func (c *SQLiteConn) AuthEnabled() (exists bool) {
|
|||||||
// 0 - Disabled
|
// 0 - Disabled
|
||||||
// 1 - Enabled
|
// 1 - Enabled
|
||||||
func (c *SQLiteConn) authEnabled() int {
|
func (c *SQLiteConn) authEnabled() int {
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user