Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
892980dd
Commit
892980dd
authored
May 03, 2017
by
xilabao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gopass to fix format error
parent
aba95a16
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
18 deletions
+37
-18
Godeps.json
Godeps/Godeps.json
+1
-1
Godeps.json
staging/src/k8s.io/apiserver/Godeps/Godeps.json
+1
-1
Godeps.json
staging/src/k8s.io/client-go/Godeps/Godeps.json
+1
-1
Godeps.json
staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json
+1
-1
Godeps.json
...g/src/k8s.io/kube-apiextensions-server/Godeps/Godeps.json
+1
-1
Godeps.json
staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json
+1
-1
pass.go
vendor/github.com/howeyc/gopass/pass.go
+31
-12
No files found.
Godeps/Godeps.json
View file @
892980dd
...
@@ -1670,7 +1670,7 @@
...
@@ -1670,7 +1670,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
staging/src/k8s.io/apiserver/Godeps/Godeps.json
View file @
892980dd
...
@@ -436,7 +436,7 @@
...
@@ -436,7 +436,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
staging/src/k8s.io/client-go/Godeps/Godeps.json
View file @
892980dd
...
@@ -132,7 +132,7 @@
...
@@ -132,7 +132,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json
View file @
892980dd
...
@@ -192,7 +192,7 @@
...
@@ -192,7 +192,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
staging/src/k8s.io/kube-apiextensions-server/Godeps/Godeps.json
View file @
892980dd
...
@@ -184,7 +184,7 @@
...
@@ -184,7 +184,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json
View file @
892980dd
...
@@ -176,7 +176,7 @@
...
@@ -176,7 +176,7 @@
},
},
{
{
"ImportPath"
:
"github.com/howeyc/gopass"
,
"ImportPath"
:
"github.com/howeyc/gopass"
,
"Rev"
:
"
3ca23474a7c7203e0a0a070fd33508f6efdb9b3d
"
"Rev"
:
"
bf9dde6d0d2c004a008c27aaee91170c786f6db8
"
},
},
{
{
"ImportPath"
:
"github.com/imdario/mergo"
,
"ImportPath"
:
"github.com/imdario/mergo"
,
...
...
vendor/github.com/howeyc/gopass/pass.go
View file @
892980dd
...
@@ -7,9 +7,14 @@ import (
...
@@ -7,9 +7,14 @@ import (
"os"
"os"
)
)
var
defaultGetCh
=
func
()
(
byte
,
error
)
{
type
FdReader
interface
{
io
.
Reader
Fd
()
uintptr
}
var
defaultGetCh
=
func
(
r
io
.
Reader
)
(
byte
,
error
)
{
buf
:=
make
([]
byte
,
1
)
buf
:=
make
([]
byte
,
1
)
if
n
,
err
:=
os
.
Stdin
.
Read
(
buf
);
n
==
0
||
err
!=
nil
{
if
n
,
err
:=
r
.
Read
(
buf
);
n
==
0
||
err
!=
nil
{
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
}
}
...
@@ -28,9 +33,10 @@ var (
...
@@ -28,9 +33,10 @@ var (
)
)
// getPasswd returns the input read from terminal.
// getPasswd returns the input read from terminal.
// If prompt is not empty, it will be output as a prompt to the user
// If masked is true, typing will be matched by asterisks on the screen.
// If masked is true, typing will be matched by asterisks on the screen.
// Otherwise, typing will echo nothing.
// Otherwise, typing will echo nothing.
func
getPasswd
(
masked
bool
)
([]
byte
,
error
)
{
func
getPasswd
(
prompt
string
,
masked
bool
,
r
FdReader
,
w
io
.
Writer
)
([]
byte
,
error
)
{
var
err
error
var
err
error
var
pass
,
bs
,
mask
[]
byte
var
pass
,
bs
,
mask
[]
byte
if
masked
{
if
masked
{
...
@@ -38,26 +44,33 @@ func getPasswd(masked bool) ([]byte, error) {
...
@@ -38,26 +44,33 @@ func getPasswd(masked bool) ([]byte, error) {
mask
=
[]
byte
(
"*"
)
mask
=
[]
byte
(
"*"
)
}
}
if
isTerminal
(
os
.
Stdin
.
Fd
())
{
if
isTerminal
(
r
.
Fd
())
{
if
oldState
,
err
:=
makeRaw
(
os
.
Stdin
.
Fd
());
err
!=
nil
{
if
oldState
,
err
:=
makeRaw
(
r
.
Fd
());
err
!=
nil
{
return
pass
,
err
return
pass
,
err
}
else
{
}
else
{
defer
restore
(
os
.
Stdin
.
Fd
(),
oldState
)
defer
func
()
{
restore
(
r
.
Fd
(),
oldState
)
fmt
.
Fprintln
(
w
)
}()
}
}
}
}
if
prompt
!=
""
{
fmt
.
Fprint
(
w
,
prompt
)
}
// Track total bytes read, not just bytes in the password. This ensures any
// Track total bytes read, not just bytes in the password. This ensures any
// errors that might flood the console with nil or -1 bytes infinitely are
// errors that might flood the console with nil or -1 bytes infinitely are
// capped.
// capped.
var
counter
int
var
counter
int
for
counter
=
0
;
counter
<=
maxLength
;
counter
++
{
for
counter
=
0
;
counter
<=
maxLength
;
counter
++
{
if
v
,
e
:=
getch
();
e
!=
nil
{
if
v
,
e
:=
getch
(
r
);
e
!=
nil
{
err
=
e
err
=
e
break
break
}
else
if
v
==
127
||
v
==
8
{
}
else
if
v
==
127
||
v
==
8
{
if
l
:=
len
(
pass
);
l
>
0
{
if
l
:=
len
(
pass
);
l
>
0
{
pass
=
pass
[
:
l
-
1
]
pass
=
pass
[
:
l
-
1
]
fmt
.
Print
(
string
(
bs
))
fmt
.
Fprint
(
w
,
string
(
bs
))
}
}
}
else
if
v
==
13
||
v
==
10
{
}
else
if
v
==
13
||
v
==
10
{
break
break
...
@@ -66,7 +79,7 @@ func getPasswd(masked bool) ([]byte, error) {
...
@@ -66,7 +79,7 @@ func getPasswd(masked bool) ([]byte, error) {
break
break
}
else
if
v
!=
0
{
}
else
if
v
!=
0
{
pass
=
append
(
pass
,
v
)
pass
=
append
(
pass
,
v
)
fmt
.
Print
(
string
(
mask
))
fmt
.
Fprint
(
w
,
string
(
mask
))
}
}
}
}
...
@@ -74,18 +87,24 @@ func getPasswd(masked bool) ([]byte, error) {
...
@@ -74,18 +87,24 @@ func getPasswd(masked bool) ([]byte, error) {
err
=
ErrMaxLengthExceeded
err
=
ErrMaxLengthExceeded
}
}
fmt
.
Println
()
return
pass
,
err
return
pass
,
err
}
}
// GetPasswd returns the password read from the terminal without echoing input.
// GetPasswd returns the password read from the terminal without echoing input.
// The returned byte array does not include end-of-line characters.
// The returned byte array does not include end-of-line characters.
func
GetPasswd
()
([]
byte
,
error
)
{
func
GetPasswd
()
([]
byte
,
error
)
{
return
getPasswd
(
false
)
return
getPasswd
(
""
,
false
,
os
.
Stdin
,
os
.
Stdout
)
}
}
// GetPasswdMasked returns the password read from the terminal, echoing asterisks.
// GetPasswdMasked returns the password read from the terminal, echoing asterisks.
// The returned byte array does not include end-of-line characters.
// The returned byte array does not include end-of-line characters.
func
GetPasswdMasked
()
([]
byte
,
error
)
{
func
GetPasswdMasked
()
([]
byte
,
error
)
{
return
getPasswd
(
true
)
return
getPasswd
(
""
,
true
,
os
.
Stdin
,
os
.
Stdout
)
}
// GetPasswdPrompt prompts the user and returns the password read from the terminal.
// If mask is true, then asterisks are echoed.
// The returned byte array does not include end-of-line characters.
func
GetPasswdPrompt
(
prompt
string
,
mask
bool
,
r
FdReader
,
w
io
.
Writer
)
([]
byte
,
error
)
{
return
getPasswd
(
prompt
,
mask
,
r
,
w
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment