Update to 0.8

Resolves: RHEL-35671
This commit is contained in:
Ondrej Holy 2024-04-17 13:28:21 +02:00
parent 5621de578a
commit 39b2e2d0ef
4 changed files with 7 additions and 93 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
/wsdd-0.6.4.tar.gz
/wsdd-0.7.0.tar.gz
/wsdd-0.7.1.tar.gz
/wsdd-0.8.tar.gz

View File

@ -1,87 +0,0 @@
From c4a5f346bbb22777a8f66b0d6c6ef899f6d6cc74 Mon Sep 17 00:00:00 2001
From: Steffen Christgau <mail@s14u.de>
Date: Sun, 14 May 2023 21:47:16 +0200
Subject: [PATCH] fix(src): Handle multiple xaddrs in ResolveMatch/ProbeMatch
Currently, the `ProbeMatch`/`ResolveMatch` messages with multiple
transport addresses cause the `http.client.InvalidURL: URL can't contain
control characters.` exceptions. Those messages seem to be valid and can
be received e.g. from HP printers. Let's use the same approach as it was
implemented for the `Hello` message over the
https://github.com/christgau/wsdd/commit/918a1ae8a3e600366ccdf936bb247a43143f298f
commit to fix this issue.
Related: https://github.com/christgau/wsdd/issues/89
Fixes: https://github.com/christgau/wsdd/issues/149
Co-authored-by: Ondrej Holy <ondrejholy@users.noreply.github.com>
Signed-off-by: Steffen Christgau <mail@s14u.de>
---
src/wsdd.py | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/src/wsdd.py b/src/wsdd.py
index 862c6eb..39f54c9 100755
--- a/src/wsdd.py
+++ b/src/wsdd.py
@@ -738,6 +738,17 @@ def teardown(self) -> None:
def handle_packet(self, msg: str, src: Optional[UdpAddress] = None) -> None:
self.handle_message(msg, src)
+ def __extract_xaddr(self, xaddrs: str) -> Optional[str]:
+ for addr in xaddrs.strip().split():
+ if (self.mch.address.family == socket.AF_INET6) and ('//[fe80::' in addr):
+ # use first link-local address for IPv6
+ return addr
+ elif self.mch.address.family == socket.AF_INET:
+ # use first (and very likely the only) IPv4 address
+ return addr
+
+ return None
+
def handle_hello(self, header: ElementTree.Element, body: ElementTree.Element) -> Optional[WSDMessage]:
pm_path = 'wsd:Hello'
endpoint, xaddrs = self.extract_endpoint_metadata(body, pm_path)
@@ -747,17 +758,7 @@ def handle_hello(self, header: ElementTree.Element, body: ElementTree.Element) -
self.enqueue_datagram(msg, self.mch.multicast_address)
return None
- xaddr = None
- for addr in xaddrs.strip().split():
- if (self.mch.address.family == socket.AF_INET6) and ('//[fe80::' in addr):
- # use first link-local address for IPv6
- xaddr = addr
- break
- elif self.mch.address.family == socket.AF_INET:
- # use first (and very likely the only) IPv4 address
- xaddr = addr
- break
-
+ xaddr = self.__extract_xaddr(xaddrs)
if xaddr is None:
return None
@@ -790,7 +791,10 @@ def handle_probe_match(self, header: ElementTree.Element, body: ElementTree.Elem
self.enqueue_datagram(msg, self.mch.multicast_address)
return None
- xaddr = xaddrs.strip()
+ xaddr = self.__extract_xaddr(xaddrs)
+ if xaddr is None:
+ return None
+
logger.debug('probe match for {} on {}'.format(endpoint, xaddr))
self.perform_metadata_exchange(endpoint, xaddr)
@@ -809,7 +813,10 @@ def handle_resolve_match(self, header: ElementTree.Element, body: ElementTree.El
logger.debug('resolve match without endpoint/xaddr')
return None
- xaddr = xaddrs.strip()
+ xaddr = self.__extract_xaddr(xaddrs)
+ if xaddr is None:
+ return None
+
logger.debug('resolve match for {} on {}'.format(endpoint, xaddr))
self.perform_metadata_exchange(endpoint, xaddr)

View File

@ -1,3 +1,3 @@
SHA512 (wsdd.xml) = 36def332798589dde0a5c514f64812f888208e18b8ccd163f1e1ab80fd81838c9b6c900f5e4d1a45ace571b1effa16182ad8116c7bdd836a4c8cf36f49bd863e
SHA512 (wsdd-http.xml) = 6238be4d37eaeb412ce87f67cd6fa19af3a3dea25c1a23537eff6955eaf7bcce399a13d845107b65a3c4bb0bc89d4bf372570742aa5ed0b2f7ecfd0598c1a23e
SHA512 (wsdd-0.7.1.tar.gz) = 3d65fd5d5b4bd6ff37409e07301e082ffd2bb5df184cc12730e2cb2d36ebef030c6121b515af9c7eca59562e73414c7da6f7a6cd1b05c3bb27745e402cd7f684
SHA512 (wsdd-0.8.tar.gz) = e3e5164f9ebe39c979456169bf1b0c6c4cd974792f08fa4dfab9c313fba88ae1208a8112db09c3655719b4e26bfc2616f844f17d2a245132c2f5b22e978e3c20

View File

@ -1,6 +1,6 @@
Name: wsdd
Version: 0.7.1
Release: 3%{?dist}
Version: 0.8
Release: 1%{?dist}
Summary: Web Services Dynamic Discovery host daemon
License: MIT
URL: https://github.com/christgau/wsdd
@ -8,9 +8,6 @@ Source0: https://github.com/christgau/wsdd/archive/v%{version}/wsdd-%{ver
Source1: wsdd.xml
Source2: wsdd-http.xml
# https://github.com/christgau/wsdd/issues/149
Patch: c4a5f346bbb22777a8f66b0d6c6ef899f6d6cc74.patch
Patch: Modify-systemd-service-for-Fedora.patch
BuildArch: noarch
@ -65,6 +62,9 @@ exit 0
%changelog
* Wed Apr 17 2024 Ondrej Holy <oholy@redhat.com> - 0.8.0-1
- Update to 0.8
* Fri Feb 16 2024 Ondrej Holy <oholy@redhat.com> - 0.7.1-3
- Fix backward compatibility (#2254986)