From 4550e18b6be92eecb3620af2fbff1de1ff4e2372 Mon Sep 17 00:00:00 2001 From: sawka Date: Sat, 24 Sep 2022 13:53:19 -0700 Subject: [PATCH] version string will now be a real semantic version --- go.mod | 12 +++++++----- go.sum | 2 ++ main-mshell.go | 2 +- pkg/base/base.go | 2 +- pkg/shexec/client.go | 2 +- pkg/shexec/shexec.go | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 735e32fd6..02a9eb359 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,11 @@ module github.com/scripthaus-dev/mshell go 1.17 require ( - github.com/alessio/shellescape v1.4.1 // indirect - github.com/creack/pty v1.1.18 // indirect - github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/google/uuid v1.3.0 // indirect - golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect + github.com/alessio/shellescape v1.4.1 + github.com/creack/pty v1.1.18 + github.com/fsnotify/fsnotify v1.5.4 + github.com/google/uuid v1.3.0 + golang.org/x/sys v0.0.0-20220412211240-33da011f77ad ) + +require github.com/Masterminds/semver/v3 v3.1.1 // indirect diff --git a/go.sum b/go.sum index d802966af..32656449d 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= diff --git a/main-mshell.go b/main-mshell.go index 014b5a76e..0902de23e 100644 --- a/main-mshell.go +++ b/main-mshell.go @@ -499,7 +499,7 @@ func main() { handleUsage() return } else if firstArg == "--version" { - fmt.Printf("mshell v%s\n", base.MShellVersion) + fmt.Printf("mshell %s\n", base.MShellVersion) return } else if firstArg == "--env" { rtnCode, err := handleEnv() diff --git a/pkg/base/base.go b/pkg/base/base.go index 9a08cdda9..f8a386075 100644 --- a/pkg/base/base.go +++ b/pkg/base/base.go @@ -28,7 +28,7 @@ const MShellPathVarName = "MSHELL_PATH" const MShellHomeVarName = "MSHELL_HOME" const SSHCommandVarName = "SSH_COMMAND" const SessionsDirBaseName = "sessions" -const MShellVersion = "0.1.0" +const MShellVersion = "v0.1.0" const RemoteIdFile = "remoteid" var sessionDirCache = make(map[string]string) diff --git a/pkg/shexec/client.go b/pkg/shexec/client.go index c14b17e59..fadcb6442 100644 --- a/pkg/shexec/client.go +++ b/pkg/shexec/client.go @@ -76,7 +76,7 @@ func MakeClientProc(ctx context.Context, ecmd *exec.Cmd) (*ClientProc, string, e } if initPk.Version != base.MShellVersion { cproc.Close() - return nil, initPk.UName, fmt.Errorf("invalid remote mshell version 'v%s', must be v%s", initPk.Version, base.MShellVersion) + return nil, initPk.UName, fmt.Errorf("invalid remote mshell version '%s', must be %s", initPk.Version, base.MShellVersion) } cproc.InitPk = initPk } diff --git a/pkg/shexec/shexec.go b/pkg/shexec/shexec.go index b8ae79e77..dc52290d2 100644 --- a/pkg/shexec/shexec.go +++ b/pkg/shexec/shexec.go @@ -779,7 +779,7 @@ func RunClientSSHCommandAndWait(runPacket *packet.RunPacketType, fdContext FdCon return nil, fmt.Errorf("mshell command not found on remote server, can install with 'mshell --install %s %s.%s'", sshOptsStr, goos, goarch) } if initPk.Version != base.MShellVersion { - return nil, fmt.Errorf("invalid remote mshell version 'v%s', must be v%s", initPk.Version, base.MShellVersion) + return nil, fmt.Errorf("invalid remote mshell version '%s', must be %s", initPk.Version, base.MShellVersion) } versionOk = true if debug {