diff options
author | CoprDistGit <copr-devel@lists.fedorahosted.org> | 2023-03-02 12:20:24 +0000 |
---|---|---|
committer | CoprDistGit <copr-devel@lists.fedorahosted.org> | 2023-03-02 12:20:24 +0000 |
commit | bf0123cbb8970a9c5a361f357357f3cf4b4d3fb0 (patch) | |
tree | 1a7d52cd2dda47e7723d94f77b83c4d196eb11b4 | |
parent | de2ce39bd3312c337a8e48fb61952167ae49c599 (diff) |
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | mdns-cmake-installation-fix.patch | 35 | ||||
-rw-r--r-- | mdns-upstream-fixes.patch | 180 | ||||
-rw-r--r-- | mdns.spec | 57 | ||||
-rw-r--r-- | sources | 1 |
5 files changed, 274 insertions, 0 deletions
@@ -0,0 +1 @@ +/mdns-1.4.2.tar.gz diff --git a/mdns-cmake-installation-fix.patch b/mdns-cmake-installation-fix.patch new file mode 100644 index 0000000..c4376ab --- /dev/null +++ b/mdns-cmake-installation-fix.patch @@ -0,0 +1,35 @@ +From e26e576bec52165c8dc15797abb0e72754a30fdb Mon Sep 17 00:00:00 2001 +From: Vitaly Zaitsev <vitaly@easycoding.org> +Date: Thu, 2 Mar 2023 13:10:19 +0100 +Subject: [PATCH] Fixed incorrect CMake config destination path. + +Also switched to CMAKE_INSTALL_INCLUDEDIR for header installation. +--- + CMakeLists.txt | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1231e3f..23b6681 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,16 +52,16 @@ write_basic_package_version_file( + configure_package_config_file( + "${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" INSTALL_DESTINATION +- ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) ++ ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}) + + install( + EXPORT ${PROJECT_NAME}_Targets + FILE ${PROJECT_NAME}Targets.cmake + NAMESPACE ${PROJECT_NAME}:: +- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) ++ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}) + + install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" +- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake) ++ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}/) + +-install(FILES "${PROJECT_SOURCE_DIR}/mdns.h" DESTINATION include) ++install(FILES "${PROJECT_SOURCE_DIR}/mdns.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/mdns-upstream-fixes.patch b/mdns-upstream-fixes.patch new file mode 100644 index 0000000..1b55591 --- /dev/null +++ b/mdns-upstream-fixes.patch @@ -0,0 +1,180 @@ +From e092f068b9cedccec06d040f3a0a950674060a7f Mon Sep 17 00:00:00 2001 +From: Mattias Jansson <mjansson@gmail.com> +Date: Wed, 18 May 2022 11:59:09 +0200 +Subject: [PATCH 1/7] ignore questions in query receive + +--- + mdns.h | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/mdns.h b/mdns.h +index 4b3b03d..c883af4 100644 +--- a/mdns.h ++++ b/mdns.h +@@ -1149,9 +1149,6 @@ mdns_query_recv(int sock, void* buffer, size_t capacity, mdns_record_callback_fn + if ((only_query_id > 0) && (query_id != only_query_id)) + return 0; // Not a reply to the wanted one-shot query + +- if (questions > 1) +- return 0; +- + // Skip questions part + int i; + for (i = 0; i < questions; ++i) { + +From 96c61a237707e664d236c36faa53bbbbc2c647e6 Mon Sep 17 00:00:00 2001 +From: Christian <76789692+ChristianHillenbrand@users.noreply.github.com> +Date: Tue, 9 Aug 2022 22:46:14 +0200 +Subject: [PATCH 2/7] parse boolean txt records (keys without value) correctly + (#63) + +--- + mdns.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/mdns.h b/mdns.h +index c883af4..6074337 100644 +--- a/mdns.h ++++ b/mdns.h +@@ -1572,11 +1572,13 @@ mdns_record_parse_txt(const void* buffer, size_t size, size_t offset, size_t len + ++strdata; + offset += sublength + 1; + +- size_t separator = 0; ++ size_t separator = sublength; + for (size_t c = 0; c < sublength; ++c) { + // DNS-SD TXT record keys MUST be printable US-ASCII, [0x20, 0x7E] +- if ((strdata[c] < 0x20) || (strdata[c] > 0x7E)) ++ if ((strdata[c] < 0x20) || (strdata[c] > 0x7E)) { ++ separator = 0; + break; ++ } + if (strdata[c] == '=') { + separator = c; + break; + +From 660b872dddcd870cd146fee392298bdfaf986ce1 Mon Sep 17 00:00:00 2001 +From: Mattias Jansson <mjansson@gmail.com> +Date: Wed, 10 Aug 2022 10:18:32 +0200 +Subject: [PATCH 3/7] Reset value parameters for boolean txt records + +--- + mdns.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/mdns.h b/mdns.h +index 6074337..c59772a 100644 +--- a/mdns.h ++++ b/mdns.h +@@ -1596,6 +1596,8 @@ mdns_record_parse_txt(const void* buffer, size_t size, size_t offset, size_t len + } else { + records[parsed].key.str = strdata; + records[parsed].key.length = sublength; ++ records[parsed].value.str = 0; ++ records[parsed].value.length = 0; + } + + ++parsed; + +From 166152bfbd84bb2e4d75963e700ab14e858ac626 Mon Sep 17 00:00:00 2001 +From: Murat <murat@balaban.io> +Date: Sat, 10 Dec 2022 07:32:46 -0800 +Subject: [PATCH 4/7] Fix a possible heap overflow in txt record parse (#65) + +Co-authored-by: mb <murat@sunnyvalley.io> +--- + mdns.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mdns.h b/mdns.h +index c59772a..fc0725e 100644 +--- a/mdns.h ++++ b/mdns.h +@@ -1569,6 +1569,9 @@ mdns_record_parse_txt(const void* buffer, size_t size, size_t offset, size_t len + strdata = (const char*)MDNS_POINTER_OFFSET(buffer, offset); + size_t sublength = *(const unsigned char*)strdata; + ++ if (sublength >= (end - offset)) ++ break; ++ + ++strdata; + offset += sublength + 1; + + +From fb42c3b970ce4a9528bb4ca5053788ea56357788 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mateusz=20P=C5=82=C3=B3ciennik?= + <mateusz-plociennik@users.noreply.github.com> +Date: Fri, 23 Dec 2022 18:39:29 +1100 +Subject: [PATCH 5/7] Fix mdns_query_recv() return storage type (#66) + +--- + mdns.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mdns.c b/mdns.c +index 433936d..bdef285 100644 +--- a/mdns.c ++++ b/mdns.c +@@ -817,8 +817,8 @@ send_mdns_query(mdns_query_t* query, size_t count) { + if (res > 0) { + for (int isock = 0; isock < num_sockets; ++isock) { + if (FD_ISSET(sockets[isock], &readfs)) { +- int rec = mdns_query_recv(sockets[isock], buffer, capacity, query_callback, +- user_data, query_id[isock]); ++ size_t rec = mdns_query_recv(sockets[isock], buffer, capacity, query_callback, ++ user_data, query_id[isock]); + if (rec > 0) + records += rec; + } + +From 4b337d16bf69a0c5ae177f235ddd96b716d22fb4 Mon Sep 17 00:00:00 2001 +From: Alexey Sokolov <alexey+github@asokolov.org> +Date: Mon, 16 Jan 2023 12:52:27 +0000 +Subject: [PATCH 6/7] Fix build on musl (#69) + +Ref https://bugs.gentoo.org/890790 +--- + mdns.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mdns.c b/mdns.c +index bdef285..959453f 100644 +--- a/mdns.c ++++ b/mdns.c +@@ -16,6 +16,7 @@ + #include <netdb.h> + #include <ifaddrs.h> + #include <net/if.h> ++#include <sys/time.h> + #endif + + // Alias some things to simulate recieving data to fuzz library + +From f7d8a3ace8c65c7babcf09083c06d8e2015c6923 Mon Sep 17 00:00:00 2001 +From: dmurzaikins <124827413+dmurzaikins@users.noreply.github.com> +Date: Thu, 9 Feb 2023 12:19:25 +0200 +Subject: [PATCH 7/7] Set language and standard for CMake (#72) + +--- + CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1f644b5..1231e3f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ + cmake_minimum_required(VERSION 3.0) +-project(mdns VERSION 1.2.0) ++project(mdns VERSION 1.4.2 LANGUAGES C) + + option(MDNS_BUILD_EXAMPLE "build example" ON) + +@@ -19,6 +19,7 @@ if(WIN32) + target_link_libraries(${PROJECT_NAME} INTERFACE iphlpapi ws2_32) + endif() + add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) ++target_compile_features(${PROJECT_NAME} INTERFACE c_std_99) + + # ############################################################################## + # example diff --git a/mdns.spec b/mdns.spec new file mode 100644 index 0000000..257db3f --- /dev/null +++ b/mdns.spec @@ -0,0 +1,57 @@ +%global _description %{expand: +This library provides a header only cross-platform mDNS and DNS-DS library +in C. + +The library does DNS-SD discovery and service as well as one-shot single +record mDNS query and response. There are no memory allocations done by +the library, all buffers used must be passed in by the caller. + +Custom data for use in processing can be passed along using a user data +opaque pointer.} + +Name: mdns +Version: 1.4.2 +Release: 1%{?dist} + +License: LicenseRef-Fedora-Public-Domain +Summary: mDNS/DNS-SD library in C +URL: https://github.com/mjansson/%{name} +Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +BuildArch: noarch + +Patch100: %{name}-upstream-fixes.patch +Patch101: %{name}-cmake-installation-fix.patch + +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: ninja-build + +%description %{_description} + +%package devel +Summary: Standalone CMake-Based C++ Resource Compiler +Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description devel %{_description} + +%prep +%autosetup -p1 + +%build +%cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DMDNS_BUILD_EXAMPLE:BOOL=OFF +%cmake_build + +%install +%cmake_install + +%files devel +%doc CHANGELOG README.md +%license LICENSE +%{_datadir}/cmake/%{name}/ +%{_includedir}/%{name}.h + +%changelog +* Thu Mar 02 2023 Vitaly Zaitsev <vitaly@easycoding.org> - 1.4.2-1 +- Initial SPEC release. @@ -0,0 +1 @@ +b097394d3c1177eeec521299b73ec881 mdns-1.4.2.tar.gz |