Skip to content

Commit

Permalink
Kbd int (#123)
Browse files Browse the repository at this point in the history
* 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 <git@red-m.net>
  • Loading branch information
pkittenis and Red-M committed Oct 21, 2020
1 parent a0196a8 commit 9b8b5b3
Show file tree
Hide file tree
Showing 16 changed files with 2,488 additions and 1,168 deletions.
27 changes: 12 additions & 15 deletions .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,42 +201,40 @@ install the development requirements first:
pip install -U -r requirements_dev.txt
Test suite is run via ``nosetests``. Simply calling ``nosetests`` in
Test suite is run via ``pytest``.

Simply calling ``pytest tests`` in
the Git repository's root directory will run all available tests.

To run an individual test suite, call nosetests on a particular test file.
To run an individual test suite, call pytest on a particular test file.

.. code-block:: shell
nosetests tests/test_sftp.py
pytest tests/test_sftp.py
The library does not use a logger and does not output anything.

.. code-block:: shell
nosetests --nologcapture
To have nosetests fall back to a PDB prompt on uncaught exceptions, call it
To have pytest fall back to a PDB prompt on uncaught exceptions, call it
like so:

.. code-block:: shell
nosetests --pdb
pytest --pdb
If using manually set break points, via ``ipdb.set_trace()`` for example,
call nosetests like so:
call pytest like so:

.. code-block:: shell
nosetests -s
pytest -s
to be able to fall back to an IPDB prompt.

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

.. code-block:: shell
nosetests tests/test_sftp.py:SFTPTestCase.test_readdir
pytest tests/test_sftp.py::SFTPTestCase::test_readdir
will run the single test ``test_readdir`` in ``test_sftp.py``.

Expand Down Expand Up @@ -284,8 +282,7 @@ In root directory of repository:

.. code-block:: shell
pip install sphinx
(cd docs; rm -rf _build; make html)
(cd docs; make html)
After building succeeds the documentation is available at ``doc/_build/html``.

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

.. code-block:: shell
nosetests
pytest tests
To ensure documentation builds correctly:

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
'boundscheck': False,
'optimize.use_switch': True,
'wraparound': False,
'language_level': 2,
}
cython_args = {
'cython_directives': cython_directives,
Expand Down
2 changes: 2 additions & 0 deletions ssh2/agent.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion ssh2/c_ssh2.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ cdef extern from "libssh2.h" nogil:
time_t st_atime
time_t st_mtime
time_t st_ctime
ctypedef struct LIBSSH2_USERAUTH_KBDINT_PROMPT:
char *text
unsigned int length
unsigned char echo
ctypedef struct LIBSSH2_USERAUTH_KBDINT_RESPONSE:
char *text
unsigned int length
ctypedef struct LIBSSH2_SESSION:
pass
ctypedef struct LIBSSH2_CHANNEL:
Expand Down Expand Up @@ -142,7 +149,7 @@ cdef extern from "libssh2.h" nogil:
(void *))
int libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION *session,
const char *username,
const char *password)
(void *))
int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
const char *username,
unsigned int username_len,
Expand Down
2 changes: 2 additions & 0 deletions ssh2/channel.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ssh2/knownhost.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ssh2/listener.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions ssh2/publickey.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b8b5b3

Please sign in to comment.