From cccbf302f220b6e113f5d34ec91979f5ca49c555 Mon Sep 17 00:00:00 2001 From: "Jason E. Aten" Date: Sat, 3 Sep 2016 10:28:32 -0700 Subject: [PATCH] etcdctl/ctlv3: don't crash when we should prompt for pw. when 'etcdctl --user name get blah' is invoked to prompt for password, don't panic. addresses the segfault part of #6343 --- etcdctl/ctlv3/command/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcdctl/ctlv3/command/global.go b/etcdctl/ctlv3/command/global.go index 861763c76b1..c3159565037 100644 --- a/etcdctl/ctlv3/command/global.go +++ b/etcdctl/ctlv3/command/global.go @@ -243,7 +243,7 @@ func authCfgFromCmd(cmd *cobra.Command) *authCfg { var cfg authCfg splitted := strings.SplitN(userFlag, ":", 2) - if len(splitted) == 0 { + if len(splitted) < 2 { cfg.username = userFlag cfg.password, err = speakeasy.Ask("Password: ") if err != nil {