Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
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
OpenEdx
ansible
Commits
b58b287f
Commit
b58b287f
authored
Oct 24, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing up authorized_keys to accept comments with spaces
parent
f61a4c1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
library/system/authorized_key
+15
-5
No files found.
library/system/authorized_key
View file @
b58b287f
...
@@ -199,15 +199,25 @@ def parsekey(raw_key):
...
@@ -199,15 +199,25 @@ def parsekey(raw_key):
of ssh-key options at the beginning
of ssh-key options at the beginning
'''
'''
VALID_SSH2_KEY_TYPES
=
[
'ecdsa-sha2-nistp256'
,
'ecdsa-sha2-nistp384'
,
'ecdsa-sha2-nistp521'
,
'ssh-dss'
,
'ssh-rsa'
,
]
key_parts
=
shlex
.
split
(
raw_key
)
key_parts
=
shlex
.
split
(
raw_key
)
if
len
(
key_parts
)
==
4
:
if
len
(
key_parts
)
>=
4
and
key_parts
[
1
]
in
VALID_SSH2_KEY_TYPES
:
# this line contains options
# this line contains options
(
options
,
type
,
key
,
comment
)
=
key_parts
(
options
,
type
,
key
)
=
key_parts
[
0
:
3
]
elif
len
(
key_parts
)
==
3
:
comment
=
" "
.
join
(
key_parts
[
3
:])
elif
len
(
key_parts
)
>=
3
and
key_parts
[
0
]
in
VALID_SSH2_KEY_TYPES
:
# this line is just 'type key user@host'
# this line is just 'type key user@host'
(
type
,
key
,
comment
)
=
key_parts
(
type
,
key
)
=
key_parts
[
0
:
2
]
comment
=
" "
.
join
(
key_parts
[
2
:])
options
=
None
options
=
None
elif
len
(
key_parts
)
==
2
:
elif
len
(
key_parts
)
==
2
and
key_parts
[
0
]
in
VALID_SSH2_KEY_TYPES
:
# assuming just a type/key with no comment
# assuming just a type/key with no comment
(
type
,
key
)
=
key_parts
(
type
,
key
)
=
key_parts
comment
=
""
comment
=
""
...
...
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