Skip to content

Commit

Permalink
Channel dealloc (#19)
Browse files Browse the repository at this point in the history
Fixed issue with channel double free when session open channel fails.
Updated exception handling for session authentication.
Updated tests.
Removed unused exceptions.
Added documentation.
Updated readme, changelog.
  • Loading branch information
pkittenis authored Aug 22, 2020
1 parent 1747e32 commit 465f876
Show file tree
Hide file tree
Showing 49 changed files with 2,814 additions and 6,296 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
flake8 ssh
python setup.py sdist
cd dist; pip install *; cd ..
cd doc
make html
cd ..
name: Test

osx:
Expand Down
8 changes: 8 additions & 0 deletions .environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
channels:
- conda-forge
dependencies:
- python
- setuptools
- libssh
- toolchain3
- cython
4 changes: 4 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
conda:
file: .environment.yml
python:
setup_py_install: true
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ script:
- flake8 ssh
- python setup.py sdist
- cd dist; pip install *; cd ..
- cd doc
- make html
- cd ..
jobs:
include:
- stage: build wheels
Expand Down
18 changes: 18 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Change Log
=============


0.5.0
+++++

Changes
--------

* Updated exception handling to match libssh API - `ssh.exceptions.SSHError` raised on all non-specific errors.
* Updated authentication exception handling to raise specific authentication errors.
* Channel object initialisation now requires Session object to be passed in.


Fixes
------

* Channel deallocation would crash on double free when session channel open failed.


0.4.0
+++++++

Expand Down
23 changes: 11 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,25 @@ Bindings for libssh_ C library.
:target: https://pypi.python.org/pypi/ssh-python
.. image:: https://ci.appveyor.com/api/projects/status/2t4bmmtjvfy5s1in/branch/master?svg=true
:target: https://ci.appveyor.com/project/pkittenis/ssh-python
.. image:: https://readthedocs.org/projects/ssh-python/badge/?version=latest
:target: http://ssh-python.readthedocs.org/en/latest/
:alt: Latest documentation


Installation
_____________

Binary wheels are provided for Linux, OSX and Windows wheels to follow.
Binary wheels are provided for Linux (manylinux 2010), OSX (10.14 and 10.15 for brew Python), and Windows 64-bit (Python 3.6/3.7/3.8).

Wheels have *no dependencies*. For building from source, see `documentation <http://ssh-python.readthedocs.org/en/latest/>`_.


.. code-block:: shell
pip install ssh-python
Project is beta status.


Prerequisites
--------------

* OpenSSL *or* gcrypt library and development headers
* Optionally Zlib library and development headers for compression

``Libssh`` source code is embedded in this project and will be built when installation is triggered per above instructions.
Versions of ``libssh`` other than the one embedded in this project are not supported.
Project is beta status, please report any issues.


Quick Start
Expand Down Expand Up @@ -90,10 +85,14 @@ _________
The library uses `Cython`_ based native code extensions as wrappers to ``libssh``.

* Thread safe - GIL released as much as possible

* libssh threading limitations apply - anything not supported in C is not supported in Python
* Very low overhead thin wrapper
* Object oriented

* Memory freed automatically and safely as objects are garbage collected by Python
* Uses Python semantics where applicable

* channel/file handle context manager support
* channel/file handle iterator support
* Raises low level C errors as Python exceptions
Expand Down
1 change: 1 addition & 0 deletions doc/Changelog.rst
20 changes: 20 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20 changes: 20 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
API Documentation
********************

.. toctree::

session
channel
exceptions
options
key
keytypes
sftp
sftp_handles
sftp_attributes
sftp_statvfs
scp
callbacks
connector
event
utils
7 changes: 7 additions & 0 deletions doc/callbacks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ssh.callbacks
=============

.. automodule:: ssh.callbacks
:members:
:undoc-members:
:member-order: groupwise
7 changes: 7 additions & 0 deletions doc/channel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ssh.channel
===========

.. automodule:: ssh.channel
:members:
:undoc-members:
:member-order: groupwise
120 changes: 120 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import ssh

# -- Project information -----------------------------------------------------

project = 'ssh-python'
copyright = '2020, Panos Kittenis'
author = 'Panos Kittenis'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# -- Extension configuration -------------------------------------------------

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ssh.__version__
# The full version, including alpha/beta/rc tags.
release = ssh.__version__

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}

# Output file base name for HTML help builder.
htmlhelp_basename = 'ssh-pythondoc'
intersphinx_mapping = {'https://docs.python.org/': None}
autoclass_content = "both"
7 changes: 7 additions & 0 deletions doc/connector.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ssh.connector
=============

.. automodule:: ssh.connector
:members:
:undoc-members:
:member-order: groupwise
7 changes: 7 additions & 0 deletions doc/event.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ssh.event
=========

.. automodule:: ssh.event
:members:
:undoc-members:
:member-order: groupwise
7 changes: 7 additions & 0 deletions doc/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ssh.exceptions
==============

.. automodule:: ssh.exceptions
:members:
:undoc-members:
:member-order: groupwise
41 changes: 41 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ssh-python documentation
========================

Bindings for libssh_ C library.

.. image:: https://img.shields.io/badge/License-LGPL%20v2-blue.svg
:target: https://pypi.python.org/pypi/ssh-python
:alt: License
.. image:: https://img.shields.io/pypi/v/ssh-python.svg
:target: https://pypi.python.org/pypi/ssh-python
:alt: Latest Version
.. image:: https://circleci.com/gh/ParallelSSH/ssh-python/tree/master.svg?style=shield
:target: https://circleci.com/gh/ParallelSSH/ssh-python/tree/master
.. image:: https://img.shields.io/pypi/wheel/ssh-python.svg
:target: https://pypi.python.org/pypi/ssh-python
.. image:: https://img.shields.io/pypi/pyversions/ssh-python.svg
:target: https://pypi.python.org/pypi/ssh-python
.. image:: https://ci.appveyor.com/api/projects/status/2t4bmmtjvfy5s1in/branch/master?svg=true
:target: https://ci.appveyor.com/project/pkittenis/ssh-python
.. image:: https://readthedocs.org/projects/ssh-python/badge/?version=latest
:target: http://ssh-python.readthedocs.org/en/latest/
:alt: Latest documentation


.. toctree::
:maxdepth: 2
:caption: Contents:

installation
api
Changelog


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. _libssh: https://www.libssh.org
Loading

0 comments on commit 465f876

Please sign in to comment.