Skip to content

Commit 9b8b5b3

Browse files
pkittenisRed_M
andauthored
Kbd int (#123)
* Change Session.userauth_keyboardinteractive to use callback function * Added necessary libssh2 structures for kbd interactive. * Allow embedded server to do keyboard interactive auth * Updated contribution guide. Co-authored-by: Red_M <[email protected]>
1 parent a0196a8 commit 9b8b5b3

File tree

16 files changed

+2488
-1168
lines changed

16 files changed

+2488
-1168
lines changed

.github/CONTRIBUTING.rst

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -201,42 +201,40 @@ install the development requirements first:
201201
202202
pip install -U -r requirements_dev.txt
203203
204-
Test suite is run via ``nosetests``. Simply calling ``nosetests`` in
204+
Test suite is run via ``pytest``.
205+
206+
Simply calling ``pytest tests`` in
205207
the Git repository's root directory will run all available tests.
206208

207-
To run an individual test suite, call nosetests on a particular test file.
209+
To run an individual test suite, call pytest on a particular test file.
208210

209211
.. code-block:: shell
210212
211-
nosetests tests/test_sftp.py
213+
pytest tests/test_sftp.py
212214
213215
The library does not use a logger and does not output anything.
214216

215-
.. code-block:: shell
216-
217-
nosetests --nologcapture
218-
219-
To have nosetests fall back to a PDB prompt on uncaught exceptions, call it
217+
To have pytest fall back to a PDB prompt on uncaught exceptions, call it
220218
like so:
221219

222220
.. code-block:: shell
223221
224-
nosetests --pdb
222+
pytest --pdb
225223
226224
If using manually set break points, via ``ipdb.set_trace()`` for example,
227-
call nosetests like so:
225+
call pytest like so:
228226

229227
.. code-block:: shell
230228
231-
nosetests -s
229+
pytest -s
232230
233231
to be able to fall back to an IPDB prompt.
234232

235233
Running an individual test within a test suite is also possible, for example:
236234

237235
.. code-block:: shell
238236
239-
nosetests tests/test_sftp.py:SFTPTestCase.test_readdir
237+
pytest tests/test_sftp.py::SFTPTestCase::test_readdir
240238
241239
will run the single test ``test_readdir`` in ``test_sftp.py``.
242240

@@ -284,8 +282,7 @@ In root directory of repository:
284282

285283
.. code-block:: shell
286284
287-
pip install sphinx
288-
(cd docs; rm -rf _build; make html)
285+
(cd docs; make html)
289286
290287
After building succeeds the documentation is available at ``doc/_build/html``.
291288

@@ -304,7 +301,7 @@ repository's root directory:
304301

305302
.. code-block:: shell
306303
307-
nosetests
304+
pytest tests
308305
309306
To ensure documentation builds correctly:
310307

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
'boundscheck': False,
5555
'optimize.use_switch': True,
5656
'wraparound': False,
57+
'language_level': 2,
5758
}
5859
cython_args = {
5960
'cython_directives': cython_directives,

ssh2/agent.c

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

ssh2/c_ssh2.pxd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ cdef extern from "libssh2.h" nogil:
5858
time_t st_atime
5959
time_t st_mtime
6060
time_t st_ctime
61+
ctypedef struct LIBSSH2_USERAUTH_KBDINT_PROMPT:
62+
char *text
63+
unsigned int length
64+
unsigned char echo
65+
ctypedef struct LIBSSH2_USERAUTH_KBDINT_RESPONSE:
66+
char *text
67+
unsigned int length
6168
ctypedef struct LIBSSH2_SESSION:
6269
pass
6370
ctypedef struct LIBSSH2_CHANNEL:
@@ -142,7 +149,7 @@ cdef extern from "libssh2.h" nogil:
142149
(void *))
143150
int libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION *session,
144151
const char *username,
145-
const char *password)
152+
(void *))
146153
int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
147154
const char *username,
148155
unsigned int username_len,

ssh2/channel.c

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

ssh2/knownhost.c

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

ssh2/listener.c

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

ssh2/publickey.c

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

0 commit comments

Comments
 (0)