X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-daemon%2Fdbus-protocol.c;h=c6c4a676c50c2041ecf05cbbe33d197b13af88ca;hb=f2747e8c9adc1e3ca04630d35c9825ec715078e9;hp=fc5d0b085e582a75296f19add6d35c3b219c824e;hpb=05dc243bdf89aae26c72434ddd7c27ab9143fec1;p=catta diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c index fc5d0b0..c6c4a67 100644 --- a/avahi-daemon/dbus-protocol.c +++ b/avahi-daemon/dbus-protocol.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,8 @@ Server *server = NULL; +static int disable_user_service_publishing = 0; + static void client_free(Client *c) { assert(server); @@ -385,6 +388,9 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH goto fail; } + if (disable_user_service_publishing) + return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_PERMITTED, NULL); + if (!(client = client_get(dbus_message_get_sender(m), TRUE))) { avahi_log_warn("Too many clients, client request failed."); return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL); @@ -916,7 +922,7 @@ void dbus_protocol_server_state_changed(AvahiServerState state) { dbus_message_unref(m); } -int dbus_protocol_setup(const AvahiPoll *poll_api) { +int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_publishing) { DBusError error; static const DBusObjectPathVTable server_vtable = { @@ -930,6 +936,8 @@ int dbus_protocol_setup(const AvahiPoll *poll_api) { dbus_error_init(&error); + disable_user_service_publishing = _disable_user_service_publishing; + server = avahi_new(Server, 1); AVAHI_LLIST_HEAD_INIT(Clients, server->clients); server->current_id = 0;