Do not traceback on invalid IPNetwork input
(upstream issues #2, #6, #5, #8)
This commit is contained in:
parent
fa16c92a93
commit
78249a9b2b
65
0001-Fixed-github-Issue-no.-2.-Thanks-keesbos.patch
Normal file
65
0001-Fixed-github-Issue-no.-2.-Thanks-keesbos.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
From 80071f4450261b70b70f537bc2b54d2c97d9f562 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "David P. D. Moss" <drkjam@gmail.com>
|
||||||
|
Date: Thu, 25 Nov 2010 08:53:49 +0000
|
||||||
|
Subject: [PATCH] Fixed github Issue no. 2. Thanks keesbos.
|
||||||
|
|
||||||
|
---
|
||||||
|
netaddr/ip/__init__.py | 2 ++
|
||||||
|
netaddr/tests/2.x/ip/constructor.txt | 11 +++++++++++
|
||||||
|
netaddr/tests/3.x/ip/constructor.txt | 11 +++++++++++
|
||||||
|
3 files changed, 24 insertions(+), 0 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/netaddr/ip/__init__.py b/netaddr/ip/__init__.py
|
||||||
|
index 0179c38..e4a6b7b 100644
|
||||||
|
--- a/netaddr/ip/__init__.py
|
||||||
|
+++ b/netaddr/ip/__init__.py
|
||||||
|
@@ -779,6 +779,8 @@ def parse_ip_network(module, addr, implicit_prefix=False, flags=0):
|
||||||
|
# Try a partial IPv4 network address...
|
||||||
|
expanded_addr = _ipv4.expand_partial_address(val1)
|
||||||
|
ip = IPAddress(expanded_addr, module.version, flags=INET_PTON)
|
||||||
|
+ else:
|
||||||
|
+ raise AddrFormatError('invalid IPNetwork address %s!' % addr)
|
||||||
|
value = ip._value
|
||||||
|
|
||||||
|
try:
|
||||||
|
diff --git a/netaddr/tests/2.x/ip/constructor.txt b/netaddr/tests/2.x/ip/constructor.txt
|
||||||
|
index f67f5e4..5a9e978 100644
|
||||||
|
--- a/netaddr/tests/2.x/ip/constructor.txt
|
||||||
|
+++ b/netaddr/tests/2.x/ip/constructor.txt
|
||||||
|
@@ -209,3 +209,14 @@ IPNetwork('172.24.0.0/16')
|
||||||
|
|
||||||
|
|
||||||
|
}}}
|
||||||
|
+
|
||||||
|
+Negative testing
|
||||||
|
+
|
||||||
|
+{{{
|
||||||
|
+
|
||||||
|
+>>> IPNetwork('foo')
|
||||||
|
+Traceback (most recent call last):
|
||||||
|
+...
|
||||||
|
+AddrFormatError: invalid IPNetwork foo
|
||||||
|
+
|
||||||
|
+}}}
|
||||||
|
diff --git a/netaddr/tests/3.x/ip/constructor.txt b/netaddr/tests/3.x/ip/constructor.txt
|
||||||
|
index 2ec47c0..35a5cd6 100644
|
||||||
|
--- a/netaddr/tests/3.x/ip/constructor.txt
|
||||||
|
+++ b/netaddr/tests/3.x/ip/constructor.txt
|
||||||
|
@@ -209,3 +209,14 @@ IPNetwork('172.24.0.0/16')
|
||||||
|
|
||||||
|
|
||||||
|
}}}
|
||||||
|
+
|
||||||
|
+Negative testing
|
||||||
|
+
|
||||||
|
+{{{
|
||||||
|
+
|
||||||
|
+>>> IPNetwork('foo')
|
||||||
|
+Traceback (most recent call last):
|
||||||
|
+...
|
||||||
|
+netaddr.core.AddrFormatError: invalid IPNetwork foo
|
||||||
|
+
|
||||||
|
+}}}
|
||||||
|
--
|
||||||
|
1.7.5.2
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name: python-netaddr
|
Name: python-netaddr
|
||||||
Version: 0.7.5
|
Version: 0.7.5
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: A pure Python network address representation and manipulation library
|
Summary: A pure Python network address representation and manipulation library
|
||||||
|
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
@ -16,6 +16,8 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
|||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python-devel >= 2.4
|
BuildRequires: python-devel >= 2.4
|
||||||
|
|
||||||
|
Patch0: 0001-Fixed-github-Issue-no.-2.-Thanks-keesbos.patch
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A pure Python network address representation and manipulation library.
|
A pure Python network address representation and manipulation library.
|
||||||
@ -48,6 +50,7 @@ API documentation for the latest release is available here :-
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n netaddr-%{version}
|
%setup -q -n netaddr-%{version}
|
||||||
|
%patch0 -p1 -b .invalid_ip_network
|
||||||
|
|
||||||
# Make rpmlint happy, get rid of DOS line endings
|
# Make rpmlint happy, get rid of DOS line endings
|
||||||
%{__sed} -i 's/\r//' netaddr/*.py
|
%{__sed} -i 's/\r//' netaddr/*.py
|
||||||
@ -59,6 +62,8 @@ API documentation for the latest release is available here :-
|
|||||||
find netaddr -name "*.py" | \
|
find netaddr -name "*.py" | \
|
||||||
xargs %{__perl} -ni -e 'print unless /usr\/bin\/python|env\s+python/'
|
xargs %{__perl} -ni -e 'print unless /usr\/bin\/python|env\s+python/'
|
||||||
|
|
||||||
|
# Make rpmlint happy, fix permissions on documentation files
|
||||||
|
chmod 0644 README AUTHORS CHANGELOG COPYRIGHT INSTALL LICENSE PKG-INFO
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%{__python} setup.py build
|
%{__python} setup.py build
|
||||||
@ -84,6 +89,10 @@ rm -rf %{buildroot}
|
|||||||
%{_bindir}/netaddr
|
%{_bindir}/netaddr
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon May 30 2011 Jakub Hrozek <jhrozek@redhat.com> - 0.7.5-3
|
||||||
|
- Do not traceback on invalid IPNetwork input (upstream issues #2, #6, #5, #8)
|
||||||
|
- Remove executable bit from documentation files to make rpmlint happy
|
||||||
|
|
||||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.5-2
|
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.5-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user