mirror of https://github.com/ledisdb/ledisdb.git
Merge pull request #184 from ukd1/fix-initial-auth
Fix serious issue with auth
This commit is contained in:
commit
81381343f8
|
@ -88,7 +88,7 @@ func newClient(app *App) *client {
|
||||||
|
|
||||||
c.app = app
|
c.app = app
|
||||||
c.ldb = app.ldb
|
c.ldb = app.ldb
|
||||||
c.isAuthed = false || c.authEnabled()
|
c.isAuthed = false
|
||||||
c.db, _ = app.ldb.Select(0) //use default db
|
c.db, _ = app.ldb.Select(0) //use default db
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
|
@ -25,6 +25,12 @@ func TestAuth(t *testing.T) {
|
||||||
c2 := getTestConnAuth("password")
|
c2 := getTestConnAuth("password")
|
||||||
defer c2.Close()
|
defer c2.Close()
|
||||||
|
|
||||||
|
// Should fail doing a command as we've not authed
|
||||||
|
_, err = c2.Do("GET", "tmp_select_key")
|
||||||
|
if err.Error() != " not authenticated" {
|
||||||
|
t.Fatal("Expected authentication error:", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
_, err = c2.Do("AUTH", "password")
|
_, err = c2.Do("AUTH", "password")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue