Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
b372fcbb
Commit
b372fcbb
authored
Sep 12, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass None for empty password
parent
21d3f9bd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletions
+3
-1
test_handler.py
tests/test_handler.py
+2
-0
handler.py
webssh/handler.py
+1
-1
No files found.
tests/test_handler.py
View file @
b372fcbb
...
@@ -83,3 +83,5 @@ class TestIndexHandler(unittest.TestCase):
...
@@ -83,3 +83,5 @@ class TestIndexHandler(unittest.TestCase):
with
self
.
assertRaises
(
InvalidValueError
)
as
exc
:
with
self
.
assertRaises
(
InvalidValueError
)
as
exc
:
pkey
=
IndexHandler
.
get_pkey_obj
(
'x'
+
key
,
password
,
fname
)
pkey
=
IndexHandler
.
get_pkey_obj
(
'x'
+
key
,
password
,
fname
)
self
.
assertIn
(
'Invalid private key'
,
str
(
exc
))
self
.
assertIn
(
'Invalid private key'
,
str
(
exc
))
with
self
.
assertRaises
(
paramiko
.
PasswordRequiredException
):
pkey
=
IndexHandler
.
get_pkey_obj
(
key
,
''
,
fname
)
webssh/handler.py
View file @
b372fcbb
...
@@ -118,7 +118,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -118,7 +118,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
@classmethod
@classmethod
def
get_pkey_obj
(
cls
,
privatekey
,
password
,
filename
):
def
get_pkey_obj
(
cls
,
privatekey
,
password
,
filename
):
bpass
=
to_bytes
(
password
)
bpass
=
to_bytes
(
password
)
if
password
else
None
pkey
=
cls
.
get_specific_pkey
(
paramiko
.
RSAKey
,
privatekey
,
bpass
)
\
pkey
=
cls
.
get_specific_pkey
(
paramiko
.
RSAKey
,
privatekey
,
bpass
)
\
or
cls
.
get_specific_pkey
(
paramiko
.
DSSKey
,
privatekey
,
bpass
)
\
or
cls
.
get_specific_pkey
(
paramiko
.
DSSKey
,
privatekey
,
bpass
)
\
...
...
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