1 --- /usr/tmp/clean/avahi-0.6.28/avahi-daemon/main.c 2010-08-26 01:51:39.000153000 +0100
2 +++ avahi-0.6.28/avahi-daemon/main.c 2011-01-20 14:40:47.924814317 +0000
5 #include "setproctitle.h"
8 #include "simple-protocol.h"
10 #include "static-services.h"
11 #include "static-hosts.h"
12 #include "ini-file-parser.h"
14 #define RESOLV_CONF "/etc/resolv.conf"
15 #define BROWSE_DOMAINS_MAX 16
18 static AvahiSEntryGroup *dns_servers_entry_group = NULL;
19 static AvahiSEntryGroup *resolv_conf_entry_group = NULL;
21 static char **resolv_conf_name_servers = NULL;
22 static char **resolv_conf_search_domains = NULL;
25 static DaemonConfig config;
28 return strlen(s) >= l && strncmp(s, prefix, l) == 0;
32 static int load_resolv_conf(void) {
36 avahi_server_set_browse_domains(avahi_server, l);
37 avahi_string_list_free(l);
41 static void server_callback(AvahiServer *s, AvahiServerState state, void *userdata) {
42 DaemonConfig *c = userdata;
45 static_service_add_to_server();
46 static_hosts_add_to_server();
49 remove_dns_server_entry_groups();
51 if (c->publish_resolv_conf && resolv_conf_name_servers && resolv_conf_name_servers[0])
53 dns_servers_entry_group = add_dns_servers(s, dns_servers_entry_group, c->publish_dns_servers);
55 simple_protocol_restart_queries();
59 case AVAHI_SERVER_COLLISION: {
62 static_service_remove_from_server();
63 static_hosts_remove_from_server();
65 remove_dns_server_entry_groups();
68 n = avahi_alternative_host_name(avahi_server_get_host_name(s));
72 static_service_remove_from_server();
73 static_hosts_remove_from_server();
75 remove_dns_server_entry_groups();
81 " -r --reload Request a running daemon to reload static services\n"
82 " -c --check Return 0 if a daemon is already running\n"
83 " -V --version Show version\n"
85 " -f --file=FILE Load the specified configuration file instead of\n"
86 " "AVAHI_CONFIG_FILE"\n"
87 " --no-rlimits Don't enforce resource limits\n"
89 " --no-drop-root Don't drop privileges\n"
91 " --no-chroot Don't chroot()\n"
93 { "daemonize", no_argument, NULL, 'D' },
94 { "kill", no_argument, NULL, 'k' },
95 { "version", no_argument, NULL, 'V' },
97 { "file", required_argument, NULL, 'f' },
99 { "reload", no_argument, NULL, 'r' },
100 { "check", no_argument, NULL, 'c' },
101 { "syslog", no_argument, NULL, 's' },
102 +#ifndef HAVE_BONJOUR
103 { "no-rlimits", no_argument, NULL, OPTION_NO_RLIMITS },
105 { "no-drop-root", no_argument, NULL, OPTION_NO_DROP_ROOT },
107 { "no-chroot", no_argument, NULL, OPTION_NO_CHROOT },
113 + while ((o = getopt_long(argc, argv, "hDkVrcs", long_options, NULL)) >= 0) {
115 while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
122 c->command = DAEMON_VERSION;
124 +#ifndef HAVE_BONJOUR
126 avahi_free(c->config_file);
127 c->config_file = avahi_strdup(optarg);
128 @@ -497,12 +519,15 @@
130 c->command = DAEMON_RELOAD;
134 c->command = DAEMON_CHECK;
136 +#ifndef HAVE_BONJOUR
137 case OPTION_NO_RLIMITS:
141 case OPTION_NO_DROP_ROOT:
148 +#ifndef HAVE_BONJOUR
149 static int load_config_file(DaemonConfig *c) {
158 static void log_function(AvahiLogLevel level, const char *txt) {
161 static_service_add_to_server();
162 static_hosts_add_to_server();
164 +#ifndef HAVE_BONJOUR
165 if (resolv_conf_entry_group)
166 avahi_s_entry_group_reset(resolv_conf_entry_group);
170 if (config.publish_resolv_conf && resolv_conf_name_servers && resolv_conf_name_servers[0])
171 resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf_name_servers);
176 @@ -1062,8 +1091,12 @@
181 + avahi_log_info("Got SIGUSR1, ignoring recor.");
183 avahi_log_info("Got SIGUSR1, dumping record data.");
184 avahi_server_dump(avahi_server, dump, NULL);
189 @@ -1103,8 +1136,10 @@
191 ignore_signal(SIGPIPE);
193 +#ifndef HAVE_BONJOUR
194 if (!(nss_support = avahi_nss_support()))
195 avahi_log_warn("WARNING: No NSS support for mDNS detected, consider installing nss-mdns!");
198 if (!(simple_poll_api = avahi_simple_poll_new())) {
199 avahi_log_error("Failed to create main loop object.");
200 @@ -1123,8 +1158,10 @@
204 +#ifndef HAVE_BONJOUR
205 if (simple_protocol_setup(poll_api) < 0)
210 if (c->enable_dbus) {
211 @@ -1193,7 +1230,9 @@
215 +#ifndef HAVE_BONJOUR
219 static_service_load(config.use_chroot);
220 static_hosts_load(config.use_chroot);
221 @@ -1207,8 +1246,10 @@
225 +#ifndef HAVE_BONJOUR
226 update_wide_area_servers();
227 update_browse_domains();
231 daemon_retval_send(0);
232 @@ -1238,10 +1279,12 @@
234 static_hosts_remove_from_server();
235 static_hosts_free_all();
236 +#ifndef HAVE_BONJOUR
238 remove_dns_server_entry_groups();
240 simple_protocol_shutdown();
245 @@ -1555,8 +1598,10 @@
249 +#ifndef HAVE_BONJOUR
250 if (load_config_file(&config) < 0)
254 if (config.daemonize) {
255 daemon_retval_init();
256 @@ -1648,9 +1693,13 @@
258 avahi_server_config_free(&config.server_config);
259 avahi_free(config.config_file);
261 + assert(config.publish_dns_servers == NULL);
263 avahi_strfreev(config.publish_dns_servers);
264 avahi_strfreev(resolv_conf_name_servers);
265 avahi_strfreev(resolv_conf_search_domains);
268 if (wrote_pid_file) {
270 --- avahi-0.6.30/avahi-daemon/static-services.c.orig 2011-08-22 13:40:56.137423950 +0100
271 +++ avahi-0.6.30/avahi-daemon/static-services.c 2011-08-22 14:02:55.507416810 +0100
277 + avahi_log_info("Failed to read "AVAHI_SERVICE_DIR".");
279 avahi_log_error("Failed to read "AVAHI_SERVICE_DIR".");