Skip to content
Commits on Source (18)
......@@ -5,3 +5,5 @@ __pycache__
/dist
/build
/MANIFEST
/*.egg-info
/.cache
sudo: false
language: python
cache: pip
matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.4
env: TOXENV=py34
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: 2.7
env: TOXENV=pep8
- python: 3.5
env: TOXENV=py3pep8
install:
- pip install --upgrade pip setuptools
- pip --version
- pip install tox
- tox --version
script:
- tox
include README COPYING
include tox.ini
include setup.cfg
include tests.py tests.krb5.conf
include .coveragerc
python-kdcproxy (0.3.3-1) unstable; urgency=medium
* New upstream release.
* Update upstream urls, add VCS urls.
* Bump debhelper to 10.
* Remove obsolete patches.
* control: Add python-setuptools to build-depends.
* rules: Override dh_clean.
* control: Bump policy to 4.1.2, no changes.
-- Timo Aaltonen <tjaalton@debian.org> Sun, 24 Dec 2017 11:51:38 +0200
python-kdcproxy (0.3.2-5) unstable; urgency=medium
* rules: Disable tests, no way to stop accessing the network it seems.
(Closes: #854191)
* Add upstream README to packages. (Closes: #843203)
-- Timo Aaltonen <tjaalton@debian.org> Sun, 05 Feb 2017 08:03:59 +0200
python-kdcproxy (0.3.2-4) unstable; urgency=medium
* rules: Set a local http_proxy to avoid accessing network.
......
......@@ -4,7 +4,7 @@ Uploaders: Timo Aaltonen <tjaalton@debian.org>
Section: python
Priority: optional
Build-Depends:
debhelper (>= 9),
debhelper (>= 10),
dh-python,
libkrb5-3,
python-all (>= 2.6.6-3),
......@@ -14,6 +14,7 @@ Build-Depends:
python-pyasn1,
python-pytest,
python-pytest-cov,
python-setuptools,
python-webtest,
python3-all,
python3-coverage,
......@@ -22,12 +23,15 @@ Build-Depends:
python3-pyasn1,
python3-pytest,
python3-pytest-cov,
python3-setuptools,
python3-webtest,
tox,
X-Python-Version: >= 2.7
X-Python3-Version: >= 3.3
Standards-Version: 3.9.6
Homepage: http://github.com/npmccallum/kdcproxy
Standards-Version: 4.1.2
Homepage: http://github.com/latchset/kdcproxy
Vcs-Git: https://anonscm.debian.org/git/pkg-freeipa/python-kdcproxy.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-freeipa/python-kdcproxy.git
Package: python-kdcproxy
Architecture: all
......
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: kdcproxy
Source: http://github.com/npmccallum/kdcproxy
Source: http://github.com/latchset/kdcproxy
Files: *
Copyright: 2013-2015 Red Hat, Inc.
......
diff --git a/tox.ini b/tox.ini
index 33b86eb..0438a2f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,8 +8,8 @@ deps =
WebTest
pyasn1
commands =
- coverage run -m pytest --capture=no --strict {posargs}
- coverage report -m
+ python-coverage run -m pytest --capture=no --strict {posargs}
+ python-coverage report -m
[testenv:py27]
deps =
fix-coverage.diff
workaround-mock-bug.diff
# placeholder
https://github.com/testing-cabal/mock/issues/323
--- a/tests.py
+++ b/tests.py
@@ -79,7 +79,7 @@ class KDCProxyWSGITests(unittest.TestCas
self.assertEqual(r.text, 'Method not allowed (GET).')
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
- @mock.patch('socket.socket', autospec=True)
+ @mock.patch('socket.socket')
def test_post_asreq(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.asreq1)
self.assert_response(response)
@@ -92,7 +92,7 @@ class KDCProxyWSGITests(unittest.TestCas
)
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
- @mock.patch('socket.socket', autospec=True)
+ @mock.patch('socket.socket')
def test_post_kpasswd(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.kpasswdreq)
self.assert_response(response)
......@@ -11,4 +11,7 @@ override_dh_auto_install:
rm -rf debian/python*-kdcproxy/usr/lib/python*/dist-packages/kdcproxy-*.egg-info
override_dh_auto_test:
http_proxy='http://127.0.0.1:9/' tox --sitepackages -e py27,py35
override_dh_clean:
dh_clean
rm -rf kdcproxy.egg-info/
version=3
https://github.com/npmccallum/kdcproxy/tags (?:.*/)?v?(\d[\d\.]*)\.tar\.gz
https://github.com/latchset/kdcproxy/tags (?:.*/)?v?(\d[\d\.]*)\.tar\.gz
......@@ -27,16 +27,16 @@ import struct
import sys
import time
try: # Python 3.x
import kdcproxy.codec as codec
from kdcproxy.config import MetaResolver
if sys.version_info.major >= 3: # Python 3.x
import http.client as httplib
import urllib.parse as urlparse
except ImportError: # Python 2.x
else:
import httplib
import urlparse
import kdcproxy.codec as codec
from kdcproxy.config import MetaResolver
class HTTPException(Exception):
......@@ -178,10 +178,13 @@ class Application:
raise HTTPException(405, "Method not allowed (%s)." % method)
# Parse the request
length = -1
try:
length = int(env["CONTENT_LENGTH"])
except AttributeError:
raise HTTPException(411, "Length required.")
except KeyError:
pass
except ValueError:
pass
if length < 0:
raise HTTPException(411, "Length required.")
if length > self.MAX_LENGTH:
......@@ -228,8 +231,8 @@ class Application:
for addr in addrs + (None,):
if addr is not None:
# Bypass unspecified socktypes
if (len(scheme) > 1
and addr[1] != self.SOCKTYPES[scheme[1]]):
if (len(scheme) > 1 and
addr[1] != self.SOCKTYPES[scheme[1]]):
continue
# Create the socket
......@@ -278,4 +281,5 @@ class Application:
start_response(str(e), e.headers)
return [e.message]
application = Application()
......@@ -33,8 +33,10 @@ from kdcproxy.config import IConfig
class KRB5Error(Exception):
pass
PY3 = sys.version_info[0] == 3
try:
LIBKRB5 = ctypes.CDLL('libkrb5.so.3')
except OSError as e: # pragma: no cover
......@@ -272,6 +274,7 @@ class MITConfig(IConfig):
def use_dns(self, default=True):
return self.__config["dns"]
if __name__ == "__main__":
from pprint import pprint
with KRB5Profile() as prof:
......
[bdist_wheel]
universal = 1
[aliases]
# requires setuptools and wheel package
# dnf install python3-setuptools python3-wheel
packages = clean --all egg_info bdist_wheel sdist --format=zip sdist --format=gztar
release = packages register upload
......@@ -21,11 +21,32 @@
import os
import sys
from distutils.core import setup
dns = "dnspython"
if sys.version_info.major == 3:
dns += "3"
import setuptools
from setuptools import setup
SETUPTOOLS_VERSION = tuple(int(v) for v in setuptools.__version__.split("."))
install_requires = [
'pyasn1',
]
extras_require = {
"tests": ["pytest", "coverage", "WebTest"],
"test_pep8": ['flake8', 'flake8-import-order', 'pep8-naming']
}
if SETUPTOOLS_VERSION >= (18, 0):
extras_require.update({
":python_version<'3'": ["dnspython"],
":python_version>='3'": ["dnspython3"],
})
else:
if sys.version_info.major == 2:
install_requires.append("dnspython")
else:
install_requires.append("dnspython3")
def read(fname):
......@@ -33,9 +54,10 @@ def read(fname):
with open(fname) as f:
return f.read()
setup(
name="kdcproxy",
version="0.3.2",
version="0.3.3",
author="Nalin Dahyabhai, Nathaniel McCallum, Christian Heimes",
author_email="nalin@redhat.com, npmccallum@redhat.com, cheimes@redhat.com",
description=("A kerberos KDC HTTP proxy WSGI module."),
......@@ -44,15 +66,18 @@ setup(
url="http://github.com/npmccallum/kdcproxy",
packages=['kdcproxy', 'kdcproxy.config'],
long_description=read('README'),
requires=['pyasn1', dns],
install_requires=install_requires,
extras_require=extras_require,
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Internet :: Proxy Servers",
],
)
......@@ -34,7 +34,7 @@ from dns.rdtypes.IN.SRV import SRV
from pyasn1.codec.der import decoder, encoder
from webtest import TestApp
from webtest import TestApp as WebTestApp
import kdcproxy
# from kdcproxy import asn1
......@@ -59,7 +59,7 @@ class KDCProxyWSGITests(unittest.TestCase):
self.await_reply.return_value = b'RESPONSE'
self.resolver = self.app._Application__resolver = mock.Mock()
self.resolver.lookup.return_value = ["kerberos://k1.kdcproxy.test.:88"]
self.tapp = TestApp(self.app)
self.tapp = WebTestApp(self.app)
def post(self, body, expect_errors=False):
return self.tapp.post(
......@@ -79,7 +79,7 @@ class KDCProxyWSGITests(unittest.TestCase):
self.assertEqual(r.text, 'Method not allowed (GET).')
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
@mock.patch('socket.socket', autospec=True)
@mock.patch('socket.socket')
def test_post_asreq(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.asreq1)
self.assert_response(response)
......@@ -92,7 +92,7 @@ class KDCProxyWSGITests(unittest.TestCase):
)
@mock.patch('socket.getaddrinfo', return_value=addrinfo)
@mock.patch('socket.socket', autospec=True)
@mock.patch('socket.socket')
def test_post_kpasswd(self, m_socket, m_getaddrinfo):
response = self.post(KDCProxyCodecTests.kpasswdreq)
self.assert_response(response)
......
[tox]
envlist = py27,py34,pep8,py3pep8,doc
minversion = 2.3.1
envlist = py27,py34,py35,py36,pep8,py3pep8,doc
skip_missing_interpreters = true
[testenv]
deps =
pytest
coverage
WebTest
pyasn1
.[tests]
commands =
coverage run -m pytest --capture=no --strict {posargs}
coverage report -m
{envpython} -m coverage run -m pytest --capture=no --strict {posargs}
{envpython} -m coverage report -m
[testenv:py27]
deps =
{[testenv]deps}
dnspython
mock
[testenv:py34]
deps =
{[testenv]deps}
dnspython3
.[tests]
mock
[testenv:pep8]
basepython = python2.7
deps =
flake8
flake8-import-order
pep8-naming
.[test_pep8]
commands =
flake8 {posargs}
{envpython} -m flake8
[testenv:py3pep8]
basepython = python3.4
basepython = python3
deps =
flake8
flake8-import-order
pep8-naming
.[test_pep8]
commands =
flake8 {posargs}
{envpython} -m flake8
[testenv:doc]
deps =
......