Compare commits

...

No commits in common. "c8" and "c10s-cve-2024-52615" have entirely different histories.

30 changed files with 802 additions and 1133 deletions

View File

@ -1 +0,0 @@
8a062878968c0f8e083046429647ad33b122542f SOURCES/avahi-0.7.tar.gz

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

10
.gitignore vendored
View File

@ -1 +1,9 @@
SOURCES/avahi-0.7.tar.gz
/x86_64
/.build-*.log
/avahi-0.6.3?/
*.src.rpm
/avahi-0.6.31.tar.gz
/avahi-0.6.32.tar.gz
/avahi-0.7.tar.gz
/avahi-0.8.tar.gz
/v0.9-rc2.tar.gz

View File

@ -0,0 +1,33 @@
From 358e5a3b0122b418614e2ac0fc71f6aad1de06f8 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 23 Jun 2025 16:27:40 +0200
Subject: [PATCH] Make data member as big as IPv6 address
Unfortunately, recent FORTIFY_SOURCE hardening for inet_pton() can't
deal with our type independent "data[1]" union member trick.
Fixes #699
---
avahi-common/address.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/avahi-common/address.h b/avahi-common/address.h
index a14104f..013fa97 100644
--- a/avahi-common/address.h
+++ b/avahi-common/address.h
@@ -71,9 +71,9 @@ typedef struct AvahiAddress {
AvahiProtocol proto; /**< Address family */
union {
- AvahiIPv6Address ipv6; /**< Address when IPv6 */
- AvahiIPv4Address ipv4; /**< Address when IPv4 */
- uint8_t data[1]; /**< Type-independent data field */
+ AvahiIPv6Address ipv6; /**< Address when IPv6 */
+ AvahiIPv4Address ipv4; /**< Address when IPv4 */
+ uint8_t data[sizeof(AvahiIPv6Address)]; /**< Type-independent data field */
} data;
} AvahiAddress;
--
2.49.0

View File

@ -21,5 +21,5 @@ index c978d94..fa4a9a8 100644
static void domain_browser_ref(AvahiDomainBrowser *db) {
--
2.17.2
2.39.3 (Apple Git-146)

View File

@ -0,0 +1,31 @@
From bf92dbc2c0cb39b4c970dcf700254ab5293b3756 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Mon, 5 Dec 2022 20:17:42 +0000
Subject: [PATCH] avahi-core: rearrange deallocations in
avahi_time_event_queue_new a bit
Reported by Coverity Scan.
---
avahi-core/timeeventq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/avahi-core/timeeventq.c b/avahi-core/timeeventq.c
index 2799bf2..beceaff 100644
--- a/avahi-core/timeeventq.c
+++ b/avahi-core/timeeventq.c
@@ -135,10 +135,10 @@ AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api) {
oom:
if (q) {
- avahi_free(q);
-
if (q->prioq)
avahi_prio_queue_free(q->prioq);
+
+ avahi_free(q);
}
return NULL;
--
2.39.3 (Apple Git-146)

View File

@ -0,0 +1,227 @@
From 4e2e1ea0908d7e6ad7f38ae04fdcdf2411f8b942 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 27 Nov 2024 18:07:32 +0100
Subject: [PATCH] core/wide-area: fix for CVE-2024-52615
---
avahi-core/wide-area.c | 128 ++++++++++++++++++++++-------------------
1 file changed, 69 insertions(+), 59 deletions(-)
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index 00a1505..06df7af 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -81,6 +81,10 @@ struct AvahiWideAreaLookup {
AvahiAddress dns_server_used;
+ int fd;
+ AvahiWatch *watch;
+ AvahiProtocol proto;
+
AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, lookups);
AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, by_key);
};
@@ -88,9 +92,6 @@ struct AvahiWideAreaLookup {
struct AvahiWideAreaLookupEngine {
AvahiServer *server;
- int fd_ipv4, fd_ipv6;
- AvahiWatch *watch_ipv4, *watch_ipv6;
-
/* Cache */
AVAHI_LLIST_HEAD(AvahiWideAreaCacheEntry, cache);
AvahiHashmap *cache_by_key;
@@ -125,35 +126,67 @@ static AvahiWideAreaLookup* find_lookup(AvahiWideAreaLookupEngine *e, uint16_t i
return l;
}
+static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent events, void *userdata);
+
static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
+ AvahiWideAreaLookupEngine *e;
AvahiAddress *a;
+ AvahiServer *s;
+ AvahiWatch *w;
+ int r;
assert(l);
assert(p);
- if (l->engine->n_dns_servers <= 0)
+ e = l->engine;
+ assert(e);
+
+ s = e->server;
+ assert(s);
+
+ if (e->n_dns_servers <= 0)
return -1;
- assert(l->engine->current_dns_server < l->engine->n_dns_servers);
+ assert(e->current_dns_server < e->n_dns_servers);
- a = &l->engine->dns_servers[l->engine->current_dns_server];
+ a = &e->dns_servers[e->current_dns_server];
l->dns_server_used = *a;
- if (a->proto == AVAHI_PROTO_INET) {
+ if (l->fd >= 0) {
+ /* We are reusing lookup object and sending packet to another server so let's cleanup before we establish connection to new server. */
+ s->poll_api->watch_free(l->watch);
+ l->watch = NULL;
- if (l->engine->fd_ipv4 < 0)
- return -1;
+ close(l->fd);
+ l->fd = -EBADF;
+ }
- return avahi_send_dns_packet_ipv4(l->engine->fd_ipv4, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv4, AVAHI_DNS_PORT);
+ assert(a->proto == AVAHI_PROTO_INET || a->proto == AVAHI_PROTO_INET6);
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
+ if (a->proto == AVAHI_PROTO_INET)
+ r = s->config.use_ipv4 ? avahi_open_unicast_socket_ipv4() : -1;
+ else
+ r = s->config.use_ipv6 ? avahi_open_unicast_socket_ipv6() : -1;
- if (l->engine->fd_ipv6 < 0)
- return -1;
+ if (r < 0) {
+ avahi_log_error(__FILE__ ": Failed to create socket for wide area lookup");
+ return -1;
+ }
- return avahi_send_dns_packet_ipv6(l->engine->fd_ipv6, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv6, AVAHI_DNS_PORT);
+ w = s->poll_api->watch_new(s->poll_api, r, AVAHI_WATCH_IN, socket_event, l);
+ if (!w) {
+ close(r);
+ avahi_log_error(__FILE__ ": Failed to create socket watch for wide area lookup");
+ return -1;
}
+
+ l->fd = r;
+ l->watch = w;
+ l->proto = a->proto;
+
+ return a->proto == AVAHI_PROTO_INET ?
+ avahi_send_dns_packet_ipv4(l->fd, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv4, AVAHI_DNS_PORT):
+ avahi_send_dns_packet_ipv6(l->fd, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv6, AVAHI_DNS_PORT);
}
static void next_dns_server(AvahiWideAreaLookupEngine *e) {
@@ -246,6 +279,9 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
l->dead = 0;
l->key = avahi_key_ref(key);
l->cname_key = avahi_key_new_cname(l->key);
+ l->fd = -EBADF;
+ l->watch = NULL;
+ l->proto = AVAHI_PROTO_UNSPEC;
l->callback = callback;
l->userdata = userdata;
@@ -314,6 +350,12 @@ static void lookup_destroy(AvahiWideAreaLookup *l) {
if (l->cname_key)
avahi_key_unref(l->cname_key);
+ if (l->watch)
+ l->engine->server->poll_api->watch_free(l->watch);
+
+ if (l->fd >= 0)
+ close(l->fd);
+
avahi_free(l);
}
@@ -572,14 +614,20 @@ finish:
}
static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent events, void *userdata) {
- AvahiWideAreaLookupEngine *e = userdata;
+ AvahiWideAreaLookup *l = userdata;
+ AvahiWideAreaLookupEngine *e = l->engine;
AvahiDnsPacket *p = NULL;
- if (fd == e->fd_ipv4)
- p = avahi_recv_dns_packet_ipv4(e->fd_ipv4, NULL, NULL, NULL, NULL, NULL);
+ assert(l);
+ assert(e);
+ assert(l->fd == fd);
+
+ if (l->proto == AVAHI_PROTO_INET)
+ p = avahi_recv_dns_packet_ipv4(l->fd, NULL, NULL, NULL, NULL, NULL);
else {
- assert(fd == e->fd_ipv6);
- p = avahi_recv_dns_packet_ipv6(e->fd_ipv6, NULL, NULL, NULL, NULL, NULL);
+ assert(l->proto == AVAHI_PROTO_INET6);
+
+ p = avahi_recv_dns_packet_ipv6(l->fd, NULL, NULL, NULL, NULL, NULL);
}
if (p) {
@@ -598,32 +646,6 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
e->server = s;
e->cleanup_dead = 0;
- /* Create sockets */
- e->fd_ipv4 = s->config.use_ipv4 ? avahi_open_unicast_socket_ipv4() : -1;
- e->fd_ipv6 = s->config.use_ipv6 ? avahi_open_unicast_socket_ipv6() : -1;
-
- if (e->fd_ipv4 < 0 && e->fd_ipv6 < 0) {
- avahi_log_error(__FILE__": Failed to create wide area sockets: %s", strerror(errno));
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
- avahi_free(e);
- return NULL;
- }
-
- /* Create watches */
-
- e->watch_ipv4 = e->watch_ipv6 = NULL;
-
- if (e->fd_ipv4 >= 0)
- e->watch_ipv4 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv4, AVAHI_WATCH_IN, socket_event, e);
- if (e->fd_ipv6 >= 0)
- e->watch_ipv6 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv6, AVAHI_WATCH_IN, socket_event, e);
-
e->n_dns_servers = e->current_dns_server = 0;
/* Initialize cache */
@@ -651,18 +673,6 @@ void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
avahi_hashmap_free(e->lookups_by_id);
avahi_hashmap_free(e->lookups_by_key);
- if (e->watch_ipv4)
- e->server->poll_api->watch_free(e->watch_ipv4);
-
- if (e->watch_ipv6)
- e->server->poll_api->watch_free(e->watch_ipv6);
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
avahi_free(e);
}
@@ -680,7 +690,7 @@ void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddres
if (a) {
for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
- if ((a->proto == AVAHI_PROTO_INET && e->fd_ipv4 >= 0) || (a->proto == AVAHI_PROTO_INET6 && e->fd_ipv6 >= 0))
+ if (a->proto == AVAHI_PROTO_INET || a->proto == AVAHI_PROTO_INET6)
e->dns_servers[e->n_dns_servers++] = *a;
} else {
assert(n == 0);
--
2.49.0

View File

@ -1,40 +0,0 @@
From 447affe29991ee99c6b9732fc5f2c1048a611d3b Mon Sep 17 00:00:00 2001
From: Riccardo Schirone <sirmy15@gmail.com>
Date: Fri, 26 Mar 2021 11:50:24 +0100
Subject: [PATCH] Avoid infinite-loop in avahi-daemon by handling HUP event in
client_work
If a client fills the input buffer, client_work() disables the
AVAHI_WATCH_IN event, thus preventing the function from executing the
`read` syscall the next times it is called. However, if the client then
terminates the connection, the socket file descriptor receives a HUP
event, which is not handled, thus the kernel keeps marking the HUP event
as occurring. While iterating over the file descriptors that triggered
an event, the client file descriptor will keep having the HUP event and
the client_work() function is always called with AVAHI_WATCH_HUP but
without nothing being done, thus entering an infinite loop.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984938
---
avahi-daemon/simple-protocol.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c
index 3e0ebb1..6c0274d 100644
--- a/avahi-daemon/simple-protocol.c
+++ b/avahi-daemon/simple-protocol.c
@@ -424,6 +424,11 @@ static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEv
}
}
+ if (events & AVAHI_WATCH_HUP) {
+ client_free(c);
+ return;
+ }
+
c->server->poll_api->watch_update(
watch,
(c->outbuf_length > 0 ? AVAHI_WATCH_OUT : 0) |
--
2.41.0

View File

@ -1,28 +0,0 @@
From bbf47e831143dc87c90811f404ccbae580930ff0 Mon Sep 17 00:00:00 2001
From: Gustavo Noronha Silva <gustavo@noronha.dev.br>
Date: Sun, 2 Jan 2022 22:29:04 -0300
Subject: [PATCH] Do not disable timeout cleanup on watch cleanup
This was causing timeouts to never be removed from the linked list that
tracks them, resulting in both memory and CPU usage to grow larger over
time.
---
avahi-common/simple-watch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
index 08d8090..2a4a989 100644
--- a/avahi-common/simple-watch.c
+++ b/avahi-common/simple-watch.c
@@ -238,7 +238,7 @@ static void cleanup_watches(AvahiSimplePoll *s, int all) {
destroy_watch(w);
}
- s->timeout_req_cleanup = 0;
+ s->watch_req_cleanup = 0;
}
static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
--
2.45.2

