Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
400c971f
Commit
400c971f
authored
Sep 21, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fakessh: SSH server uses user's shell to parse command line.
parent
b1243369
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
mitogen/fakessh.py
mitogen/fakessh.py
+15
-4
No files found.
mitogen/fakessh.py
View file @
400c971f
...
@@ -217,16 +217,21 @@ class Process(object):
...
@@ -217,16 +217,21 @@ class Process(object):
@
mitogen
.
core
.
takes_router
@
mitogen
.
core
.
takes_router
def
_start_slave
(
src_id
,
args
,
router
):
def
_start_slave
(
src_id
,
cmdline
,
router
):
"""
"""
This runs in the target context, it is invoked by _fakessh_main running in
This runs in the target context, it is invoked by _fakessh_main running in
the fakessh context immediately after startup. It starts the slave process
the fakessh context immediately after startup. It starts the slave process
(the the point where it has a stdin_handle to target but not stdout_chan to
(the the point where it has a stdin_handle to target but not stdout_chan to
write to), and waits for main to.
write to), and waits for main to.
"""
"""
LOG
.
debug
(
'_start_slave(%r, %r)'
,
router
,
args
)
LOG
.
debug
(
'_start_slave(%r, %r)'
,
router
,
cmdline
)
proc
=
subprocess
.
Popen
(
cmdline
,
# SSH server always uses user's shell.
shell
=
True
,
# SSH server always executes new commands in the user's HOME.
cwd
=
os
.
path
.
expanduser
(
'~'
),
proc
=
subprocess
.
Popen
(
args
,
stdin
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
)
)
...
@@ -298,10 +303,16 @@ def _fakessh_main(dest_context_id, econtext):
...
@@ -298,10 +303,16 @@ def _fakessh_main(dest_context_id, econtext):
if
subsystem
:
if
subsystem
:
die
(
'-s <subsystem> is not yet supported'
)
die
(
'-s <subsystem> is not yet supported'
)
if
not
args
:
die
(
'fakessh: login mode not supported and no command specified'
)
dest
=
mitogen
.
master
.
Context
(
econtext
.
router
,
dest_context_id
)
dest
=
mitogen
.
master
.
Context
(
econtext
.
router
,
dest_context_id
)
# Even though SSH receives an argument vector, it still cats the vector
# together before sending to the server, the server just uses /bin/sh -c to
# run the command. We must remain puke-for-puke compatible.
control_handle
,
stdin_handle
=
dest
.
call
(
_start_slave
,
control_handle
,
stdin_handle
=
dest
.
call
(
_start_slave
,
mitogen
.
context_id
,
args
)
mitogen
.
context_id
,
' '
.
join
(
args
)
)
LOG
.
debug
(
'_fakessh_main: received control_handle=%r, stdin_handle=%r'
,
LOG
.
debug
(
'_fakessh_main: received control_handle=%r, stdin_handle=%r'
,
control_handle
,
stdin_handle
)
control_handle
,
stdin_handle
)
...
...
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