Skip to content

Commit

Permalink
Implemented public key subsystem.
Browse files Browse the repository at this point in the history
Added public key list extension class for representing remote public key lists.
Added public key attribute extension class for remote public key attributes.
  • Loading branch information
pkittenis committed Aug 10, 2017
1 parent bf2ebd0 commit fe315c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ssh2/session.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ from libc.time cimport time_t

cimport c_ssh2
cimport c_sftp
cimport c_pkey
from agent cimport PyAgent, auth_identity, clear_agent
from channel cimport PyChannel
from exceptions cimport SessionHandshakeError, SessionStartupError, \
AgentConnectionError, AgentListIdentitiesError, AgentGetIdentityError, \
AuthenticationError
from listener cimport PyListener
from sftp cimport PySFTP
from publickey cimport PyPublicKeySystem
from utils cimport to_bytes, to_str
IF EMBEDDED_LIB:
from fileinfo cimport FileInfo
Expand Down Expand Up @@ -531,3 +533,12 @@ cdef class Session:
self._session, _path, mode, size, mtime, atime)
if channel is not NULL:
return PyChannel(channel, self)

def publickey_init(self):
"""Initialise public key subsystem for managing remote server
public keys"""
cdef c_pkey.LIBSSH2_PUBLICKEY *_pkey
with nogil:
_pkey= c_pkey.libssh2_publickey_init(self._session)
if _pkey is not NULL:
return PyPublicKeySystem(_pkey, self)
3 changes: 3 additions & 0 deletions ssh2/sftp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ____________

from libc.stdlib cimport malloc, free

from session cimport Session
cimport c_ssh2
cimport c_sftp
from error_codes cimport _LIBSSH2_ERROR_EAGAIN, _LIBSSH2_ERROR_BUFFER_TOO_SMALL
Expand All @@ -69,6 +70,7 @@ from sftp_handle cimport SFTPHandle, PySFTPHandle, SFTPAttributes, SFTPStatVFS
# File types
# TODO


# File Transfer Flags

LIBSSH2_FXF_READ = c_sftp.LIBSSH2_FXF_READ
Expand All @@ -78,6 +80,7 @@ LIBSSH2_FXF_CREAT = c_sftp.LIBSSH2_FXF_CREAT
LIBSSH2_FXF_TRUNC = c_sftp.LIBSSH2_FXF_TRUNC
LIBSSH2_FXF_EXCL = c_sftp.LIBSSH2_FXF_EXCL


# File mode masks
# Read, write, execute/search by owner
LIBSSH2_SFTP_S_IRWXU = c_sftp.LIBSSH2_SFTP_S_IRWXU
Expand Down

0 comments on commit fe315c9

Please sign in to comment.