Skip to content

Commit 109f74c

Browse files
author
Pan
committed
Updated travis cfg.
Added get_exit_signal implementation for channel. Added complete channel extension integration tests.
1 parent ec56593 commit 109f74c

File tree

11 files changed

+1411
-626
lines changed

11 files changed

+1411
-626
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ addons:
2020
install:
2121
- python setup.py build_ext --inplace
2222
- chmod 600 embedded_server/rsa.key
23+
- eval "$(ssh-agent -s)"
2324
script:
2425
- nosetests
26+
- flake8 ssh2

ssh2/agent.c

Lines changed: 417 additions & 182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ssh2/agent.pxd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616

1717
cimport c_ssh2
18+
from session cimport Session
1819

1920

20-
cdef object PyAgent(c_ssh2.LIBSSH2_AGENT *agent)
21+
cdef object PyAgent(c_ssh2.LIBSSH2_AGENT *agent, Session session)
2122

2223

2324
cdef class Agent:
2425
cdef c_ssh2.LIBSSH2_AGENT *_agent
26+
cdef Session _session
2527

2628

2729
cdef int auth_identity(const char *username,

ssh2/agent.pyx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ cdef void clear_agent(c_ssh2.LIBSSH2_AGENT *agent) nogil:
4747
c_ssh2.libssh2_agent_free(agent)
4848

4949

50-
cdef object PyAgent(c_ssh2.LIBSSH2_AGENT *agent):
51-
cdef Agent _agent = Agent()
50+
cdef object PyAgent(c_ssh2.LIBSSH2_AGENT *agent, Session session):
51+
cdef Agent _agent = Agent(session)
5252
_agent._agent = agent
5353
return _agent
5454

5555

5656
cdef class Agent:
57-
# TODO - Needs session reference
5857

59-
def __cinit__(self):
58+
def __cinit__(self, Session session):
6059
self._agent = NULL
60+
self._session = session
6161

6262
def __dealloc__(self):
6363
with nogil:
@@ -104,6 +104,11 @@ cdef class Agent:
104104
with nogil:
105105
rc = c_ssh2.libssh2_agent_userauth(
106106
self._agent, username, pkey._pkey)
107+
if rc != 0 and rc != c_ssh2._LIBSSH2_ERROR_EAGAIN:
108+
with gil:
109+
raise AgentAuthenticationError(
110+
"Error authenticating user %s with provided public key",
111+
username)
107112
return rc
108113

109114
def disconnect(self):
@@ -113,7 +118,10 @@ cdef class Agent:
113118
return rc
114119

115120
def connect(self):
121+
cdef int rc
116122
with nogil:
117-
if c_ssh2.libssh2_agent_connect(self._agent) != 0:
123+
rc = c_ssh2.libssh2_agent_connect(self._agent)
124+
if rc != 0:
118125
with gil:
119126
raise AgentConnectError("Unable to connect to agent")
127+
return rc

0 commit comments

Comments
 (0)