mirror of
https://github.com/schollz/croc.git
synced 2024-11-24 08:02:33 +03:00
add the checks for the classic insecure mode
This commit is contained in:
parent
63c9201938
commit
f66e17dd46
@ -27,7 +27,6 @@ import (
|
|||||||
|
|
||||||
// Version specifies the version
|
// Version specifies the version
|
||||||
var Version string
|
var Version string
|
||||||
var classicInsecureMode = false
|
|
||||||
|
|
||||||
// Run will run the command line program
|
// Run will run the command line program
|
||||||
func Run() (err error) {
|
func Run() (err error) {
|
||||||
@ -129,7 +128,7 @@ func Run() (err error) {
|
|||||||
|
|
||||||
// check if "classic" is set
|
// check if "classic" is set
|
||||||
classicFile := getClassicConfigFile(true)
|
classicFile := getClassicConfigFile(true)
|
||||||
classicInsecureMode = utils.Exists(classicFile)
|
classicInsecureMode := utils.Exists(classicFile)
|
||||||
if c.Bool("classic") {
|
if c.Bool("classic") {
|
||||||
if classicInsecureMode {
|
if classicInsecureMode {
|
||||||
// classic mode not enabled
|
// classic mode not enabled
|
||||||
@ -373,6 +372,7 @@ func send(c *cli.Context) (err error) {
|
|||||||
return errors.New("must specify file: croc send [filename(s) or folder]")
|
return errors.New("must specify file: croc send [filename(s) or folder]")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
classicInsecureMode := utils.Exists(getClassicConfigFile(true))
|
||||||
if !classicInsecureMode {
|
if !classicInsecureMode {
|
||||||
// if operating system is UNIX, then use environmental variable to set the code
|
// if operating system is UNIX, then use environmental variable to set the code
|
||||||
if (!(runtime.GOOS == "windows") && c.IsSet("code")) || os.Getenv("CROC_SECRET") != "" {
|
if (!(runtime.GOOS == "windows") && c.IsSet("code")) || os.Getenv("CROC_SECRET") != "" {
|
||||||
@ -589,6 +589,7 @@ func receive(c *cli.Context) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
classicInsecureMode := utils.Exists(getClassicConfigFile(true))
|
||||||
if crocOptions.SharedSecret == "" && os.Getenv("CROC_SECRET") != "" {
|
if crocOptions.SharedSecret == "" && os.Getenv("CROC_SECRET") != "" {
|
||||||
crocOptions.SharedSecret = os.Getenv("CROC_SECRET")
|
crocOptions.SharedSecret = os.Getenv("CROC_SECRET")
|
||||||
} else if !(runtime.GOOS == "windows") && crocOptions.SharedSecret != "" && !classicInsecureMode {
|
} else if !(runtime.GOOS == "windows") && crocOptions.SharedSecret != "" && !classicInsecureMode {
|
||||||
|
Loading…
Reference in New Issue
Block a user