summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-11-06 07:23:32 +0100
committerGitHub <noreply@github.com>2021-11-06 14:23:32 +0800
commitbd613c704c0d74352d427ab32369310a04f5b721 (patch)
tree56a2184ba9d11a9170fa7b37b601992e90d6b6be /modules
parent5e0cf4b82e10e72cd9754326e3183409afdb736c (diff)
downloadgitea-bd613c704c0d74352d427ab32369310a04f5b721.tar.gz
gitea-bd613c704c0d74352d427ab32369310a04f5b721.zip
Fix ipv6 parsing for builtin ssh server (#17561)
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/ssh.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index 909ed32c5e..5f19dd4a5c 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -17,6 +17,7 @@ import (
"os"
"os/exec"
"path/filepath"
+ "strconv"
"strings"
"sync"
"syscall"
@@ -264,7 +265,7 @@ func sshConnectionFailed(conn net.Conn, err error) {
// Listen starts a SSH server listens on given port.
func Listen(host string, port int, ciphers []string, keyExchanges []string, macs []string) {
srv := ssh.Server{
- Addr: fmt.Sprintf("%s:%d", host, port),
+ Addr: net.JoinHostPort(host, strconv.Itoa(port)),
PublicKeyHandler: publicKeyHandler,
Handler: sessionHandler,
ServerConfigCallback: func(ctx ssh.Context) *gossh.ServerConfig {