summaryrefslogtreecommitdiff
path: root/internal/command/receivepack
diff options
context:
space:
mode:
authorLorenz Brun <lorenz@dolansoft.org>2021-01-18 18:36:25 +0000
committerNick Thomas <nick@gitlab.com>2021-01-18 18:36:25 +0000
commit2a410f31b633ec5a994ecf1ff39dc8ffb9c6f828 (patch)
tree6ccc8b187438d1a218ee0ec833c339fa8faa8dd1 /internal/command/receivepack
parent0e5660917f0316a2197ffc5add7a8f01d3e428be (diff)
downloadgitlab-shell-2a410f31b633ec5a994ecf1ff39dc8ffb9c6f828.tar.gz
RFC: Simple built-in SSH server
Diffstat (limited to 'internal/command/receivepack')
-rw-r--r--internal/command/receivepack/gitalycall.go5
-rw-r--r--internal/command/receivepack/receivepack.go10
2 files changed, 11 insertions, 4 deletions
diff --git a/internal/command/receivepack/gitalycall.go b/internal/command/receivepack/gitalycall.go
index a983c1a..b27b75a 100644
--- a/internal/command/receivepack/gitalycall.go
+++ b/internal/command/receivepack/gitalycall.go
@@ -2,7 +2,6 @@ package receivepack
import (
"context"
- "os"
"google.golang.org/grpc"
@@ -13,7 +12,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/internal/handler"
)
-func (c *Command) performGitalyCall(response *accessverifier.Response) error {
+func (c *Command) performGitalyCall(response *accessverifier.Response, gitProtocolVersion string) error {
gc := &handler.GitalyCommand{
Config: c.Config,
ServiceName: string(commandargs.ReceivePack),
@@ -27,7 +26,7 @@ func (c *Command) performGitalyCall(response *accessverifier.Response) error {
GlId: response.Who,
GlRepository: response.Repo,
GlUsername: response.Username,
- GitProtocol: os.Getenv(commandargs.GitProtocolEnv),
+ GitProtocol: gitProtocolVersion,
GitConfigOptions: response.GitConfigOptions,
}
diff --git a/internal/command/receivepack/receivepack.go b/internal/command/receivepack/receivepack.go
index 4d5c686..5a67c5a 100644
--- a/internal/command/receivepack/receivepack.go
+++ b/internal/command/receivepack/receivepack.go
@@ -2,6 +2,7 @@ package receivepack
import (
"context"
+ "os"
"gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs"
"gitlab.com/gitlab-org/gitlab-shell/internal/command/readwriter"
@@ -38,7 +39,14 @@ func (c *Command) Execute(ctx context.Context) error {
return customAction.Execute(ctx, response)
}
- return c.performGitalyCall(response)
+ var gitProtocolVersion string
+ if c.Args.RemoteAddr != nil {
+ gitProtocolVersion = c.Args.GitProtocolVersion
+ } else {
+ gitProtocolVersion = os.Getenv(commandargs.GitProtocolEnv)
+ }
+
+ return c.performGitalyCall(response, gitProtocolVersion)
}
func (c *Command) verifyAccess(ctx context.Context, repo string) (*accessverifier.Response, error) {