summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-28 22:32:07 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-28 22:32:07 +0200
commit1d74250dcd65768655d643010d4b884596d3fcc0 (patch)
treed295b07cec3a1b253817fcbbe241988c00e1d3a1
parent943d25b398d5fe1b1984721d99266b813c97c886 (diff)
core: properly unescape host name before using it in the workstation service
-rw-r--r--avahi-core/iface.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/avahi-core/iface.c b/avahi-core/iface.c
index 095580c..38dfde1 100644
--- a/avahi-core/iface.c
+++ b/avahi-core/iface.c
@@ -132,10 +132,12 @@ void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) {
return; /* OOM */
if (avahi_s_entry_group_is_empty(hw->entry_group)) {
- char name[AVAHI_LABEL_MAX], mac[256];
+ char name[AVAHI_LABEL_MAX], unescaped[AVAHI_LABEL_MAX], mac[256];
+ const char *p = m->server->host_name;
+ avahi_unescape_label(&p, unescaped, sizeof(unescaped));
avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size);
- snprintf(name, sizeof(name), "%s [%s]", m->server->host_name, mac);
+ snprintf(name, sizeof(name), "%s [%s]", unescaped, mac);
if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, 0, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) {
avahi_log_warn(__FILE__": avahi_server_add_service() failed: %s", avahi_strerror(m->server->error));