aboutsummaryrefslogtreecommitdiff
path: root/ssh_handle_receive_pack.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 20:39:08 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 20:39:08 +0800
commit0e112aec65c4c36a36c1df9ecfb87b20ad1d7f38 (patch)
tree6c44d89bfad25dc56d67334c903d15bdf81cb4e3 /ssh_handle_receive_pack.go
parentsshPubkey* shall no longer be global variables (diff)
downloadforge-0e112aec65c4c36a36c1df9ecfb87b20ad1d7f38.tar.gz
forge-0e112aec65c4c36a36c1df9ecfb87b20ad1d7f38.tar.zst
forge-0e112aec65c4c36a36c1df9ecfb87b20ad1d7f38.zip
packPasses shall no longer be a global variable
Diffstat (limited to 'ssh_handle_receive_pack.go')
-rw-r--r--ssh_handle_receive_pack.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/ssh_handle_receive_pack.go b/ssh_handle_receive_pack.go
index 317609f..33262e4 100644
--- a/ssh_handle_receive_pack.go
+++ b/ssh_handle_receive_pack.go
@@ -11,7 +11,6 @@ import (
gliderSSH "github.com/gliderlabs/ssh"
"github.com/go-git/go-git/v5"
- "go.lindenii.runxiyu.org/lindenii-common/cmap"
)
// packPass contains information known when handling incoming SSH connections
@@ -30,9 +29,6 @@ type packPass struct {
contribReq string
}
-// packPasses contains hook cookies mapped to their packPass.
-var packPasses = cmap.Map[string, packPass]{}
-
// sshHandleRecvPack handles attempts to push to repos.
func (s *server) sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdentifier string) (err error) {
groupPath, repoName, repoID, repoPath, directAccess, contribReq, userType, userID, err := s.getRepoInfo2(session.Context(), repoIdentifier, pubkey)
@@ -95,7 +91,7 @@ func (s *server) sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdenti
fmt.Fprintln(session.Stderr(), "Error while generating cookie:", err)
}
- packPasses.Store(cookie, packPass{
+ s.packPasses.Store(cookie, packPass{
session: session,
pubkey: pubkey,
directAccess: directAccess,
@@ -108,7 +104,7 @@ func (s *server) sshHandleRecvPack(session gliderSSH.Session, pubkey, repoIdenti
contribReq: contribReq,
userType: userType,
})
- defer packPasses.Delete(cookie)
+ defer s.packPasses.Delete(cookie)
// The Delete won't execute until proc.Wait returns unless something
// horribly wrong such as a panic occurs.