Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added agent authentication test. Updated import privkey functions to …
…default to empty passphrase.
  • Loading branch information
Panos committed Aug 23, 2020
commit c841c8462772aa457c2018cd0945fa7e28240f53
91 changes: 47 additions & 44 deletions ssh/key.c

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

4 changes: 2 additions & 2 deletions ssh/key.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def generate(KeyType key_type, int bits):
return key


def import_privkey_base64(bytes b64_key, passphrase=None):
def import_privkey_base64(bytes b64_key, passphrase=b''):
cdef const_char *c_key = b64_key
cdef bytes b_passphrase
cdef const_char *c_passphrase = NULL
Expand All @@ -153,7 +153,7 @@ def import_privkey_base64(bytes b64_key, passphrase=None):
return key


def import_privkey_file(filepath, passphrase=None):
def import_privkey_file(filepath, passphrase=b''):
cdef bytes b_passphrase
cdef bytes b_filepath = to_bytes(filepath)
cdef const_char *c_passphrase = NULL
Expand Down
5 changes: 5 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,8 @@ def test_gssapi_creds(self):
rc = self.session.options_set_gssapi_delegate_credentials(False)
self.assertEqual(rc, 0)
self.assertRaises(AuthenticationDenied, self.session.userauth_gssapi)

def test_agent_auth(self):
self.session.connect()
self.assertRaises(
AuthenticationDenied, self.session.userauth_agent, self.user)