rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / network / avahi / patches / 07-daemon.patch
blob171019c5b987515f8c9b20b6c860bdaeb45cd155
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
3 @@ -73,7 +73,9 @@
5 #include "setproctitle.h"
6 #include "main.h"
7 +#ifndef HAVE_BONJOUR
8 #include "simple-protocol.h"
9 +#endif
10 #include "static-services.h"
11 #include "static-hosts.h"
12 #include "ini-file-parser.h"
13 @@ -134,11 +136,13 @@
14 #define RESOLV_CONF "/etc/resolv.conf"
15 #define BROWSE_DOMAINS_MAX 16
17 +#ifndef HAVE_BONJOUR
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;
23 +#endif
25 static DaemonConfig config;
27 @@ -150,6 +154,7 @@
28 return strlen(s) >= l && strncmp(s, prefix, l) == 0;
31 +#ifndef HAVE_BONJOUR
32 static int load_resolv_conf(void) {
33 int ret = -1;
34 FILE *f;
35 @@ -334,6 +339,7 @@
36 avahi_server_set_browse_domains(avahi_server, l);
37 avahi_string_list_free(l);
39 +#endif
41 static void server_callback(AvahiServer *s, AvahiServerState state, void *userdata) {
42 DaemonConfig *c = userdata;
43 @@ -359,7 +365,7 @@
45 static_service_add_to_server();
46 static_hosts_add_to_server();
48 +#ifndef HAVE_BONJOUR
49 remove_dns_server_entry_groups();
51 if (c->publish_resolv_conf && resolv_conf_name_servers && resolv_conf_name_servers[0])
52 @@ -369,6 +375,7 @@
53 dns_servers_entry_group = add_dns_servers(s, dns_servers_entry_group, c->publish_dns_servers);
55 simple_protocol_restart_queries();
56 +#endif
57 break;
59 case AVAHI_SERVER_COLLISION: {
60 @@ -376,7 +383,9 @@
62 static_service_remove_from_server();
63 static_hosts_remove_from_server();
64 +#ifndef HAVE_BONJOUR
65 remove_dns_server_entry_groups();
66 +#endif
68 n = avahi_alternative_host_name(avahi_server_get_host_name(s));
70 @@ -405,7 +414,9 @@
72 static_service_remove_from_server();
73 static_hosts_remove_from_server();
74 +#ifndef HAVE_BONJOUR
75 remove_dns_server_entry_groups();
76 +#endif
78 break;
80 @@ -425,9 +436,11 @@
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"
84 +#ifndef HAVE_BONJOUR
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"
88 +#endif
89 " --no-drop-root Don't drop privileges\n"
90 #ifdef ENABLE_CHROOT
91 " --no-chroot Don't chroot()\n"
92 @@ -456,11 +469,15 @@
93 { "daemonize", no_argument, NULL, 'D' },
94 { "kill", no_argument, NULL, 'k' },
95 { "version", no_argument, NULL, 'V' },
96 +#ifndef HAVE_BONJOUR
97 { "file", required_argument, NULL, 'f' },
98 +#endif
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 },
104 +#endif
105 { "no-drop-root", no_argument, NULL, OPTION_NO_DROP_ROOT },
106 #ifdef ENABLE_CHROOT
107 { "no-chroot", no_argument, NULL, OPTION_NO_CHROOT },
108 @@ -472,7 +489,11 @@
110 assert(c);
112 +#ifdef HAVE_BONJOUR
113 + while ((o = getopt_long(argc, argv, "hDkVrcs", long_options, NULL)) >= 0) {
114 +#else
115 while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
116 +#endif
118 switch(o) {
119 case 's':
120 @@ -490,6 +511,7 @@
121 case 'V':
122 c->command = DAEMON_VERSION;
123 break;
124 +#ifndef HAVE_BONJOUR
125 case 'f':
126 avahi_free(c->config_file);
127 c->config_file = avahi_strdup(optarg);
128 @@ -497,12 +519,15 @@
129 case 'r':
130 c->command = DAEMON_RELOAD;
131 break;
132 +#endif
133 case 'c':
134 c->command = DAEMON_CHECK;
135 break;
136 +#ifndef HAVE_BONJOUR
137 case OPTION_NO_RLIMITS:
138 c->set_rlimits = 0;
139 break;
140 +#endif
141 case OPTION_NO_DROP_ROOT:
142 c->drop_root = 0;
143 break;
144 @@ -576,6 +601,7 @@
145 return 0;
148 +#ifndef HAVE_BONJOUR
149 static int load_config_file(DaemonConfig *c) {
150 int r = -1;
151 AvahiIniFile *f;
152 @@ -845,6 +871,7 @@
154 return r;
156 +#endif
158 static void log_function(AvahiLogLevel level, const char *txt) {
160 @@ -965,6 +992,7 @@
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);
168 @@ -975,6 +1003,7 @@
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);
172 +#endif
175 #ifdef HAVE_INOTIFY
176 @@ -1062,8 +1091,12 @@
177 break;
179 case SIGUSR1:
180 +#ifdef HAVE_BONJOUR
181 + avahi_log_info("Got SIGUSR1, ignoring recor.");
182 +#else
183 avahi_log_info("Got SIGUSR1, dumping record data.");
184 avahi_server_dump(avahi_server, dump, NULL);
185 +#endif
186 break;
188 default:
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!");
196 +#endif
198 if (!(simple_poll_api = avahi_simple_poll_new())) {
199 avahi_log_error("Failed to create main loop object.");
200 @@ -1123,8 +1158,10 @@
201 goto finish;
204 +#ifndef HAVE_BONJOUR
205 if (simple_protocol_setup(poll_api) < 0)
206 goto finish;
207 +#endif
209 #ifdef HAVE_DBUS
210 if (c->enable_dbus) {
211 @@ -1193,7 +1230,9 @@
213 #endif
215 +#ifndef HAVE_BONJOUR
216 load_resolv_conf();
217 +#endif
218 #ifdef ENABLE_CHROOT
219 static_service_load(config.use_chroot);
220 static_hosts_load(config.use_chroot);
221 @@ -1207,8 +1246,10 @@
222 goto finish;
225 +#ifndef HAVE_BONJOUR
226 update_wide_area_servers();
227 update_browse_domains();
228 +#endif
230 if (c->daemonize) {
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();
241 +#endif
243 #ifdef HAVE_DBUS
244 if (c->enable_dbus)
245 @@ -1555,8 +1598,10 @@
246 goto finish;
249 +#ifndef HAVE_BONJOUR
250 if (load_config_file(&config) < 0)
251 goto finish;
252 +#endif
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);
260 +#ifdef HAVE_BONJOUR
261 + assert(config.publish_dns_servers == NULL);
262 +#else
263 avahi_strfreev(config.publish_dns_servers);
264 avahi_strfreev(resolv_conf_name_servers);
265 avahi_strfreev(resolv_conf_search_domains);
266 +#endif
268 if (wrote_pid_file) {
269 #ifdef ENABLE_CHROOT
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
272 @@ -711,7 +711,11 @@
273 break;
274 #endif
275 default:
276 +#ifdef HAVE_BONJOUR
277 + avahi_log_info("Failed to read "AVAHI_SERVICE_DIR".");
278 +#else
279 avahi_log_error("Failed to read "AVAHI_SERVICE_DIR".");
280 +#endif
281 break;