summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2023-02-28 18:48:41 +0000
committerIgor Drozdov <idrozdov@gitlab.com>2023-02-28 18:48:41 +0000
commitd893886d53c3038af84414589459d273609b2243 (patch)
tree61542db1398c44b7b3c8ae3bce4b4341b06fa24e
parent84324a0f22c5ee708d5174e76a2cba17702a5eca (diff)
parentc413f99cd6bb2df8465f1307c3e901626f11f4c2 (diff)
downloadgitlab-shell-d893886d53c3038af84414589459d273609b2243.tar.gz
Merge branch 'fix-static-build' into 'main'
sshd: exclude gssapi when building without cgo See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/720 Merged-by: Igor Drozdov <idrozdov@gitlab.com> Approved-by: Vasilii Iakliushin <viakliushin@gitlab.com> Approved-by: Igor Drozdov <idrozdov@gitlab.com> Reviewed-by: Vasilii Iakliushin <viakliushin@gitlab.com> Co-authored-by: Lorenz Brun <lorenz@brun.one>
-rw-r--r--internal/sshd/gssapi.go2
-rw-r--r--internal/sshd/gssapi_test.go2
-rw-r--r--internal/sshd/gssapi_unsupported.go34
3 files changed, 38 insertions, 0 deletions
diff --git a/internal/sshd/gssapi.go b/internal/sshd/gssapi.go
index bf65a15..c67b707 100644
--- a/internal/sshd/gssapi.go
+++ b/internal/sshd/gssapi.go
@@ -1,3 +1,5 @@
+//go:build cgo
+
package sshd
import (
diff --git a/internal/sshd/gssapi_test.go b/internal/sshd/gssapi_test.go
index f4f19cf..c417a41 100644
--- a/internal/sshd/gssapi_test.go
+++ b/internal/sshd/gssapi_test.go
@@ -1,3 +1,5 @@
+//go:build cgo
+
package sshd
import (
diff --git a/internal/sshd/gssapi_unsupported.go b/internal/sshd/gssapi_unsupported.go
new file mode 100644
index 0000000..27660af
--- /dev/null
+++ b/internal/sshd/gssapi_unsupported.go
@@ -0,0 +1,34 @@
+//go:build !cgo
+
+package sshd
+
+import (
+ "errors"
+
+ "gitlab.com/gitlab-org/gitlab-shell/v14/internal/config"
+
+ "gitlab.com/gitlab-org/labkit/log"
+)
+
+func LoadGSSAPILib(c *config.GSSAPIConfig) error {
+ if c.Enabled {
+ log.New().Error("gssapi-with-mic disabled, built without CGO")
+ c.Enabled = false
+ }
+ return nil
+}
+
+type OSGSSAPIServer struct {
+ ServicePrincipalName string
+}
+
+func (*OSGSSAPIServer) AcceptSecContext([]byte) ([]byte, string, bool, error) {
+ return []byte{}, "", false, errors.New("gssapi is unsupported")
+}
+
+func (*OSGSSAPIServer) VerifyMIC([]byte, []byte) error {
+ return errors.New("gssapi is unsupported")
+}
+func (*OSGSSAPIServer) DeleteSecContext() error {
+ return errors.New("gssapi is unsupported")
+}