Skip to content

Commit b0bfbeb

Browse files
author
Pan
committed
Added session implementation. Added libssh install script. Updated definitions.
1 parent 3c6b71b commit b0bfbeb

File tree

8 files changed

+546
-40
lines changed

8 files changed

+546
-40
lines changed

ci/install_ssh.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -xe
2+
3+
if [ -d /usr/local/opt/openssl ]; then
4+
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
5+
fi
6+
7+
mkdir -p src && cd src
8+
cmake -DCMAKE_BUILD_TYPE=Release ../libssh
9+
make -j6
10+
sudo make install
11+
cd ..

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ON_WINDOWS = platform.system() == 'Windows'
2424

2525
ext = 'pyx' if USING_CYTHON else 'c'
26-
sources = glob('ssh/session.%s' % (ext,))
26+
sources = glob('ssh/*.%s' % (ext,))
2727
_libs = ['ssh'] if not ON_WINDOWS else [
2828
'Ws2_32', 'libssh', 'user32',
2929
'libeay32MD', 'ssleay32MD',
@@ -40,7 +40,7 @@
4040
cython_args = {
4141
'cython_directives': cython_directives,
4242
'cython_compile_time_env': {
43-
'_WIN32': ON_WINDOWS,
43+
# '_WIN32': ON_WINDOWS,
4444
}} \
4545
if USING_CYTHON else {}
4646

ssh/c_ssh.pxd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -479,13 +479,13 @@ cdef extern from "libssh/libssh.h" nogil:
479479
int ssh_service_request(ssh_session session, const char *service)
480480
int ssh_set_agent_channel(ssh_session session, ssh_channel channel)
481481
int ssh_set_agent_socket(ssh_session session, socket_t fd)
482-
ssh_set_blocking(ssh_session session, int blocking)
483-
ssh_set_counters(ssh_session session, ssh_counter scounter,
484-
ssh_counter rcounter)
485-
ssh_set_fd_except(ssh_session session)
486-
ssh_set_fd_toread(ssh_session session)
487-
_set_fd_towrite(ssh_session session)
488-
ssh_silent_disconnect(ssh_session session)
482+
void ssh_set_blocking(ssh_session session, int blocking)
483+
void ssh_set_counters(ssh_session session, ssh_counter scounter,
484+
ssh_counter rcounter)
485+
void ssh_set_fd_except(ssh_session session)
486+
void ssh_set_fd_toread(ssh_session session)
487+
void _set_fd_towrite(ssh_session session)
488+
void ssh_silent_disconnect(ssh_session session)
489489
int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile)
490490

491491
# Userauth
@@ -498,8 +498,8 @@ cdef extern from "libssh/libssh.h" nogil:
498498
const char *username,
499499
const ssh_key privkey)
500500
# #ifndef _WIN32
501-
# LIBSSH_API int ssh_userauth_agent(ssh_session session,
502-
# const char *username);
501+
int ssh_userauth_agent(ssh_session session,
502+
const char *username)
503503
# #endif
504504
int ssh_userauth_publickey_auto(ssh_session session,
505505
const char *username,

ssh/session.pxd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This file is part of ssh-python.
2+
# Copyright (C) 2018 Panos Kittenis
3+
#
4+
# This library is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU Lesser General Public
6+
# License as published by the Free Software Foundation, version 2.1.
7+
#
8+
# This library is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# Lesser General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU Lesser General Public
14+
# License along with this library; if not, write to the Free Software
15+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-130
16+
17+
cimport c_ssh
18+
19+
cdef class Session:
20+
cdef c_ssh.ssh_session _session

0 commit comments

Comments
 (0)