From 82244abd57cf04d554b3ab0fa92642d73d80b5c1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 Nov 2005 23:37:05 +0000 Subject: [PATCH] * Do not allow adding RRs to entry groups that are already commited * Reword some misleading log messages git-svn-id: file:///home/lennart/svn/public/avahi/trunk@939 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-core/entry.c | 2 ++ avahi-core/iface.c | 10 +++++----- avahi-core/server.c | 2 +- avahi-daemon/main.c | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/avahi-core/entry.c b/avahi-core/entry.c index f65f7b1..d294647 100644 --- a/avahi-core/entry.c +++ b/avahi-core/entry.c @@ -187,6 +187,7 @@ static AvahiEntry * server_add_internal( assert(s); assert(r); + AVAHI_CHECK_VALIDITY_RETURN_NULL(s, s->state != AVAHI_SERVER_FAILURE && s->state != AVAHI_SERVER_INVALID, AVAHI_ERR_BAD_STATE); AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE); AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL); AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_FLAGS_VALID( @@ -215,6 +216,7 @@ static AvahiEntry * server_add_internal( transport_flags_from_domain(s, &flags, r->key->name); AVAHI_CHECK_VALIDITY_RETURN_NULL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED); AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !s->config.disable_publishing, AVAHI_ERR_NOT_PERMITTED); + AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !g || (g->state != AVAHI_ENTRY_GROUP_ESTABLISHED && g->state != AVAHI_ENTRY_GROUP_REGISTERING), AVAHI_ERR_BAD_STATE); if (flags & AVAHI_PUBLISH_UPDATE) { AvahiRecord *old_record; diff --git a/avahi-core/iface.c b/avahi-core/iface.c index d117b9b..0e3ef68 100644 --- a/avahi-core/iface.c +++ b/avahi-core/iface.c @@ -69,7 +69,7 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs char t[AVAHI_ADDRESS_STR_MAX]; avahi_address_snprint(t, sizeof(t), &a->address); - avahi_log_info("Registering new address %s on %s.", t, a->interface->hardware->name); + avahi_log_info("Registering new address record for %s on %s.", t, a->interface->hardware->name); if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, a->interface->protocol, 0, NULL, &a->address) < 0) { avahi_log_warn(__FILE__": avahi_server_add_address() failed: %s", avahi_strerror(m->server->error)); @@ -92,7 +92,7 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs m->server->state == AVAHI_SERVER_REGISTERING) avahi_server_decrease_host_rr_pending(m->server); - avahi_log_info("Withdrawing address %s on %s.", t, a->interface->hardware->name); + avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name); avahi_s_entry_group_reset(a->entry_group); } @@ -200,7 +200,7 @@ static int interface_mdns_mcast_join(AvahiInterface *i, int join) { i->local_mcast_address = a->address; } - avahi_log_info("%s mDNS multicast group on interface %s.%s with address %s", + avahi_log_info("%s mDNS multicast group on interface %s.%s with address %s.", join ? "Joining" : "Leaving", i->hardware->name, avahi_proto_to_string(i->protocol), @@ -431,7 +431,7 @@ void avahi_interface_check_relevant(AvahiInterface *i) { b = avahi_interface_is_relevant(i); if (m->list_complete && b && !i->announcing) { - avahi_log_info("New relevant interface %s.%s.", i->hardware->name, avahi_proto_to_string(i->protocol)); + avahi_log_info("New relevant interface %s.%s for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol)); interface_mdns_mcast_join(i, 1); @@ -439,7 +439,7 @@ void avahi_interface_check_relevant(AvahiInterface *i) { avahi_announce_interface(m->server, i); avahi_multicast_lookup_engine_new_interface(m->server->multicast_lookup_engine, i); } else if (!b && i->announcing) { - avahi_log_info("Interface %s.%s no longer relevant.", i->hardware->name, avahi_proto_to_string(i->protocol)); + avahi_log_info("Interface %s.%s no longer relevant for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol)); interface_mdns_mcast_join(i, 0); diff --git a/avahi-core/server.c b/avahi-core/server.c index e42692f..eb04ec1 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -1141,7 +1141,7 @@ static void register_hinfo(AvahiServer *s) { r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine)); r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname)); - avahi_log_info("Adding HINFO record with values '%s/%s'", r->data.hinfo.cpu, r->data.hinfo.os); + avahi_log_info("Registering HINFO record with values '%s'/'%s'.", r->data.hinfo.cpu, r->data.hinfo.os); if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) { avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error)); diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 44300ff..efb167e 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -747,14 +747,14 @@ static int run_server(DaemonConfig *c) { goto finish; } + avahi_log_info("Successfully called chroot()."); chdir("/"); if (avahi_caps_drop_all() < 0) { avahi_log_error("Failed to drop capabilities."); goto finish; } - - avahi_log_info("chroot() successful."); + avahi_log_info("Successfully dropped remaining capabilities."); } #endif -- 2.39.5