Update pam to v2.0.0

This commit is contained in:
Conrad Hoffmann 2024-04-19 17:37:55 +02:00
parent adb2a8bdfb
commit 832c91beba
3 changed files with 10 additions and 4 deletions

View file

@ -6,7 +6,7 @@ import (
"fmt"
"net/http"
"github.com/msteinert/pam"
"github.com/msteinert/pam/v2"
"github.com/rs/zerolog/log"
)
@ -48,6 +48,12 @@ func pamAuth(next http.Handler, w http.ResponseWriter, r *http.Request) {
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
return
}
defer func() {
err := t.End()
if err != nil {
log.Warn().Err(err).Msg("failed to end PAM transaction")
}
}()
if err := t.Authenticate(0); err != nil {
log.Debug().Str("user", user).Err(err).Msg("auth error")