1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-07-04 10:32:16 +02:00

3 Commits

2 changed files with 4 additions and 2 deletions

View File

@ -42,6 +42,7 @@ func (a LDAP) Login(username string, password string) (bool, string, error) {
for _, username := range potentialUsernames {
// Try to bind as user
bindDn := "cn=" + username + "," + a.Cfg.UserDn
log.Printf("[LDAP] Logging to %s...", bindDn)
err = a.Conn.Bind(bindDn, password)
if err == nil {
// Login succeeded if no error
@ -49,6 +50,7 @@ func (a LDAP) Login(username string, password string) (bool, string, error) {
}
}
log.Printf("[LDAP] Logging failed: %s", err)
// Unable to log in
return err == nil, "", err
}

View File

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