X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-daemon%2Fsimple-protocol.c;h=04b07c77fbff083a45183ac7b11fd5348d26dea2;hb=758381efbaa40d604253259cd43f194db1162859;hp=2d806dfc9f1841961e5fb24673dd31c9687e65c7;hpb=fd25072a95549aff47d5abafd712fb14de55e172;p=catta diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c index 2d806df..04b07c7 100644 --- a/avahi-daemon/simple-protocol.c +++ b/avahi-daemon/simple-protocol.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,17 @@ #include "simple-protocol.h" #include "main.h" +#ifdef ENABLE_CHROOT +#include "chroot.h" +#endif + +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif +#ifndef PF_LOCAL +#define PF_LOCAL PF_UNIX +#endif + #define BUFFER_SIZE (20*1024) #define CLIENTS_MAX 50 @@ -320,7 +332,7 @@ static void handle_line(Client *c, const char *s) { goto fail; client_output_printf(c, "+ Browsing ...\n"); - avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg); + avahi_log_debug(__FILE__": Got %s request.", cmd); } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV6") == 0 && n_args == 1) { c->state = CLIENT_BROWSE_DNS_SERVERS; @@ -328,7 +340,7 @@ static void handle_line(Client *c, const char *s) { goto fail; client_output_printf(c, "+ Browsing ...\n"); - avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg); + avahi_log_debug(__FILE__": Got %s request.", cmd); } else if (strcmp(cmd, "BROWSE-DNS-SERVERS") == 0 && n_args == 1) { c->state = CLIENT_BROWSE_DNS_SERVERS; @@ -336,7 +348,7 @@ static void handle_line(Client *c, const char *s) { goto fail; client_output_printf(c, "+ Browsing ...\n"); - avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg); + avahi_log_debug(__FILE__": Got %s request.", cmd); } else { client_output_printf(c, "%+i Invalid command \"%s\", try \"HELP\".\n", AVAHI_ERR_INVALID_OPERATION, cmd); @@ -466,7 +478,7 @@ int simple_protocol_setup(const AvahiPoll *poll_api) { unlink(AVAHI_SOCKET); - if (bind(server->fd, &sa, sizeof(sa)) < 0) { + if (bind(server->fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) { avahi_log_warn("bind(): %s", strerror(errno)); goto fail; } @@ -497,7 +509,11 @@ void simple_protocol_shutdown(void) { if (server) { if (server->bind_successful) +#ifdef ENABLE_CHROOT + avahi_chroot_helper_unlink(AVAHI_SOCKET); +#else unlink(AVAHI_SOCKET); +#endif while (server->clients) client_free(server->clients);