0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-27 17:06:27 +02:00

adapt to single-return util.CryptoRandomString

This commit is contained in:
pomidorry 2026-05-16 23:12:10 +03:00
parent 6d34f8b279
commit 2911b6e0a2
2 changed files with 2 additions and 9 deletions

View File

@ -166,11 +166,7 @@ func CreateTemporaryAgent(privateKey ed25519.PrivateKey) (string, func(), error)
return "", nil, err
}
agentID, err := util.CryptoRandomString(16)
if err != nil {
agent.Close()
return "", nil, fmt.Errorf("failed to generate agent ID: %w", err)
}
agentID := util.CryptoRandomString(16)
globalAgentManager.mu.Lock()
globalAgentManager.agents[agentID] = agent

View File

@ -17,10 +17,7 @@ import (
// createAgentListener creates a Windows named pipe listener for the SSH agent.
// Returns the listener, pipe path, and a cleanup function for early-return error paths.
func createAgentListener() (net.Listener, string, func(), error) {
agentID, err := util.CryptoRandomString(16)
if err != nil {
return nil, "", nil, fmt.Errorf("failed to generate agent ID: %w", err)
}
agentID := util.CryptoRandomString(16)
pipePath := `\\.\pipe\gitea-ssh-agent-` + agentID
listener, err := winio.ListenPipe(pipePath, nil)