Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
bef931a7
Commit
bef931a7
authored
Feb 04, 2015
by
Leigh B Stoller
Browse files
Handle openssh keys that have been pasted in with embedded newlines.
parent
6978c4a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
account/addpubkey.in
View file @
bef931a7
...
...
@@ -331,7 +331,23 @@ else {
if
(
!
-
e
$keyfile
)
{
fatal
("
No such file:
$keyfile
\n
");
}
$keyline
=
`
head -1
$keyfile
`;
open
(
KEY
,
"
$keyfile
")
or
fatal
("
Could not open
$keyfile
to read
");
#
# Ick, look at first line to see if it looks like an openssh key,
# and if so we want to remove the embedded newlines.
#
$keyline
=
<
KEY
>
;
my
$chompit
=
0
;
if
(
$keyline
=~
/^ssh/
||
$keyline
=~
/^\d+\s+\d+/
)
{
$chompit
=
1
;
}
while
(
<
KEY
>
)
{
chomp
(
$_
)
if
(
$chompit
);
$keyline
.=
$_
;
}
close
(
KEY
);
}
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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