M auth/pam.go => auth/pam.go +6 -1
@@ 6,7 6,7 @@ import (
"context"
"fmt"
- "github.com/msteinert/pam"
+ "github.com/msteinert/pam/v2"
"git.sr.ht/~emersion/soju/database"
)
@@ 35,6 35,7 @@ func (pamAuth) AuthPlain(ctx context.Context, db database.Database, username, pa
if err != nil {
return fmt.Errorf("failed to start PAM conversation: %v", err)
}
+ defer t.End()
if err := t.Authenticate(0); err != nil {
return newInvalidCredentialsError(fmt.Errorf("PAM auth error: %v", err))
@@ 51,5 52,9 @@ func (pamAuth) AuthPlain(ctx context.Context, db database.Database, username, pa
return fmt.Errorf("PAM user doesn't match supplied username")
}
+ if err := t.End(); err != nil {
+ return fmt.Errorf("failed to end PAM conversation: %v", err)
+ }
+
return nil
}
M go.mod => go.mod +1 -1
@@ 10,7 10,7 @@ require (
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.22
- github.com/msteinert/pam v1.2.0
+ github.com/msteinert/pam/v2 v2.0.0
github.com/pires/go-proxyproto v0.7.0
github.com/prometheus/client_golang v1.18.0
golang.org/x/crypto v0.21.0
M go.sum => go.sum +2 -2
@@ 32,8 32,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
-github.com/msteinert/pam v1.2.0 h1:mYfjlvN2KYs2Pb9G6nb/1f/nPfAttT/Jee5Sq9r3bGE=
-github.com/msteinert/pam v1.2.0/go.mod h1:d2n0DCUK8rGecChV3JzvmsDjOY4R7AYbsNxAT+ftQl0=
+github.com/msteinert/pam/v2 v2.0.0 h1:jnObb8MT6jvMbmrUQO5J/puTUjxy7Av+55zVJRJsCyE=
+github.com/msteinert/pam/v2 v2.0.0/go.mod h1:KT28NNIcDFf3PcBmNI2mIGO4zZJ+9RSs/At2PB3IDVc=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=