From f529a1851a257d9586310f8c8190b2dcd69087a0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 28 Jun 2010 20:39:05 +0200 Subject: [PATCH] static-services: unescape host name when using it in static service names --- avahi-daemon/static-services.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c index 588ff8a..4c3491f 100644 --- a/avahi-daemon/static-services.c +++ b/avahi-daemon/static-services.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -231,9 +232,15 @@ static void add_static_service_group_to_server(StaticServiceGroup *g) { avahi_free(g->chosen_name); - if (g->replace_wildcards) - g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server)); - else + if (g->replace_wildcards) { + char label[AVAHI_LABEL_MAX]; + const char *p; + + p = avahi_server_get_host_name(avahi_server); + avahi_unescape_label(&p, label, sizeof(label)); + + g->chosen_name = replacestr(g->name, "%h", label); + } else g->chosen_name = avahi_strdup(g->name); } -- 2.39.5