summaryrefslogtreecommitdiff
path: root/net/mDNSResponder-nss/patches/patch-aa
blob: 4af51bea2646ed133ab7b938110bfb3e7c1e3622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
$NetBSD: patch-aa,v 1.1.1.1 2006/07/10 17:35:30 drochner Exp $

--- mDNSPosix/nss_mdns.c.orig	2006-07-10 13:43:18.000000000 +0200
+++ mDNSPosix/nss_mdns.c
@@ -96,7 +96,7 @@ b. in the case of services:
 /*
 	Count the number of dots in a name string.
  */
-int
+static int
 count_dots (const char * name);
 
 
@@ -107,7 +107,7 @@ count_dots (const char * name);
 		1 if name ends with ".local" or ".local."
 		0 otherwise
  */
-int
+static int
 islocal (const char * name);
 
 
@@ -126,7 +126,7 @@ islocal (const char * name);
 		Pointer to (first character of) output buffer,
 		or NULL on error.
  */
-char *
+static char *
 format_reverse_addr (int af, const void * addr, int prefixlen, char * buf);
 
 
@@ -145,7 +145,7 @@ format_reverse_addr (int af, const void 
 		Pointer to (first character of) output buffer,
 		or NULL on error.
  */
-char *
+static char *
 format_reverse_addr_in (
 	const struct in_addr * addr,
 	int prefixlen,
@@ -168,7 +168,7 @@ format_reverse_addr_in (
 		Pointer to (first character of) output buffer,
 		or NULL on error.
  */
-char *
+static char *
 format_reverse_addr_in6 (
 	const struct in6_addr * addr,
 	int prefixlen,
@@ -189,7 +189,7 @@ format_reverse_addr_in6 (
 		0 on failure (no match)
 		< 0 on error
  */
-int
+static int
 cmp_dns_suffix (const char * name, const char * domain);
 enum
 {
@@ -213,7 +213,7 @@ typedef int ns_class_t;
 		Appropriate AF code (from socket.h), or AF_UNSPEC if an appropriate
 		mapping couldn't be determined
  */
-int
+static int
 rr_to_af (ns_type_t rrtype);
 
 
@@ -227,7 +227,7 @@ rr_to_af (ns_type_t rrtype);
 		Appropriate RR code (from nameser.h), or ns_t_invalid if an appropriate
 		mapping couldn't be determined
  */
-ns_type_t
+static ns_type_t
 af_to_rr (int af);
 
 
@@ -237,7 +237,7 @@ af_to_rr (int af);
 	Returns
 		Matching AF code, or AF_UNSPEC if no match found.
  */
-int
+static int
 str_to_af (const char * str);
 
 
@@ -247,7 +247,7 @@ str_to_af (const char * str);
 	Returns
 		Matching ns_class_t, or ns_c_invalid if no match found.
  */
-ns_class_t
+static ns_class_t
 str_to_ns_class (const char * str);
 
 
@@ -257,7 +257,7 @@ str_to_ns_class (const char * str);
 	Returns
 		Matching ns_type_t, or ns_t_invalid if no match found.
  */
-ns_type_t
+static ns_type_t
 str_to_ns_type (const char * str);
 
 
@@ -268,7 +268,7 @@ str_to_ns_type (const char * str);
 		String representation of AF,
 		or NULL if address family unrecognised or invalid.
  */
-const char *
+static const char *
 af_to_str (int in);
 
 
@@ -279,7 +279,7 @@ af_to_str (int in);
 		String representation of ns_class_t,
 		or NULL if ns_class_t unrecognised or invalid.
  */
-const char *
+static const char *
 ns_class_to_str (ns_class_t in);
 
 
@@ -290,7 +290,7 @@ ns_class_to_str (ns_class_t in);
 		String representation of ns_type_t,
 		or NULL if ns_type_t unrecognised or invalid.
  */
-const char *
+static const char *
 ns_type_to_str (ns_type_t in);
 
 
@@ -320,7 +320,7 @@ ns_type_to_str (ns_type_t in);
 		< 0 on error.
 		A return of 0 implies the empty domain.
  */
-int
+static int
 dns_rdata_to_name (const char * rdata, int rdlen, char * name, int name_len);
 enum
 {
@@ -359,7 +359,7 @@ typedef int errcode_t;
 		 0 failure
 		-1 error, check errno
  */
-int
+static int
 config_is_mdns_suffix (const char * name);
 
 
@@ -373,13 +373,17 @@ config_is_mdns_suffix (const char * name
 		0 configuration ready
 		non-zero configuration error code
  */
-errcode_t
-init_config ();
+static errcode_t
+init_config (void);
 
 #define ENTNAME  hostent
 #define DATABASE "hosts"
 
+#ifdef __NetBSD__
+#include "netbsd.h"
+#else
 #include <nss.h>
+#endif
 	// For nss_status
 #include <netdb.h>
 	// For hostent
@@ -600,7 +604,7 @@ mdns_lookup_callback_t
 	void				*context
 );
 
-mdns_lookup_callback_t mdns_lookup_callback;
+static mdns_lookup_callback_t mdns_lookup_callback;
 
 
 static int
@@ -1070,7 +1074,7 @@ handle_events (DNSServiceRef sdref, resu
 	Examine incoming data and add to relevant fields in result structure.
 	This routine is called from DNSServiceProcessResult where appropriate.
  */
-void
+static void
 mdns_lookup_callback
 (
 	DNSServiceRef		sdref,
@@ -1700,14 +1704,14 @@ is_applicable_addr (
 //----------
 // Types and Constants
 
-const char * k_conf_file = "/etc/nss_mdns.conf";
+static const char * k_conf_file = "/etc/nss_mdns.conf";
 #define CONF_LINE_SIZE 1024
 
-const char k_comment_char = '#';
+static const char k_comment_char = '#';
 
-const char * k_keyword_domain = "domain";
+static const char * k_keyword_domain = "domain";
 
-const char * k_default_domains [] =
+static const char * k_default_domains [] =
 	{
 		"local",
 		"254.169.in-addr.arpa",
@@ -1731,7 +1735,7 @@ typedef struct
 	domain_entry_t * domains;
 } config_t;
 
-const config_t k_empty_config =
+static const config_t k_empty_config =
 	{
 		NULL
 	};
@@ -1780,7 +1784,7 @@ contains_domain_suffix (const config_t *
 static config_t * g_config = NULL;
 	// Configuration info
 
-pthread_mutex_t g_config_mutex =
+static pthread_mutex_t g_config_mutex =
 #ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
 	PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
 #else
@@ -1799,7 +1803,7 @@ pthread_mutex_t g_config_mutex =
 		0 success
 		non-zero error code on failure
  */
-errcode_t
+static errcode_t
 init_config ()
 {
 	if (g_config)
@@ -1872,7 +1876,7 @@ init_config ()
 }
 
 
-int
+static int
 config_is_mdns_suffix (const char * name)
 {
 	int errcode = init_config ();
@@ -2025,7 +2029,7 @@ get_next_word (char * input, char **next
 	char * curr = input;
 	char * result;
 	
-	while (isspace (*curr))
+	while (isspace ((unsigned)*curr))
 	{
 		curr ++;
 	}
@@ -2036,7 +2040,7 @@ get_next_word (char * input, char **next
 	}
 	
 	result = curr;
-	while (*curr && ! isspace (*curr))
+	while (*curr && ! isspace ((unsigned)*curr))
 	{
 		curr++;
 	}
@@ -2254,7 +2258,7 @@ table_index_value (const table_entry_t t
 //----------
 // Util functions
 
-int
+static int
 count_dots (const char * name)
 {
 	int count = 0;
@@ -2269,14 +2273,14 @@ count_dots (const char * name)
 }
 
 
-int
+static int
 islocal (const char * name)
 {
 	return cmp_dns_suffix (name, k_local_suffix) > 0;
 }
 
 
-int
+static int
 rr_to_af (ns_type_t rrtype)
 {
 	switch (rrtype)
@@ -2293,7 +2297,7 @@ rr_to_af (ns_type_t rrtype)
 }
 
 
-ns_type_t
+static ns_type_t
 af_to_rr (int af)
 {
 	switch (af)
@@ -2311,7 +2315,7 @@ af_to_rr (int af)
 }
 
 
-int
+static int
 str_to_af (const char * str)
 {
 	int result =
@@ -2323,7 +2327,7 @@ str_to_af (const char * str)
 }
 
 
-ns_class_t
+static ns_class_t
 str_to_ns_class (const char * str)
 {
 	return (ns_class_t)
@@ -2331,7 +2335,7 @@ str_to_ns_class (const char * str)
 }
 
 
-ns_type_t
+static ns_type_t
 str_to_ns_type (const char * str)
 {
 	return (ns_type_t)
@@ -2339,7 +2343,7 @@ str_to_ns_type (const char * str)
 }
 
 
-const char *
+static const char *
 af_to_str (int in)
 {
 	int result =
@@ -2351,7 +2355,7 @@ af_to_str (int in)
 }
 
 
-const char *
+static const char *
 ns_class_to_str (ns_class_t in)
 {
 	if (in < k_table_ns_class_size)
@@ -2361,7 +2365,7 @@ ns_class_to_str (ns_class_t in)
 }
 
 
-const char *
+static const char *
 ns_type_to_str (ns_type_t in)
 {
 	if (in < k_table_ns_type_size)
@@ -2371,7 +2375,7 @@ ns_type_to_str (ns_type_t in)
 }
 
 
-char *
+static char *
 format_reverse_addr_in (
 	const struct in_addr * addr,
 	int prefixlen,
@@ -2402,7 +2406,7 @@ format_reverse_addr_in (
 }
 
 
-char *
+static char *
 format_reverse_addr_in6 (
 	const struct in6_addr * addr,
 	int prefixlen,
@@ -2444,7 +2448,7 @@ format_reverse_addr_in6 (
 }
 
 
-char *
+static char *
 format_reverse_addr (
 	int af,
 	const void * addr,
@@ -2474,7 +2478,7 @@ format_reverse_addr (
 }
 
 
-int
+static int
 cmp_dns_suffix (const char * name, const char * domain)
 {
 	const char * nametail;
@@ -2534,7 +2538,7 @@ cmp_dns_suffix (const char * name, const
 	while (
 		nametail >= name
 		&& domaintail >= domain
-		&& tolower(*nametail) == tolower(*domaintail))
+		&& tolower((unsigned)*nametail) == tolower((unsigned)*domaintail))
 	{
 		nametail--;
 		domaintail--;
@@ -2565,7 +2569,7 @@ cmp_dns_suffix (const char * name, const
 }
 
 
-int
+static int
 dns_rdata_to_name (const char * rdata, int rdlen, char * name, int name_len)
 {
 	int i = 0;
@@ -2573,7 +2577,7 @@ dns_rdata_to_name (const char * rdata, i
 	const char * rdata_curr = rdata;
 	
 	// drop any leading whitespace rubbish
-	while (isspace (*rdata_curr))
+	while (isspace ((unsigned)*rdata_curr))
 	{
 		rdata_curr ++;
 		if (rdata_curr > rdata + rdlen)