Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
a23897f5
Commit
a23897f5
authored
Jun 05, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
communicator/ssh: Add type for static passwords
parent
aee611db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
communicator/ssh/password.go
communicator/ssh/password.go
+9
-0
communicator/ssh/password_test.go
communicator/ssh/password_test.go
+26
-0
No files found.
communicator/ssh/password.go
0 → 100644
View file @
a23897f5
package
ssh
// An implementation of ssh.ClientPassword so that you can use a static
// string password for the password to ClientAuthPassword.
type
Password
string
func
(
p
Password
)
Password
(
user
string
)
(
string
,
error
)
{
return
string
(
p
),
nil
}
communicator/ssh/password_test.go
0 → 100644
View file @
a23897f5
package
ssh
import
(
"code.google.com/p/go.crypto/ssh"
"testing"
)
func
TestPassword_Impl
(
t
*
testing
.
T
)
{
var
raw
interface
{}
raw
=
Password
(
"foo"
)
if
_
,
ok
:=
raw
.
(
ssh
.
ClientPassword
);
!
ok
{
t
.
Fatal
(
"Password must implement ClientPassword"
)
}
}
func
TestPasswordPassword
(
t
*
testing
.
T
)
{
p
:=
Password
(
"foo"
)
result
,
err
:=
p
.
Password
(
"user"
)
if
err
!=
nil
{
t
.
Fatalf
(
"err not nil: %s"
,
err
)
}
if
result
!=
"foo"
{
t
.
Fatalf
(
"invalid password: %s"
,
result
)
}
}
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