1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 08:02:19 +00:00

I am an idiot, don't let only people with the *wrong* password stream

This commit is contained in:
Yohann D'ANELLO 2021-01-08 23:05:01 +01:00
parent 79f52ed880
commit 34652f8f3e
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 2 additions and 2 deletions

View File

@ -45,12 +45,12 @@ func (a LDAP) Login(username string, password string) (bool, string, error) {
log.Printf("[LDAP] Logging to %s...", bindDn) log.Printf("[LDAP] Logging to %s...", bindDn)
err = a.Conn.Bind(bindDn, password) err = a.Conn.Bind(bindDn, password)
if err == nil { if err == nil {
log.Printf("[LDAP] Logging failed: %s", err)
// Login succeeded if no error // Login succeeded if no error
return true, aliasSplit[0], nil return true, aliasSplit[0], nil
} }
} }
log.Printf("[LDAP] Logging failed: %s", err)
// Unable to log in // Unable to log in
return err == nil, "", err return err == nil, "", err
} }

View File

@ -83,7 +83,7 @@ func Serve(streams *messaging.Streams, authBackend auth.Backend, cfg *Options) {
if authBackend != nil { if authBackend != nil {
// check password // check password
ok, username, err := authBackend.Login(name, password) ok, username, err := authBackend.Login(name, password)
if ok || err != nil { if !ok || err != nil {
log.Printf("Failed to authenticate for stream %s", name) log.Printf("Failed to authenticate for stream %s", name)
s.Close() s.Close()
continue continue