]> git.meshlink.io Git - catta/commitdiff
static-services: unescape host name when using it in static service names
authorLennart Poettering <lennart@poettering.net>
Mon, 28 Jun 2010 18:39:05 +0000 (20:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 28 Jun 2010 18:40:02 +0000 (20:40 +0200)
avahi-daemon/static-services.c

index 588ff8ad602c59f9d4f491aaef79fcb53756079a..4c3491f025fdf7b9436328f632ca48753144e22d 100644 (file)
@@ -42,6 +42,7 @@
 #include <avahi-common/malloc.h>
 #include <avahi-common/alternative.h>
 #include <avahi-common/error.h>
+#include <avahi-common/domain.h>
 #include <avahi-core/log.h>
 #include <avahi-core/publish.h>
 
@@ -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);
 
     }