View File

@ -1,56 +0,0 @@
From 509b0d14fa46b7015e0bacf2a8105f1d14d7b5e5 Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Wed, 23 Aug 2023 18:51:46 +0200
Subject: [PATCH] Emit error if requested service is not found
It currently just crashes instead of replying with error. Check return
value and emit error instead of passing NULL pointer to reply.
Fixes #375
---
avahi-daemon/dbus-protocol.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
index eb8a662..a9b62fe 100644
--- a/avahi-daemon/dbus-protocol.c
+++ b/avahi-daemon/dbus-protocol.c
@@ -391,10 +391,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
t = avahi_alternative_host_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
+ if (t) {
+ avahi_dbus_respond_string(c, m, t);
+ avahi_free(t);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_HANDLED;
+ } else {
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Hostname not found");
+ }
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeServiceName")) {
char *n, *t;
@@ -405,10 +409,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
t = avahi_alternative_service_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
+ if (t) {
+ avahi_dbus_respond_string(c, m, t);
+ avahi_free(t);
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_HANDLED;
+ } else {
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Service not found");
+ }
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "EntryGroupNew")) {
Client *client;
--
2.41.0

View File

@ -1,55 +0,0 @@
From 94cb6489114636940ac683515417990b55b5d66c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Tue, 11 Apr 2023 15:29:59 +0200
Subject: [PATCH] Ensure each label is at least one byte long
The only allowed exception is single dot, where it should return empty
string.
Fixes #454.
---
avahi-common/domain-test.c | 14 ++++++++++++++
avahi-common/domain.c | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/avahi-common/domain-test.c b/avahi-common/domain-test.c
index cf763ec..3acc1c1 100644
--- a/avahi-common/domain-test.c
+++ b/avahi-common/domain-test.c
@@ -45,6 +45,20 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo."));
avahi_free(s);
+ printf("%s\n", s = avahi_normalize_name_strdup("."));
+ avahi_free(s);
+
+ s = avahi_normalize_name_strdup(",.=.}.=.?-.}.=.?.?.}.}.?.?.?.z.?.?.}.}."
+ "}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.}.}.}"
+ ".?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.?.zM.?`"
+ "?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}??.}.}.?.?."
+ "?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.?`?.}.}.}."
+ "??.?.zM.?`?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}?"
+ "?.}.}.?.?.?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM."
+ "?`?.}.}.}.?.?.?.r.=.=.?.?`.?.?}.}.}.?.?.?.r.=.?.}.=.?.?."
+ "}.?.?.?.}.=.?.?.}");
+ assert(s == NULL);
+
printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff"));
printf("%i\n", avahi_domain_equal("A", "a"));
diff --git a/avahi-common/domain.c b/avahi-common/domain.c
index 3b1ab68..e66d241 100644
--- a/avahi-common/domain.c
+++ b/avahi-common/domain.c
@@ -201,7 +201,7 @@ char *avahi_normalize_name(const char *s, char *ret_s, size_t size) {
}
if (!empty) {
- if (size < 1)
+ if (size < 2)
return NULL;
*(r++) = '.';
--
2.41.0

View File

@ -1,231 +0,0 @@
From be7992f35ab4ed7ed9907319b429dc079c2b7285 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Tue, 11 Jul 2017 21:52:37 +0200
Subject: [PATCH] avahi-python: Use the agnostic DBM interface
Also fixes configure failing if Python 3 is the build python and GDBM is
enabled, since Py3 only has anydbm under the name of 'dbm'.
Not enough to make ServiceTypeDatabase.py compatible with Py3, but it's
a start.
(cherry picked from commit 63750f1be96ad08c407193b08bf3b9ee74310e2d)
Related: #1561019
---
avahi-python/avahi/Makefile.am | 15 +----------
avahi-python/avahi/ServiceTypeDatabase.py.in | 33 ++++++++++++++++++-------
configure.ac | 9 +++----
service-type-database/Makefile.am | 18 +++-----------
service-type-database/{build-db.in => build-db} | 13 +++++++---
5 files changed, 42 insertions(+), 46 deletions(-)
rename service-type-database/{build-db.in => build-db} (87%)
diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am
index 3eb67d0..c906b9b 100644
--- a/avahi-python/avahi/Makefile.am
+++ b/avahi-python/avahi/Makefile.am
@@ -25,29 +25,16 @@ avahidir = $(pythondir)/avahi
if HAVE_GDBM
nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
-
-ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,gdbm,g' \
- -e 's,@FIRST_KEY\@,key = self.db.firstkey(),g' \
- -e 's,@CHECK_KEY\@,while key is not None:,g' \
- -e 's,@NEXT_KEY\@,key = self.db.nextkey(key),g' \
- -e 's,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \
- chmod +x $@
endif
if HAVE_DBM
nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
+endif
ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
$(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,dbm,g' \
- -e 's,@FIRST_KEY\@,keys = self.db.keys(),g' \
- -e 's,@CHECK_KEY\@,for key in keys:,g' \
- -e 's,@NEXT_KEY\@,,g' \
-e 's,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \
chmod +x $@
-endif
avahi_PYTHON = $(avahi_SCRIPTS)
diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in
index 4ddd654..d7f9969 100644
--- a/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ b/avahi-python/avahi/ServiceTypeDatabase.py.in
@@ -17,7 +17,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import @DBM@
+try:
+ import anydbm as dbm
+except ImportError:
+ import dbm
+
import locale
import re
@@ -28,7 +32,7 @@ class ServiceTypeDatabase:
def __init__(self, filename = "@pkglibdatadir@/service-types.db"):
- self.db = @DBM@.open(filename, "r")
+ self.db = dbm.open(filename, "r")
l = locale.getlocale(locale.LC_MESSAGES)
@@ -90,13 +94,24 @@ class ServiceTypeDatabase:
def __iter__(self):
- @FIRST_KEY@
- @CHECK_KEY@
-
- if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
- yield key
-
- @NEXT_KEY@
+ def want_key(key):
+ if not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key):
+ return False
+ if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
+ return False
+ return True
+
+ try:
+ key = self.db.firstkey()
+ except AttributeError:
+ for key in self.db.keys():
+ if want_key(key):
+ yield key
+ else:
+ while key is not None:
+ if want_key(key):
+ yield key
+ key = self.db.nextkey(key)
def __len__(self):
diff --git a/configure.ac b/configure.ac
index 6678971..fbbf7cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -824,11 +824,10 @@ if test "x$HAVE_PYTHON" = "xyes" ; then
fi
AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
- if test "x$HAVE_GDBM" = "xyes"; then
- AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)])
- fi
- if test "x$HAVE_DBM" = "xyes"; then
- AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)])
+ if test "x$HAVE_GDBM" = "xyes" || test "x$HAVE_DBM" = "xyes"; then
+ AM_CHECK_PYMOD(anydbm,,,[
+ AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)])
+ ])
fi
fi
fi
diff --git a/service-type-database/Makefile.am b/service-type-database/Makefile.am
index d184fde..f9fa082 100644
--- a/service-type-database/Makefile.am
+++ b/service-type-database/Makefile.am
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-EXTRA_DIST=build-db.in service-types
+EXTRA_DIST=service-types
pkglibdatadir=$(libdir)/avahi
@@ -27,16 +27,11 @@ if HAVE_GDBM
noinst_SCRIPTS=build-db
pkglibdata_DATA+=service-types.db
-build-db: build-db.in
- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,gdbm,g' $< > $@ && \
- chmod +x $@
-
-service-types.db: service-types build-db
+service-types.db: service-types
$(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \
mv $@.coming $@
-CLEANFILES = service-types.db build-db
+CLEANFILES = service-types.db
endif
if HAVE_DBM
@@ -44,11 +39,6 @@ if HAVE_DBM
noinst_SCRIPTS=build-db
pkglibdata_DATA+=service-types.db.pag service-types.db.dir
-build-db: build-db.in
- $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,dbm,g' $< > $@ && \
- chmod +x $@
-
service-types.db.pag: service-types.db
$(AM_V_GEN)mv service-types.db.coming.pag service-types.db.pag
service-types.db.dir: service-types.db
@@ -57,7 +47,7 @@ service-types.db: service-types build-db
$(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \
if test -f "$@.coming"; then mv $@.coming $@; fi
-CLEANFILES = service-types.db* build-db
+CLEANFILES = service-types.db*
endif
endif
diff --git a/service-type-database/build-db.in b/service-type-database/build-db
similarity index 87%
rename from service-type-database/build-db.in
rename to service-type-database/build-db
index 4cda425..78ee892 100755
--- a/service-type-database/build-db.in
+++ b/service-type-database/build-db
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env python
# -*-python-*-
# This file is part of avahi.
#
@@ -17,7 +17,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import @DBM@, sys
+try:
+ import anydbm as dbm
+except ImportError:
+ import dbm
+
+import sys
if len(sys.argv) > 1:
infn = sys.argv[1]
@@ -29,9 +34,9 @@ if len(sys.argv) > 2:
else:
outfn = infn + ".db"
-db = @DBM@.open(outfn, "n")
+db = dbm.open(outfn, "n")
-for ln in file(infn, "r"):
+for ln in open(infn, "r"):
ln = ln.strip(" \r\n\t")
if ln == "" or ln.startswith("#"):
--
2.14.3

View File

@ -1,107 +0,0 @@
From b448c9f771bada14ae8de175695a9729f8646797 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 11 Oct 2023 17:45:44 +0200
Subject: [PATCH] common: derive alternative host name from its unescaped
version
Normalization of input makes sure we don't have to deal with special
cases like unescaped dot at the end of label.
Fixes #451 #487
CVE-2023-38473
---
avahi-common/alternative-test.c | 3 +++
avahi-common/alternative.c | 27 +++++++++++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
index 9255435..681fc15 100644
--- a/avahi-common/alternative-test.c
+++ b/avahi-common/alternative-test.c
@@ -31,6 +31,9 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
const char* const test_strings[] = {
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXüüüüüüü",
+ ").",
+ "\\.",
+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\",
"gurke",
"-",
" #",
diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
index b3d39f0..a094e6d 100644
--- a/avahi-common/alternative.c
+++ b/avahi-common/alternative.c
@@ -49,15 +49,20 @@ static void drop_incomplete_utf8(char *c) {
}
char *avahi_alternative_host_name(const char *s) {
+ char label[AVAHI_LABEL_MAX], alternative[AVAHI_LABEL_MAX*4+1];
+ char *alt, *r, *ret;
const char *e;
- char *r;
+ size_t len;
assert(s);
if (!avahi_is_valid_host_name(s))
return NULL;
- if ((e = strrchr(s, '-'))) {
+ if (!avahi_unescape_label(&s, label, sizeof(label)))
+ return NULL;
+
+ if ((e = strrchr(label, '-'))) {
const char *p;
e++;
@@ -74,19 +79,18 @@ char *avahi_alternative_host_name(const char *s) {
if (e) {
char *c, *m;
- size_t l;
int n;
n = atoi(e)+1;
if (!(m = avahi_strdup_printf("%i", n)))
return NULL;
- l = e-s-1;
+ len = e-label-1;
- if (l >= AVAHI_LABEL_MAX-1-strlen(m)-1)
- l = AVAHI_LABEL_MAX-1-strlen(m)-1;
+ if (len >= AVAHI_LABEL_MAX-1-strlen(m)-1)
+ len = AVAHI_LABEL_MAX-1-strlen(m)-1;
- if (!(c = avahi_strndup(s, l))) {
+ if (!(c = avahi_strndup(label, len))) {
avahi_free(m);
return NULL;
}
@@ -100,7 +104,7 @@ char *avahi_alternative_host_name(const char *s) {
} else {
char *c;
- if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-2)))
+ if (!(c = avahi_strndup(label, AVAHI_LABEL_MAX-1-2)))
return NULL;
drop_incomplete_utf8(c);
@@ -109,6 +113,13 @@ char *avahi_alternative_host_name(const char *s) {
avahi_free(c);
}
+ alt = alternative;
+ len = sizeof(alternative);
+ ret = avahi_escape_label(r, strlen(r), &alt, &len);
+
+ avahi_free(r);
+ r = avahi_strdup(ret);
+
assert(avahi_is_valid_host_name(r));
return r;
--
2.41.0

View File

@ -1,52 +0,0 @@
From 160e8fb6ca1b33387f30f7a6aa9159015ffda9d0 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Sun, 22 Oct 2023 10:31:31 +0000
Subject: [PATCH] core: copy resource records with zero-length rdata properly
It fixes the crash spotted
https://github.com/lathiat/avahi/pull/490#issuecomment-1773019619.
The fuzz target was updated to exercise those code paths (among other
things). Without this commit it crashes with
```
fuzz-consume-record: malloc.c:250: void *avahi_memdup(const void *, size_t): Assertion `s' failed.
==72869== ERROR: libFuzzer: deadly signal
#0 0x5031b5 in __sanitizer_print_stack_trace (avahi/out/fuzz-consume-record+0x5031b5) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
#1 0x45cd6c in fuzzer::PrintStackTrace() (avahi/out/fuzz-consume-record+0x45cd6c) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
#2 0x441c47 in fuzzer::Fuzzer::CrashCallback() (out/fuzz-consume-record+0x441c47) (BuildId: 69840d811c9ba9f74eea21e34786a2005c5dcc06)
#3 0x7f189e97ebaf (/lib64/libc.so.6+0x3dbaf) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#4 0x7f189e9cf883 in __pthread_kill_implementation (/lib64/libc.so.6+0x8e883) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#5 0x7f189e97eafd in gsignal (/lib64/libc.so.6+0x3dafd) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#6 0x7f189e96787e in abort (/lib64/libc.so.6+0x2687e) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#7 0x7f189e96779a in __assert_fail_base.cold (/lib64/libc.so.6+0x2679a) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#8 0x7f189e977186 in __assert_fail (/lib64/libc.so.6+0x36186) (BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#9 0x557bfc in avahi_memdup avahi/avahi-common/malloc.c:250:5
#10 0x54895c in avahi_record_copy avahi/avahi-core/rr.c:469:45
```
---
avahi-core/rr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/avahi-core/rr.c b/avahi-core/rr.c
index 7fa0bee..2bb8924 100644
--- a/avahi-core/rr.c
+++ b/avahi-core/rr.c
@@ -426,6 +426,7 @@ AvahiRecord *avahi_record_copy(AvahiRecord *r) {
copy->ref = 1;
copy->key = avahi_key_ref(r->key);
copy->ttl = r->ttl;
+ memset(&copy->data, 0, sizeof(copy->data));
switch (r->key->type) {
case AVAHI_DNS_TYPE_PTR:
@@ -466,7 +467,7 @@ AvahiRecord *avahi_record_copy(AvahiRecord *r) {
break;
default:
- if (!(copy->data.generic.data = avahi_memdup(r->data.generic.data, r->data.generic.size)))
+ if (r->data.generic.size && !(copy->data.generic.data = avahi_memdup(r->data.generic.data, r->data.generic.size)))
goto fail;
copy->data.generic.size = r->data.generic.size;
break;
--
2.41.0

View File

@ -1,71 +0,0 @@
From 894f085f402e023a98cbb6f5a3d117bd88d93b09 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 23 Oct 2023 13:38:35 +0200
Subject: [PATCH] core: extract host name using avahi_unescape_label()
Previously we could create invalid escape sequence when we split the
string on dot. For example, from valid host name "foo\\.bar" we have
created invalid name "foo\\" and tried to set that as the host name
which crashed the daemon.
Fixes #453
CVE-2023-38471
---
avahi-core/server.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/avahi-core/server.c b/avahi-core/server.c
index c32637a..f6a21bb 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -1295,7 +1295,11 @@ static void update_fqdn(AvahiServer *s) {
}
int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
- char *hn = NULL;
+ char label_escaped[AVAHI_LABEL_MAX*4+1];
+ char label[AVAHI_LABEL_MAX];
+ char *hn = NULL, *h;
+ size_t len;
+
assert(s);
AVAHI_CHECK_VALIDITY(s, !host_name || avahi_is_valid_host_name(host_name), AVAHI_ERR_INVALID_HOST_NAME);
@@ -1305,17 +1309,28 @@ int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
else
hn = avahi_normalize_name_strdup(host_name);
- hn[strcspn(hn, ".")] = 0;
+ h = hn;
+ if (!avahi_unescape_label((const char **)&hn, label, sizeof(label))) {
+ avahi_free(h);
+ return AVAHI_ERR_INVALID_HOST_NAME;
+ }
+
+ avahi_free(h);
+
+ h = label_escaped;
+ len = sizeof(label_escaped);
+ if (!avahi_escape_label(label, strlen(label), &h, &len))
+ return AVAHI_ERR_INVALID_HOST_NAME;
- if (avahi_domain_equal(s->host_name, hn) && s->state != AVAHI_SERVER_COLLISION) {
- avahi_free(hn);
+ if (avahi_domain_equal(s->host_name, label_escaped) && s->state != AVAHI_SERVER_COLLISION)
return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
- }
withdraw_host_rrs(s);
avahi_free(s->host_name);
- s->host_name = hn;
+ s->host_name = avahi_strdup(label_escaped);
+ if (!s->host_name)
+ return AVAHI_ERR_NO_MEMORY;
update_fqdn(s);
--
2.41.0

View File

@ -1,43 +0,0 @@
From b024ae5749f4aeba03478e6391687c3c9c8dee40 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 19 Oct 2023 17:36:44 +0200
Subject: [PATCH] core: make sure there is rdata to process before parsing it
Fixes #452
CVE-2023-38472
---
avahi-client/client-test.c | 3 +++
avahi-daemon/dbus-entry-group.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c
index b3366d8..ba97998 100644
--- a/avahi-client/client-test.c
+++ b/avahi-client/client-test.c
@@ -258,6 +258,9 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
printf("%s\n", avahi_strerror(avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL)));
printf("add_record: %d\n", avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "\5booya", 6));
+ error = avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "", 0);
+ assert(error != AVAHI_OK);
+
avahi_entry_group_commit (group);
domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, (char*) "omghai3u");
diff --git a/avahi-daemon/dbus-entry-group.c b/avahi-daemon/dbus-entry-group.c
index 4e879a5..aa23d4b 100644
--- a/avahi-daemon/dbus-entry-group.c
+++ b/avahi-daemon/dbus-entry-group.c
@@ -340,7 +340,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
if (!(r = avahi_record_new_full (name, clazz, type, ttl)))
return avahi_dbus_respond_error(c, m, AVAHI_ERR_NO_MEMORY, NULL);
- if (avahi_rdata_parse (r, rdata, size) < 0) {
+ if (!rdata || avahi_rdata_parse (r, rdata, size) < 0) {
avahi_record_unref (r);
return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_RDATA, NULL);
}
--
2.41.0

View File

@ -1,46 +0,0 @@
From a337a1ba7d15853fb56deef1f464529af6e3a1cf Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Mon, 23 Oct 2023 20:29:31 +0000
Subject: [PATCH] core: reject overly long TXT resource records
Closes https://github.com/lathiat/avahi/issues/455
CVE-2023-38469
---
avahi-core/rr.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/avahi-core/rr.c b/avahi-core/rr.c
index 2bb8924..9c04ebb 100644
--- a/avahi-core/rr.c
+++ b/avahi-core/rr.c
@@ -32,6 +32,7 @@
#include <avahi-common/malloc.h>
#include <avahi-common/defs.h>
+#include "dns.h"
#include "rr.h"
#include "log.h"
#include "util.h"
@@ -689,11 +690,17 @@ int avahi_record_is_valid(AvahiRecord *r) {
case AVAHI_DNS_TYPE_TXT: {
AvahiStringList *strlst;
+ size_t used = 0;
- for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next)
+ for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next) {
if (strlst->size > 255 || strlst->size <= 0)
return 0;
+ used += 1+strlst->size;
+ if (used > AVAHI_DNS_RDATA_MAX)
+ return 0;
+ }
+
return 1;
}
}
--
2.41.0

View File

@ -1,50 +0,0 @@
From b675f70739f404342f7f78635d6e2dcd85a13460 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Tue, 24 Oct 2023 22:04:51 +0000
Subject: [PATCH] core: return errors from avahi_server_set_host_name properly
It's a follow-up to 894f085f402e023a98cbb6f5a3d117bd88d93b09
---
avahi-core/server.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/avahi-core/server.c b/avahi-core/server.c
index f6a21bb..84df6b5 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -1309,10 +1309,13 @@ int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
else
hn = avahi_normalize_name_strdup(host_name);
+ if (!hn)
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
+
h = hn;
if (!avahi_unescape_label((const char **)&hn, label, sizeof(label))) {
avahi_free(h);
- return AVAHI_ERR_INVALID_HOST_NAME;
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
}
avahi_free(h);
@@ -1320,7 +1323,7 @@ int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
h = label_escaped;
len = sizeof(label_escaped);
if (!avahi_escape_label(label, strlen(label), &h, &len))
- return AVAHI_ERR_INVALID_HOST_NAME;
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
if (avahi_domain_equal(s->host_name, label_escaped) && s->state != AVAHI_SERVER_COLLISION)
return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
@@ -1330,7 +1333,7 @@ int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
avahi_free(s->host_name);
s->host_name = avahi_strdup(label_escaped);
if (!s->host_name)
- return AVAHI_ERR_NO_MEMORY;
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
update_fqdn(s);
--
2.41.0

View File

@ -1,24 +0,0 @@
From 93de55227583a149a375f529f3fafafae7c2c3bb Mon Sep 17 00:00:00 2001
From: Wei Li <wei.li@calix.com>
Date: Fri, 23 Dec 2022 17:02:53 +0800
Subject: [PATCH] fix memory leak in wide area lookup
---
avahi-core/wide-area.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index d5e64e5..971f5e7 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -564,6 +564,7 @@ static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSE
if (p) {
handle_packet(e, p);
avahi_dns_packet_free(p);
+ avahi_cleanup_dead_entries(e->server);
}
}
--
2.45.2

View File

@ -1,100 +0,0 @@
From 3303a8a621467dd7be67cec211fe417e9c81946f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Fri, 27 Apr 2018 11:09:07 +0100
Subject: [PATCH] avahi-python: Encode unicode strings as UTF-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, we would effectively encode anything representable in
Latin-1 as Latin-1, and crash on anything not representable in Latin-1:
>>> import avahi
>>> avahi.string_to_byte_array(u'©')
[dbus.Byte(169)]
>>> avahi.string_to_byte_array(u'\ufeff')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/avahi/__init__.py", line 94, in string_to_byte_array
r.append(dbus.Byte(ord(c)))
ValueError: Integer outside range 0-255
This is particularly important for Python 3, where the str type
is a Unicode string.
The b'' syntax for bytestrings is supported since at least Python 2.7.
These functions now accept either Unicode strings (Python 2 unicode,
Python 3 str), which are encoded in UTF-8, or bytestrings
(Python 2 str, Python 3 bytes) which are taken as-is.
Signed-off-by: Simon McVittie <smcv@debian.org>
(cherry picked from commit 169e85dbc13dcaae8a699618883e512614f540b7)
Related: #1561019
---
avahi-python/avahi/__init__.py | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/avahi-python/avahi/__init__.py b/avahi-python/avahi/__init__.py
index 7b45029..02305b0 100644
--- a/avahi-python/avahi/__init__.py
+++ b/avahi-python/avahi/__init__.py
@@ -17,6 +17,8 @@
# Some definitions matching those in avahi-common/defs.h
+import sys
+
import dbus
SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_FAILURE = range(0, 5)
@@ -66,6 +68,9 @@ DBUS_INTERFACE_HOST_NAME_RESOLVER = DBUS_NAME + ".HostNameResolver"
DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver"
DBUS_INTERFACE_RECORD_BROWSER = DBUS_NAME + ".RecordBrowser"
+if sys.version_info[0] >= 3:
+ unicode = str
+
def byte_array_to_string(s):
r = ""
@@ -86,12 +91,19 @@ def txt_array_to_string_array(t):
return l
-
def string_to_byte_array(s):
+ if isinstance(s, unicode):
+ s = s.encode('utf-8')
+
r = []
for c in s:
- r.append(dbus.Byte(ord(c)))
+ if isinstance(c, int):
+ # Python 3: iterating over bytes yields ints
+ r.append(dbus.Byte(c))
+ else:
+ # Python 2: iterating over str yields str
+ r.append(dbus.Byte(ord(c)))
return r
@@ -107,6 +119,12 @@ def dict_to_txt_array(txt_dict):
l = []
for k,v in txt_dict.items():
- l.append(string_to_byte_array("%s=%s" % (k,v)))
+ if isinstance(k, unicode):
+ k = k.encode('utf-8')
+
+ if isinstance(v, unicode):
+ v = v.encode('utf-8')
+
+ l.append(string_to_byte_array(b"%s=%s" % (k,v)))
return l
--
2.14.3

View File

@ -1,80 +0,0 @@
From ffb19d8f3c7f1fe4f31f79f8601dd3079730401b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Fri, 27 Apr 2018 09:01:13 +0100
Subject: [PATCH] Remove empty avahi_discover Python module
The avahi-discover tool no longer has any code outside its main
executable, so it does not need to install library modules. Its only
library code was avahi_discover.SimpleGladeApp, which was removed
in 2009.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
avahi-python/avahi-discover/Makefile.am | 6 ------
avahi-python/avahi-discover/__init__.py | 18 ------------------
2 files changed, 24 deletions(-)
delete mode 100755 avahi-python/avahi-discover/__init__.py
diff --git a/avahi-python/avahi-discover/Makefile.am b/avahi-python/avahi-discover/Makefile.am
index 5fc4b25..bb4d717 100644
--- a/avahi-python/avahi-discover/Makefile.am
+++ b/avahi-python/avahi-discover/Makefile.am
@@ -18,7 +18,6 @@
AM_CFLAGS=-I$(top_srcdir)
EXTRA_DIST = \
- __init__.py \
avahi-discover.py \
avahi-discover.desktop.in.in
@@ -31,15 +30,11 @@ pythonscripts =
desktopdir = $(datadir)/applications
desktop_DATA =
-avahi_discoverdir = $(pythondir)/avahi_discover
-avahi_discover_PYTHON =
-
if HAVE_GDBM
pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
@INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py
endif
if HAVE_DBM
@@ -47,7 +42,6 @@ pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
@INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py
endif
avahi-discover.desktop.in: avahi-discover.desktop.in.in
diff --git a/avahi-python/avahi-discover/__init__.py b/avahi-python/avahi-discover/__init__.py
deleted file mode 100755
index 6f3ec7f..0000000
--- a/avahi-python/avahi-discover/__init__.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
--
2.14.3

View File

@ -1,27 +0,0 @@
From 4b48927e8e2c721d103018b4ce39a164b6c2898f Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 24 Oct 2018 15:38:48 +0000
Subject: [PATCH] chroot: fix bogus assignments in assertions
---
avahi-daemon/chroot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/avahi-daemon/chroot.c b/avahi-daemon/chroot.c
index ccd56be..871b3b3 100644
--- a/avahi-daemon/chroot.c
+++ b/avahi-daemon/chroot.c
@@ -188,8 +188,8 @@ static int recv_fd(int fd) {
return -1;
}
- assert(h->cmsg_len = CMSG_LEN(sizeof(int)));
- assert(h->cmsg_level = SOL_SOCKET);
+ assert(h->cmsg_len == CMSG_LEN(sizeof(int)));
+ assert(h->cmsg_level == SOL_SOCKET);
assert(h->cmsg_type == SCM_RIGHTS);
return *((int*)CMSG_DATA(h));
--
2.17.2

View File

@ -0,0 +1,41 @@
diff -up avahi-0.8/avahi-ui/bssh.c.vnc avahi-0.8/avahi-ui/bssh.c
--- avahi-0.8/avahi-ui/bssh.c.vnc 2024-06-27 09:18:51.742457490 +0200
+++ avahi-0.8/avahi-ui/bssh.c 2024-06-27 09:43:06.669594577 +0200
@@ -186,11 +186,14 @@ int main(int argc, char*argv[]) {
if (avahi_domain_equal(t, "_rfb._tcp")) {
char p[AVAHI_DOMAIN_NAME_MAX+16];
- snprintf(p, sizeof(p), "%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900);
+ char p_prefixed[AVAHI_DOMAIN_NAME_MAX+22];
+ snprintf(p, sizeof(p), "%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900);
+ snprintf(p_prefixed, sizeof(p_prefixed), "vnc://%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900);
gtk_widget_destroy(d);
- g_print("vncviewer %s\n", p);
+ g_print("gnome-connections %s\n", p);
+ execlp("gnome-connections", "gnome-connections", p_prefixed, NULL);
execlp("xvncviewer", "xvncviewer", p, NULL);
execlp("vncviewer", "vncviewer", p, NULL);
diff -up avahi-0.8/man/bssh.1.xml.in.vnc avahi-0.8/man/bssh.1.xml.in
--- avahi-0.8/man/bssh.1.xml.in.vnc 2024-06-27 09:16:56.485135447 +0200
+++ avahi-0.8/man/bssh.1.xml.in 2024-06-27 09:18:35.817412999 +0200
@@ -32,7 +32,7 @@
<description>
<p>bssh/bvnc/bshell browses for SSH/VNC servers on the local
network, shows them in a GUI for the user to select one and
- finally calls ssh/vncviewer after a selection was made.</p>
+ finally calls ssh/GNOME Connections after a selection was made.</p>
<p>If the binary is called as bssh only ssh servers will be shown. If the binary is called as bvnc only VNC servers will be shown. If the binary is called as bshell both VNC and SSH servers are shown.</p>
@@ -76,7 +76,7 @@
<section name="See also">
<p>
- <manref name="avahi-browse" section="1"/>, <manref name="ssh" section="1"/>, <manref name="vncviewer" section="1"/>
+ <manref name="avahi-browse" section="1"/>, <manref name="ssh" section="1"/>
</p>
</section>

View File

@ -0,0 +1,31 @@
diff --git a/avahi-qt/Makefile.am b/avahi-qt/Makefile.am
index b404810..6911db8 100644
--- a/avahi-qt/Makefile.am
+++ b/avahi-qt/Makefile.am
@@ -40,7 +40,7 @@ qt-watch.moc3: qt-watch.cpp
libavahi_qt3_la_CPPFLAGS = $(AM_CFLAGS) $(QT3_CFLAGS) -DQT3 $(VISIBILITY_HIDDEN_CFLAGS)
libavahi_qt3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT3_LIBS)
-libavahi_qt3_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_QT3_VERSION_INFO)
+libavahi_qt3_la_LDFLAGS = $(AM_LDFLAGS) -Wl,--no-undefined -no-undefined -export-dynamic -version-info $(LIBAVAHI_QT3_VERSION_INFO)
endif
if HAVE_QT4
@@ -62,7 +62,7 @@ qt-watch.moc4: qt-watch.cpp
libavahi_qt4_la_CPPFLAGS = $(AM_CFLAGS) $(QT4_CFLAGS) -DQT4 $(VISIBILITY_HIDDEN_CFLAGS)
libavahi_qt4_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT4_LIBS)
-libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_QT4_VERSION_INFO)
+libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -Wl,--no-undefined -no-undefined -version-info $(LIBAVAHI_QT4_VERSION_INFO)
endif
if HAVE_QT5
@@ -84,7 +84,7 @@ qt-watch.moc5: qt-watch.cpp
libavahi_qt5_la_CPPFLAGS = $(AM_CFLAGS) --std=gnu++11 $(QT5_CFLAGS) -DQT5 $(VISIBILITY_HIDDEN_CFLAGS)
libavahi_qt5_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT5_LIBS)
-libavahi_qt5_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_QT5_VERSION_INFO)
+libavahi_qt5_la_LDFLAGS = $(AM_LDFLAGS) -Wl,--no-undefined -no-undefined -version-info $(LIBAVAHI_QT5_VERSION_INFO)
endif
CLEANFILES = $(BUILT_SOURCES)

View File

@ -1,21 +1,53 @@
%bcond_with bootstrap
%bcond_without check
%if %{without bootstrap}
%{?!WITH_MONO: %global WITH_MONO 1}
%else
%{?!WITH_MONO: %global WITH_MONO 0}
%endif
%{?!WITH_COMPAT_DNSSD: %global WITH_COMPAT_DNSSD 1}
%{?!WITH_COMPAT_HOWL: %global WITH_COMPAT_HOWL 1}
%{?!WITH_QT3: %global WITH_QT3 1}
%{?!WITH_QT4: %global WITH_QT4 1}
%{?!WITH_QT3: %global WITH_QT3 0}
%{?!WITH_QT4: %global WITH_QT4 0}
%if %{without bootstrap}
%{?!WITH_GTK2: %global WITH_GTK2 1}
%{?!WITH_GTK3: %global WITH_GTK3 1}
%{?!WITH_QT5: %global WITH_QT5 1}
%else
%{?!WITH_GTK2: %global WITH_GTK2 0}
%{?!WITH_GTK3: %global WITH_GTK3 0}
%{?!WITH_QT5: %global WITH_QT5 0}
%endif
# https://bugzilla.redhat.com/show_bug.cgi?id=1751484
%{?!WITH_PYTHON: %global WITH_PYTHON 0}
%ifnarch %{mono_arches}
%define WITH_MONO 0
%endif
%if 0%{?fedora}
%global WITH_QT3 1
%global WITH_QT4 1
%endif
%if 0%{?rhel}
%define WITH_MONO 0
%if 0%{?rhel} >= 6
%define WITH_QT4 0
%endif
%if 0%{?rhel} > 7
%define WITH_QT3 0
%endif
%if 0%{?rhel} > 9
%global WITH_GTK2 0
%endif
%global WITH_MONO 0
%global WITH_QT5 0
%if 0%{?rhel} < 8
%global WITH_PYTHON 1
%endif
%endif
%if 0%{?fedora} == 34 || 0%{?rhel} >= 9
# https://bugzilla.redhat.com/show_bug.cgi?id=1907727
%global _lto_cflags %{nil}
%endif
# http://bugzilla.redhat.com/1008395 - no hardened build
@ -24,11 +56,13 @@
# trim changelog included in binary rpms
%global _changelog_trimtime %(date +%s -d "1 year ago")
%define rc rc2
Name: avahi
Version: 0.7
Release: 27%{?dist}.1
Version: 0.9%{?rc:~%{rc}}
Release: 2%{?dist}
Summary: Local network service discovery
License: LGPLv2+
License: LGPL-2.1-or-later AND LGPL-2.0-or-later AND BSD-2-Clause-Views AND MIT
URL: http://avahi.org
Requires: dbus
Requires: expat
@ -41,12 +75,13 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
BuildRequires: automake
BuildRequires: libtool
BuildRequires: dbus-devel >= 0.90
BuildRequires: dbus-glib-devel >= 0.70
BuildRequires: python3-dbus
BuildRequires: python3-libxml2
BuildRequires: desktop-file-utils
%if %{WITH_GTK2}
BuildRequires: gtk2-devel
%endif
%if %{WITH_GTK3}
BuildRequires: gtk3-devel >= 2.99.0
%endif
#BuildRequires: gobject-introspection-devel
%if %{WITH_QT3}
BuildRequires: qt3-devel
@ -54,14 +89,36 @@ BuildRequires: qt3-devel
%if %{WITH_QT4}
BuildRequires: qt4-devel
%endif
%if %{WITH_QT5}
BuildRequires: qt5-qtbase-devel
%endif
BuildRequires: libdaemon-devel >= 0.11
BuildRequires: glib2-devel
BuildRequires: libcap-devel
BuildRequires: expat-devel
%if %{WITH_PYTHON}
%if %{without bootstrap}
BuildRequires: pygtk2
%endif
%if 0%{?fedora} > 27
%global python2_dbus python2-dbus
%global python2_libxml2 python2-libxml2
%else
%global python2_dbus dbus-python
%global python2_libxml2 libxml2-python
%endif
BuildRequires: %{python2_dbus}
BuildRequires: %{python2_libxml2}
# really only need interpreter + rpm-macros -- rex
BuildRequires: python2-devel
BuildRequires: python3-devel
%else
Obsoletes: python2-avahi < %{version}-%{release}
Obsoletes: python3-avahi < %{version}-%{release}
%endif
BuildRequires: gdbm-devel
BuildRequires: pkgconfig(pygobject-3.0)
BuildRequires: pkgconfig(libevent) >= 2.0.21
BuildRequires: intltool
BuildRequires: perl-XML-Parser
BuildRequires: xmltoman
@ -70,37 +127,25 @@ BuildRequires: mono-devel
BuildRequires: monodoc-devel
%endif
BuildRequires: systemd
%{?systemd_requires}
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gettext-devel
BuildRequires: systemd-devel
%if 0%{?beta:1}
Source0: https://github.com/lathiat/avahi/archive/%{version}-%{beta}.tar.gz#/%{name}-%{version}-%{beta}.tar.gz
%if 0%{?rc:1}
Source0: https://github.com/avahi/avahi/archive/refs/tags/v%{version_no_tilde}.tar.gz
%else
Source0: https://github.com/lathiat/avahi/releases/download/v%{version}/avahi-%{version}.tar.gz
#Source0: http://avahi.org/download/avahi-%{version}.tar.gz
Source0: https://github.com/avahi/avahi/releases/download/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
%endif
## upstream patches
Patch0001: 0001-avahi-python-Use-the-agnostic-DBM-interface.patch
Patch0002: 0002-avahi-python-Encode-unicode-strings-as-UTF-8.patch
Patch0003: 0003-Remove-empty-avahi_discover-Python-module.patch
# https://github.com/lathiat/avahi/pull/202
Patch0004: 0004-avahi-client-fix-resource-leak.patch
Patch0005: 0005-chroot-fix-bogus-assignments-in-assertions.patch
Patch0006: 0001-Emit-error-if-requested-service-is-not-found.patch
Patch0007: 0001-Ensure-each-label-is-at-least-one-byte-long.patch
Patch0008: 0001-core-make-sure-there-is-rdata-to-process-before-pars.patch
Patch0009: 0001-core-copy-resource-records-with-zero-length-rdata-pr.patch
Patch0010: 0001-common-derive-alternative-host-name-from-its-unescap.patch
Patch0011: 0001-core-extract-host-name-using-avahi_unescape_label.patch
Patch0012: 0001-core-return-errors-from-avahi_server_set_host_name-p.patch
Patch0013: 0001-core-reject-overly-long-TXT-resource-records.patch
Patch0014: 0001-Avoid-infinite-loop-in-avahi-daemon-by-handling-HUP-.patch
Patch0015: 0001-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch
Patch0016: 0001-fix-memory-leak-in-wide-area-lookup.patch
Patch0001: 0001-core-wide-area-fix-for-CVE-2024-52615.patch
Patch0002: 0001-Make-data-member-as-big-as-IPv6-address.patch
## downstream patches
Patch100: avahi-0.6.30-mono-libdir.patch
Patch100: avahi-0.6.30-mono-libdir.patch
Patch102: avahi-0.8-no_undefined.patch
Patch103: avahi-0.8-no-vncviewer-c10s.patch
%description
Avahi is a system which facilitates service discovery on
@ -119,6 +164,30 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description tools
Command line tools that use avahi to browse and publish mDNS services.
%package ui-tools
Summary: UI tools for mDNS browsing
Requires: %{name} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: %{name}-ui-gtk3%{?_isa} = %{version}-%{release}
%if 0%{?rhel} && 0%{?rhel} > 9
Requires: gnome-connections
%else
Requires: tigervnc
%endif
Requires: openssh-clients
%if %{WITH_PYTHON}
Requires: gdbm
Requires: pygtk2
Requires: pygtk2-libglade
Requires: python2-avahi = %{version}-%{release}
Requires: %{python2_dbus}
Requires: python2-gobject-base
%endif
%description ui-tools
Graphical user interface tools that use Avahi to browse for mDNS services.
%package glib
Summary: Glib libraries for avahi
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -148,12 +217,12 @@ This library contains a GObject wrapper for the Avahi API
Summary: Libraries and header files for Avahi GObject development
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-gobject%{?_isa} = %{version}-%{release}
#Requires: %{name}-glib-devel = %{version}-%{release}
%description gobject-devel
The avahi-gobject-devel package contains the header files and libraries
necessary for developing programs using avahi-gobject.
%if %{WITH_GTK2}
%package ui
Summary: Gtk user interface library for Avahi (Gtk+ 2 version)
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -162,7 +231,9 @@ Requires: gtk2
%description ui
This library contains a Gtk 2.x widget for browsing services.
%endif
%if %{WITH_GTK3}
%package ui-gtk3
Summary: Gtk user interface library for Avahi (Gtk+ 3 version)
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -171,17 +242,23 @@ Requires: gtk3
%description ui-gtk3
This library contains a Gtk 3.x widget for browsing services.
%endif
%if %{WITH_GTK2} || %{WITH_GTK3}
%package ui-devel
Summary: Libraries and header files for Avahi UI development
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%if %{WITH_GTK2}
Requires: %{name}-ui%{?_isa} = %{version}-%{release}
%endif
%if %{WITH_GTK3}
Requires: %{name}-ui-gtk3%{?_isa} = %{version}-%{release}
#Requires: %{name}-glib-devel = %{version}-%{release}
%endif
%description ui-devel
The avahi-ui-devel package contains the header files and libraries
necessary for developing programs using avahi-ui.
%endif
%if %{WITH_QT3}
%package qt3
@ -219,6 +296,24 @@ Th avahi-qt4-devel package contains the header files and libraries
necessary for developing programs using avahi with Qt4.
%endif
%if %{WITH_QT5}
%package qt5
Summary: Qt5 libraries for avahi
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description qt5
Libraries for easy use of avahi from Qt5 applications.
%package qt5-devel
Summary: Libraries and header files for avahi Qt5 development
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-qt5%{?_isa} = %{version}-%{release}
%description qt5-devel
Th avahi-qt5-devel package contains the header files and libraries
necessary for developing programs using avahi with Qt5.
%endif
%if %{WITH_MONO}
%package sharp
Summary: Mono language bindings for avahi mono development
@ -237,6 +332,7 @@ Requires: %{name}-sharp%{?_isa} = %{version}-%{release}
Requires: mono-core >= 1.1.13
Requires: gtk-sharp2
BuildRequires: gtk-sharp2-devel
BuildRequires: make
%description ui-sharp
The avahi-sharp package contains the files needed to run
@ -272,8 +368,8 @@ necessary for developing programs using avahi.
%package compat-howl
Summary: Libraries for howl compatibility
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Obsoletes: howl-libs
Provides: howl-libs
Obsoletes: howl-libs < 0.6-16
Provides: howl-libs = %{version}-%{release}
%description compat-howl
Libraries that are compatible with those provided by the howl package.
@ -282,8 +378,8 @@ Libraries that are compatible with those provided by the howl package.
Summary: Header files for development with the howl compatibility libraries
Requires: %{name}-compat-howl%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Obsoletes: howl-devel
Provides: howl-devel
Obsoletes: howl-devel < 0.6-16
Provides: howl-devel = %{version}-%{release}
%description compat-howl-devel
Header files for development with the howl compatibility libraries.
@ -330,6 +426,17 @@ avahi-dnsconfd connects to a running avahi-daemon and runs the script
local LAN. This is useful for configuring unicast DNS servers in a DHCP-like
fashion with mDNS.
%if %{WITH_PYTHON}
%package -n python2-avahi
Summary: Python2 Avahi bindings
Obsoletes: python-avahi < 0.7
Provides: python-avahi = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description -n python2-avahi
%{summary}.
%package -n python3-avahi
Summary: Python3 Avahi bindings
Requires: %{name} = %{version}-%{release}
@ -337,21 +444,22 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description -n python3-avahi
%{summary}.
%endif
%prep
%autosetup -n %{name}-%{version}%{?beta:-%{beta}} -p1
%autosetup -n %{name}-%{version_no_tilde} -p1
rm -fv docs/INSTALL
%build
# patch100 requires autogen
# and kills rpaths a bonus
rm -fv missing
## why autogen?
## * kills rpaths
## * fixes -stack-protector flags (once gcc_stack_protect.m4 is removed)
rm -fv missing common/gcc_stack_protect.m4
NOCONFIGURE=1 ./autogen.sh
export PYTHON=%{__python3}
%configure \
--with-distro=fedora \
--disable-monodoc \
@ -365,18 +473,36 @@ export PYTHON=%{__python3}
--enable-shared=yes \
--enable-static=no \
--disable-silent-rules \
--disable-stack-protector \
%if %{with check}
--enable-tests \
%endif
%if %{WITH_GTK2}
--enable-gtk \
%else
--disable-gtk \
%endif
%if %{WITH_GTK3}
--enable-gtk3 \
%else
--disable-gtk3 \
%endif
%if ! %{WITH_PYTHON}
--disable-python \
%endif
%if %{WITH_COMPAT_DNSSD}
--enable-compat-libdns_sd \
%endif
%if %{WITH_COMPAT_HOWL}
--enable-compat-howl \
%endif
%if ! %{WITH_QT3}
--disable-qt3 \
%if %{WITH_QT3}
--enable-qt3 \
%endif
%if ! %{WITH_QT4}
--disable-qt4 \
%if %{WITH_QT4}
--enable-qt4 \
%endif
%if ! %{WITH_QT5}
--disable-qt5 \
%endif
%if ! %{WITH_MONO}
--disable-mono \
@ -405,8 +531,8 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/avahi-autoipd
rm -rfv %{buildroot}%{_datadir}/%{name}-%{version}
# Make /etc/avahi/etc/localtime owned by avahi:
mkdir -p %{buildroot}/etc/avahi/etc
touch %{buildroot}/etc/avahi/etc/localtime
mkdir -p %{buildroot}%{_sysconfdir}/avahi/etc
touch %{buildroot}%{_sysconfdir}/avahi/etc/localtime
# fix bug 197414 - add missing symlinks for avahi-compat-howl and avahi-compat-dns-sd
%if %{WITH_COMPAT_HOWL}
@ -417,13 +543,12 @@ ln -s avahi-compat-libdns_sd.pc %{buildroot}/%{_libdir}/pkgconfig/libdns_sd.pc
ln -s avahi-compat-libdns_sd/dns_sd.h %{buildroot}/%{_includedir}/
%endif
%if %{WITH_PYTHON}
# Add python3 support
mkdir -p %{buildroot}%{python3_sitelib}/avahi/
cp -r %{buildroot}%{python2_sitelib}/avahi/* %{buildroot}%{python3_sitelib}/avahi/
rm -fv %{buildroot}%{buildroot}%{python3_sitelib}/avahi/*.py{c,o}
rm -fv %{buildroot}%{buildroot}%{python3_sitelib}/avahi_discover/*.py{c,o}
rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-daemon
rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-dnsconfd
sed -i 's!/usr/bin/python2!/usr/bin/python3!' %{buildroot}%{python3_sitelib}/avahi/ServiceTypeDatabase.py
# avoid empty GenericName keys from .desktop files
for i in %{buildroot}%{_datadir}/applications/*.desktop ; do
@ -431,20 +556,28 @@ if [ -n "$(grep '^GenericName=$' $i)" ]; then
desktop-file-edit --copy-name-to-generic-name $i
fi
done
%endif
# Remove python2 files installed by default
rm -rfv %{buildroot}%{python2_sitelib}/avahi/
rm -rfv %{buildroot}%{python2_sitelib}/avahi_discover/
# Remove ui-tools that depend on python2
rm -rfv %{buildroot}/%{_datadir}/avahi/interfaces
rm -fv %{buildroot}/%{_datadir}/applications/avahi-discover.desktop
rm -fv %{buildroot}/%{_datadir}/applications/bssh.desktop
rm -fv %{buildroot}/%{_datadir}/applications/bvnc.desktop
rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-daemon
rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-dnsconfd
%find_lang %{name}
%check
%if %{with check}
%make_build check
%endif
%if %{without bootstrap}
for i in %{buildroot}%{_datadir}/applications/b*.desktop ; do
desktop-file-validate $i
done
%endif
%if %{WITH_PYTHON}
desktop-file-validate %{buildroot}%{_datadir}/applications/avahi-discover.desktop
%endif
%pre
getent group avahi >/dev/null || groupadd -f -g 70 -r avahi
if ! getent passwd avahi > /dev/null ; then
@ -460,7 +593,7 @@ exit 0
%{?ldconfig}
/usr/bin/dbus-send --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig >/dev/null 2>&1 || :
if [ "$1" -eq 1 -a -s /etc/localtime ]; then
/usr/bin/cp -cfp /etc/localtime /etc/avahi/etc/localtime >/dev/null 2>&1 || :
/usr/bin/cp -cfp /etc/localtime %{_sysconfdir}/avahi/etc/localtime >/dev/null 2>&1 || :
fi
%systemd_post avahi-daemon.socket avahi-daemon.service
@ -514,12 +647,14 @@ exit 0
%dir %{_sysconfdir}/avahi/services
%ghost %attr(0755, avahi, avahi) %dir %{_localstatedir}/run/avahi-daemon
%config(noreplace) %{_sysconfdir}/avahi/avahi-daemon.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/avahi-dbus.conf
%config(noreplace) %{_datadir}/dbus-1/system.d/avahi-dbus.conf
%{_sbindir}/avahi-daemon
%dir %{_datadir}/avahi
%{_datadir}/avahi/*.dtd
%dir %{_libdir}/avahi
%if %{WITH_PYTHON}
%{_libdir}/avahi/service-types.db
%endif
%{_mandir}/man5/*
%{_mandir}/man8/avahi-daemon.*
%{_unitdir}/avahi-daemon.service
@ -541,30 +676,66 @@ exit 0
%{_unitdir}/avahi-dnsconfd.service
%files tools
%{_bindir}/*
%{_mandir}/man1/*
%exclude %{_bindir}/b*
%exclude %{_bindir}/avahi-discover*
%exclude %{_bindir}/avahi-bookmarks
%exclude %{_mandir}/man1/b*
%exclude %{_mandir}/man1/avahi-discover*
%exclude %{_mandir}/man1/avahi-bookmarks*
%{_bindir}/avahi-browse
%{_bindir}/avahi-browse-domains
%{_bindir}/avahi-publish
%{_bindir}/avahi-publish-address
%{_bindir}/avahi-publish-service
%{_bindir}/avahi-resolve
%{_bindir}/avahi-resolve-address
%{_bindir}/avahi-resolve-host-name
%{_bindir}/avahi-set-host-name
%{_mandir}/man1/avahi-browse.1*
%{_mandir}/man1/avahi-browse-domains.1*
%{_mandir}/man1/avahi-publish.1*
%{_mandir}/man1/avahi-publish-address.1*
%{_mandir}/man1/avahi-publish-service.1*
%{_mandir}/man1/avahi-resolve.1*
%{_mandir}/man1/avahi-resolve-address.1*
%{_mandir}/man1/avahi-resolve-host-name.1*
%{_mandir}/man1/avahi-set-host-name.1*
%if %{without bootstrap}
%files ui-tools
%{_bindir}/bshell
%{_bindir}/bssh
%{_bindir}/bvnc
%{_bindir}/avahi-discover-standalone
%{_mandir}/man1/bshell.1*
%{_mandir}/man1/bssh.1*
%{_mandir}/man1/bvnc.1*
%{_datadir}/applications/b*.desktop
%{_datadir}/avahi/interfaces/
%if %{WITH_PYTHON}
# avahi-bookmarks is not really a UI tool, but I won't create a seperate package for it...
%{_bindir}/avahi-bookmarks
%{_mandir}/man1/avahi-discover*
%{_mandir}/man1/avahi-bookmarks*
%{_datadir}/applications/avahi-discover.desktop
%{python2_sitelib}/avahi_discover/
%endif
%endif
%files devel
%{_libdir}/libavahi-common.so
%{_libdir}/libavahi-core.so
%{_libdir}/libavahi-client.so
%{_libdir}/libavahi-libevent.so
%{_includedir}/avahi-client
%{_includedir}/avahi-common
%{_includedir}/avahi-core
%{_includedir}/avahi-libevent
%{_libdir}/pkgconfig/avahi-core.pc
%{_libdir}/pkgconfig/avahi-client.pc
%{_libdir}/pkgconfig/avahi-libevent.pc
%files libs
%doc README
%license LICENSE
%{_libdir}/libavahi-common.so.*
%{_libdir}/libavahi-client.so.*
%{_libdir}/libavahi-libevent.so.*
%files glib
%{_libdir}/libavahi-glib.so.*
@ -576,28 +747,38 @@ exit 0
%files gobject
%{_libdir}/libavahi-gobject.so.*
#%{_libdir}/girepository-1.0/Avahi-0.6.typelib
#%{_libdir}/girepository-1.0/AvahiCore-0.6.typelib
#%%{_libdir}/girepository-1.0/Avahi-0.6.typelib
#%%{_libdir}/girepository-1.0/AvahiCore-0.6.typelib
%files gobject-devel
%{_libdir}/libavahi-gobject.so
%{_includedir}/avahi-gobject
%{_libdir}/pkgconfig/avahi-gobject.pc
#%{_datadir}/gir-1.0/Avahi-0.6.gir
#%{_datadir}/gir-1.0/AvahiCore-0.6.gir
#%%{_datadir}/gir-1.0/Avahi-0.6.gir
#%%{_datadir}/gir-1.0/AvahiCore-0.6.gir
%if %{WITH_GTK2}
%files ui
%{_libdir}/libavahi-ui.so.*
%endif
%if %{WITH_GTK3}
%files ui-gtk3
%{_libdir}/libavahi-ui-gtk3.so.*
%endif
%if %{WITH_GTK2} || %{WITH_GTK3}
%files ui-devel
%{_libdir}/libavahi-ui.so
%{_libdir}/libavahi-ui-gtk3.so
%{_includedir}/avahi-ui
%if %{WITH_GTK2}
%{_libdir}/libavahi-ui.so
%{_libdir}/pkgconfig/avahi-ui.pc
%endif
%if %{WITH_GTK3}
%{_libdir}/libavahi-ui-gtk3.so
%{_libdir}/pkgconfig/avahi-ui-gtk3.pc
%endif
%endif
%if %{WITH_QT3}
%ldconfig_scriptlets qt3
@ -623,6 +804,18 @@ exit 0
%{_libdir}/pkgconfig/avahi-qt4.pc
%endif
%if %{WITH_QT5}
%ldconfig_scriptlets qt5
%files qt5
%{_libdir}/libavahi-qt5.so.*
%files qt5-devel
%{_libdir}/libavahi-qt5.so
%{_includedir}/avahi-qt5/
%{_libdir}/pkgconfig/avahi-qt5.pc
%endif
%if %{WITH_MONO}
%files sharp
%{_prefix}/lib/mono/avahi-sharp
@ -660,61 +853,158 @@ exit 0
%{_libdir}/pkgconfig/libdns_sd.pc
%endif
%if %{WITH_PYTHON}
%files -n python2-avahi
%{python2_sitelib}/avahi/
%files -n python3-avahi
# These are .py files only, so they don't go in lib64
%{python3_sitelib}/avahi/
%endif
%changelog
* Tue Aug 27 2024 Michal Sekletar <msekleta@redhat.com> - 0.7-27.1
- fix file attributes for /run/avahi-daemon (RHEL-5631)
- fix two memory leaks (RHEL-43458)
* Wed Jul 09 2025 Michal Sekletar <msekleta@redhat.com> - 0.9~rc2-2
- Fix for CVE-2024-52615 (RHEL-67715)
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-27
- Fix CVE-2021-3468 (RHEL-9542)
* Wed Feb 12 2025 Michal Sekletar <msekleta@redhat.com> - 0.9~rc2-1
- Rebase to 0.9-rc2 (RHEL-78770)
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-26
- Fix CVE-2023-38469 (RHEL-5635)
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 0.8-30
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-25
- Fix CVE-2023-38471 (RHEL-5639)
* Thu Aug 22 2024 Michal Sekletar <msekleta@redhat.com> - 0.8-29
- fix file attributes of /run/avahi-daemon (RHEL-55762)
- fix SAST issues (RHEL-40016)
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-24
- Fix CVE-2023-38473 (RHEL-5643)
* Thu Jun 27 2024 Tomas Popela <tpopela@redhat.com> - 0.8-28
- TigerVNC won't be shipped in RHEL 10, prefer GNOME Connections instead
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-23
- Fix CVE-2023-38472 (RHEL-5644)
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 0.8-27
- Bump release for June 2024 mass rebuild
* Thu Nov 09 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-22
- Fix CVE-2023-38470 (RHEL-5640)
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Aug 23 2023 Michal Sekletar <msekleta@redhat.com> - 0.7-21
- Fix CVE-2023-1981 (#2186688)
* Wed Jul 26 2023 Lukáš Zaoral <lzaoral@redhat.com> - 0.8-25
- migrate to SPDX license format
* Tue Nov 03 2020 Michal Sekletár <msekleta@redhat.com> - 0.7-20
- rebuild to include UI related subpackages to CodeReady Builder repo (#1879714)
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Oct 23 2018 Michal Sekletár <msekleta@redhat.com> - 0.7-19
- make sure we get compiled with -fstack-protector-strong (#1624099)
- fix issues reported by coverity (#1602449)
* Wed May 10 2023 Tomas Popela <tpopela@redhat.com> - 0.8-23
- Drop BR on dbus-glib as the project is not using it at all
* Fri Aug 03 2018 Petr Viktorin <pviktori@redhat.com> - 0.7-18
- Remove unused BuildRequires on pygtk2 (#1561019)
* Sun Mar 19 2023 Petr Menšík <pemensik@redhat.com> - 0.8-22
- Enable unit tests during check
- Prevent crashes on some invalid DBus calls
- Provide versioned howl compatibility package
- Correct bootstrap option
* Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 0.7-17
- Rebuild with fixed binutils
* Sun Mar 19 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 0.8-21
- Disable GTK2 in ELN/RHEL10 builds
* Mon Jul 30 2018 Petr Kubat <pkubat@redhat.com> - 0.7-16
- One more bump for gdbm
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 25 2018 Petr Kubat <pkubat@redhat.com> - 0.7-15
- Rebuilt for gdbm
* Fri Nov 11 2022 Petr Menšík <pemensik@redhat.com> - 0.8-19
- Add upstream PR links to patches
* Wed Jun 20 2018 Tomas Orsava <torsava@redhat.com> - 0.7-14
- Switch hardcoded python3 shebangs into the %%{__python3} macro
* Tue Nov 01 2022 Christian Krause <chkr@fedoraproject.org> - 0.8-18
- Install glade file for avahi-discover-standalone unconditionally
(fixes #2036073 and #2126721)
- Install desktop files for bssh and bvnc unconditionally
* Fri May 18 2018 Michal Sekletar <msekleta@redhat.com> - 0.7-13
- drop avahi-python2 and avahi-ui-tools due to lacking python2 support (#1561019)
* Fri Aug 05 2022 Kalev Lember <klember@redhat.com> - 0.8-17
- Avoid systemd_requires as per updated packaging guidelines
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Tue Aug 03 2021 Rex Dieter <rdieter@fedoraproject.org> - 0.8-14
- pull in upstream fix for CVE-2021-36217 (#1989381,#1989382)
- revert "Re-enable LTO" on f34 (still needed)
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon May 10 2021 Jeff Law <jlaw@tachyum.com> - 0.8-12
- Re-enable LTO
* Thu Apr 29 2021 Rex Dieter <rdieter@fedoraproject.org> - 0.8-11
- avahi libraries missing -fstack-protector-strong (#1817737)
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.8-10
- Rebuilt for updated systemd-rpm-macros
See https://pagure.io/fesco/issue/2583.
* Tue Feb 16 2021 Rex Dieter <rdieter@fedoraproject.org> - 0.8-9
- cleanup/fix conditionals (#1751484)
- disable lto, workaround FTBFS (#1907727)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Nov 17 2020 Rex Dieter <rdieter@fedoraproject.org> - 0.8-7
- fix undefined symbols in libavahi-qt3 (#1897925)
* Thu Oct 15 2020 Rex Dieter <rdieter@fedoraproject.org> - 0.8-6
- resurrect ui-tools, not just for python (#1885513)
* Mon Sep 21 2020 Michal Sekletar <msekleta@redhat.com> - 0.8-5
- Disable bootstrap
* Mon Sep 07 2020 Ondřej Lysoněk <olysonek@redhat.com> - 0.8-4
- Rebuilt due to libevent rebase
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sun Mar 22 2020 Rex Dieter <rdieter@fedoraproject.org> - 0.8-2
- pull in some upstream fixes
* Sun Mar 22 2020 Lubomir Rintel <lkundrak@v3.sk> - 0.8-1
- Update to version 0.8
* Thu Feb 20 2020 Petr Viktorin <pviktori@redhat.com> - 0.7-24
- Don't BuildRequire pygtk2 if building without Python
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Sep 19 2019 Rex Dieter <rdieter@fedoraproject.org> - 0.7-22
- drop python bindings/support (includes -ui-tools that use the bindings) on f31+ (#1751484)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.7-21
- Rebuilt for Python 3.8
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 22 2019 Michal Sekletár <msekleta@redhat.com> - 0.7-19
- add support for advertising services on the local machine only (i.e. on loopback)
* Mon Feb 04 2019 Kalev Lember <klember@redhat.com> - 0.7-18
- Update requires for pygobject3 -> python2-gobject rename
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jul 30 2018 Adam Williamson <awilliam@redhat.com> - 0.7-16
- Update python3 sed hack to avoid '/usr/bin/python32' dep
* Tue Jul 24 2018 Jan Grulich <jgrulich@redhat.com> - 0.7-15
- Requires: tigervnc
Tigervnc removed old obsoleted provides
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.7-13
- Rebuilt for Python 3.7
* Thu Apr 05 2018 Rex Dieter <rdieter@fedoraproject.org> - 0.7-12
- use %%make_build %%ldconfig_scriptlets %%license

1
ci.fmf Normal file
View File

@ -0,0 +1 @@
resultsdb-testcase: separate

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal.functional}

10
plans.fmf Normal file
View File

@ -0,0 +1,10 @@
/tier1-internal:
discover:
how: fmf
url: https://gitlab.com/redhat/rhel/tests/avahi.git
filter: 'tier: 1'
execute:
how: tmt
adjust:
enabled: false
when: distro == centos-stream or distro == fedora

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (v0.9-rc2.tar.gz) = 29d6c9d075d0202b9da2cdf935fa04fad31ba95475ba5de086c9958d25caa405925bbd82ed439a024febf7880325e80c1a032a660284a7708c71dae9076f413b