Skip to content

Commit

Permalink
Fix user and pass parameters are not separated by :
Browse files Browse the repository at this point in the history
It seems that the user and pass parameters are not passed from icecast
both in `pass` param separated by `:`, but rather as separated `user`
and `pass` params.

See: <https://icecast.org/docs/icecast-2.4.1/auth.html#source-auth>
  • Loading branch information
n-peugnet committed Mar 29, 2023
1 parent 382bad4 commit 7801693
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions app.go
Expand Up @@ -6,7 +6,6 @@ import (
"log"
"net/http"
"os"
"strings"
)

type user struct {
Expand Down Expand Up @@ -50,14 +49,8 @@ func ldapCheck(user user) bool {
func handler(w http.ResponseWriter, r *http.Request) {
var user user

passUser := strings.SplitN(r.FormValue("pass"), ":", 2)
if len(passUser) == 2 {
user.name = passUser[0]
user.password = passUser[1]
} else {
w.Header().Set("Icecast-Auth-Message", "Please provide user name in form of 'user:name'")
return
}
user.name = r.FormValue("user")
user.password = r.FormValue("pass")

if ldapCheck(user) {
w.Header().Set("icecast-auth-user", "1")
Expand Down

0 comments on commit 7801693

Please sign in to comment.