]> git.ipfire.org Git - thirdparty/glibc.git/blob - resolv/tst-resolv-res_init-skeleton.c
resolv: Avoid timeouts in test-resolv-res-init, test-resolv-res_init-thread
[thirdparty/glibc.git] / resolv / tst-resolv-res_init-skeleton.c
1 /* Test parsing of /etc/resolv.conf. Genric version.
2 Copyright (C) 2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 /* Before including this file, TEST_THREAD has to be defined to 0 or
20 1, depending on whether the threading tests should be compiled
21 in. */
22
23 #include <arpa/inet.h>
24 #include <errno.h>
25 #include <gnu/lib-names.h>
26 #include <netdb.h>
27 #include <resolv/resolv-internal.h> /* For DEPRECATED_RES_USE_INET6. */
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <support/capture_subprocess.h>
31 #include <support/check.h>
32 #include <support/namespace.h>
33 #include <support/run_diff.h>
34 #include <support/support.h>
35 #include <support/temp_file.h>
36 #include <support/test-driver.h>
37 #include <support/xsocket.h>
38 #include <support/xstdio.h>
39 #include <support/xunistd.h>
40
41 #if TEST_THREAD
42 # include <support/xthread.h>
43 #endif
44
45 /* This is the host name used to ensure predictable behavior of
46 res_init. */
47 static const char *const test_hostname = "www.example.com";
48
49 /* Path to the test root directory. */
50 static char *path_chroot;
51
52 /* Path to resolv.conf under path_chroot (outside the chroot). */
53 static char *path_resolv_conf;
54
55 static void
56 prepare (int argc, char **argv)
57 {
58 path_chroot = xasprintf ("%s/tst-resolv-res_init-XXXXXX", test_dir);
59 if (mkdtemp (path_chroot) == NULL)
60 FAIL_EXIT1 ("mkdtemp (\"%s\"): %m", path_chroot);
61 add_temp_file (path_chroot);
62
63 /* Create the /etc directory in the chroot environment. */
64 char *path_etc = xasprintf ("%s/etc", path_chroot);
65 xmkdir (path_etc, 0777);
66 add_temp_file (path_etc);
67
68 /* Create an empty resolv.conf file. */
69 path_resolv_conf = xasprintf ("%s/resolv.conf", path_etc);
70 add_temp_file (path_resolv_conf);
71 support_write_file_string (path_resolv_conf, "");
72
73 free (path_etc);
74
75 /* valgrind needs a temporary directory in the chroot. */
76 {
77 char *path_tmp = xasprintf ("%s/tmp", path_chroot);
78 xmkdir (path_tmp, 0777);
79 add_temp_file (path_tmp);
80 free (path_tmp);
81 }
82 }
83
84 /* Verify that the chroot environment has been set up. */
85 static void
86 check_chroot_working (void *closure)
87 {
88 xchroot (path_chroot);
89 FILE *fp = xfopen (_PATH_RESCONF, "r");
90 xfclose (fp);
91
92 TEST_VERIFY_EXIT (res_init () == 0);
93 TEST_VERIFY (_res.options & RES_INIT);
94
95 char buf[100];
96 if (gethostname (buf, sizeof (buf)) < 0)
97 FAIL_EXIT1 ("gethostname: %m");
98 if (strcmp (buf, test_hostname) != 0)
99 FAIL_EXIT1 ("unexpected host name: %s", buf);
100 }
101
102 /* If FLAG is set in *OPTIONS, write NAME to FP, and clear it in
103 *OPTIONS. */
104 static void
105 print_option_flag (FILE *fp, int *options, int flag, const char *name)
106 {
107 if (*options & flag)
108 {
109 fprintf (fp, " %s", name);
110 *options &= ~flag;
111 }
112 }
113
114 /* Write a decoded version of the resolver configuration *RESP to the
115 stream FP. */
116 static void
117 print_resp (FILE *fp, res_state resp)
118 {
119 /* The options directive. */
120 {
121 /* RES_INIT is used internally for tracking initialization. */
122 TEST_VERIFY (resp->options & RES_INIT);
123 /* Also mask out other default flags which cannot be set through
124 the options directive. */
125 int options
126 = resp->options & ~(RES_INIT | RES_RECURSE | RES_DEFNAMES | RES_DNSRCH);
127 if (options != 0
128 || resp->ndots != 1
129 || resp->retrans != RES_TIMEOUT
130 || resp->retry != RES_DFLRETRY)
131 {
132 fputs ("options", fp);
133 if (resp->ndots != 1)
134 fprintf (fp, " ndots:%d", resp->ndots);
135 if (resp->retrans != RES_TIMEOUT)
136 fprintf (fp, " timeout:%d", resp->retrans);
137 if (resp->retry != RES_DFLRETRY)
138 fprintf (fp, " attempts:%d", resp->retry);
139 print_option_flag (fp, &options, RES_USEVC, "use-vc");
140 print_option_flag (fp, &options, DEPRECATED_RES_USE_INET6, "inet6");
141 print_option_flag (fp, &options, RES_ROTATE, "rotate");
142 print_option_flag (fp, &options, RES_USE_EDNS0, "edns0");
143 print_option_flag (fp, &options, RES_SNGLKUP,
144 "single-request");
145 print_option_flag (fp, &options, RES_SNGLKUPREOP,
146 "single-request-reopen");
147 print_option_flag (fp, &options, RES_NOTLDQUERY, "no-tld-query");
148 fputc ('\n', fp);
149 if (options != 0)
150 fprintf (fp, "; error: unresolved option bits: 0x%x\n", options);
151 }
152 }
153
154 /* The search and domain directives. */
155 if (resp->dnsrch[0] != NULL)
156 {
157 fputs ("search", fp);
158 for (int i = 0; i < MAXDNSRCH && resp->dnsrch[i] != NULL; ++i)
159 {
160 fputc (' ', fp);
161 fputs (resp->dnsrch[i], fp);
162 }
163 fputc ('\n', fp);
164 }
165 else if (resp->defdname[0] != '\0')
166 fprintf (fp, "domain %s\n", resp->defdname);
167
168 /* The sortlist directive. */
169 if (resp->nsort > 0)
170 {
171 fputs ("sortlist", fp);
172 for (int i = 0; i < resp->nsort && i < MAXRESOLVSORT; ++i)
173 {
174 char net[20];
175 if (inet_ntop (AF_INET, &resp->sort_list[i].addr,
176 net, sizeof (net)) == NULL)
177 FAIL_EXIT1 ("inet_ntop: %m\n");
178 char mask[20];
179 if (inet_ntop (AF_INET, &resp->sort_list[i].mask,
180 mask, sizeof (mask)) == NULL)
181 FAIL_EXIT1 ("inet_ntop: %m\n");
182 fprintf (fp, " %s/%s", net, mask);
183 }
184 fputc ('\n', fp);
185 }
186
187 /* The nameserver directives. */
188 for (size_t i = 0; i < resp->nscount; ++i)
189 {
190 char host[NI_MAXHOST];
191 char service[NI_MAXSERV];
192
193 /* See get_nsaddr in res_send.c. */
194 void *addr;
195 size_t addrlen;
196 if (resp->nsaddr_list[i].sin_family == 0
197 && resp->_u._ext.nsaddrs[i] != NULL)
198 {
199 addr = resp->_u._ext.nsaddrs[i];
200 addrlen = sizeof (*resp->_u._ext.nsaddrs[i]);
201 }
202 else
203 {
204 addr = &resp->nsaddr_list[i];
205 addrlen = sizeof (resp->nsaddr_list[i]);
206 }
207
208 int ret = getnameinfo (addr, addrlen,
209 host, sizeof (host), service, sizeof (service),
210 NI_NUMERICHOST | NI_NUMERICSERV);
211 if (ret != 0)
212 {
213 if (ret == EAI_SYSTEM)
214 fprintf (fp, "; error: getnameinfo: %m\n");
215 else
216 fprintf (fp, "; error: getnameinfo: %s\n", gai_strerror (ret));
217 }
218 else
219 {
220 fprintf (fp, "nameserver %s\n", host);
221 if (strcmp (service, "53") != 0)
222 fprintf (fp, "; unrepresentable port number %s\n\n", service);
223 }
224 }
225
226 TEST_VERIFY (!ferror (fp));
227 }
228
229 /* Parameters of one test case. */
230 struct test_case
231 {
232 /* A short, descriptive name of the test. */
233 const char *name;
234
235 /* The contents of the /etc/resolv.conf file. */
236 const char *conf;
237
238 /* The expected output from print_resp. */
239 const char *expected;
240
241 /* Setting for the LOCALDOMAIN environment variable. NULL if the
242 variable is not to be set. */
243 const char *localdomain;
244
245 /* Setting for the RES_OPTIONS environment variable. NULL if the
246 variable is not to be set. */
247 const char *res_options;
248 };
249
250 enum test_init
251 {
252 test_init,
253 test_ninit,
254 test_mkquery,
255 test_gethostbyname,
256 test_getaddrinfo,
257 test_init_method_last = test_getaddrinfo
258 };
259
260 /* Closure argument for run_res_init. */
261 struct test_context
262 {
263 enum test_init init;
264 const struct test_case *t;
265 };
266
267 static void
268 setup_nss_dns_and_chroot (void)
269 {
270 /* Load nss_dns outside of the chroot. */
271 if (dlopen (LIBNSS_DNS_SO, RTLD_LAZY) == NULL)
272 FAIL_EXIT1 ("could not load " LIBNSS_DNS_SO ": %s", dlerror ());
273 xchroot (path_chroot);
274 /* Force the use of nss_dns. */
275 __nss_configure_lookup ("hosts", "dns");
276 }
277
278 /* Run res_ninit or res_init in a subprocess and dump the parsed
279 resolver state to standard output. */
280 static void
281 run_res_init (void *closure)
282 {
283 struct test_context *ctx = closure;
284 TEST_VERIFY (getenv ("LOCALDOMAIN") == NULL);
285 TEST_VERIFY (getenv ("RES_OPTIONS") == NULL);
286 if (ctx->t->localdomain != NULL)
287 setenv ("LOCALDOMAIN", ctx->t->localdomain, 1);
288 if (ctx->t->res_options != NULL)
289 setenv ("RES_OPTIONS", ctx->t->res_options, 1);
290
291 switch (ctx->init)
292 {
293 case test_init:
294 xchroot (path_chroot);
295 TEST_VERIFY (res_init () == 0);
296 print_resp (stdout, &_res);
297 return;
298
299 case test_ninit:
300 xchroot (path_chroot);
301 res_state resp = xmalloc (sizeof (*resp));
302 memset (resp, 0, sizeof (*resp));
303 TEST_VERIFY (res_ninit (resp) == 0);
304 print_resp (stdout, resp);
305 res_nclose (resp);
306 free (resp);
307 return;
308
309 case test_mkquery:
310 xchroot (path_chroot);
311 unsigned char buf[512];
312 TEST_VERIFY (res_mkquery (QUERY, "www.example",
313 C_IN, ns_t_a, NULL, 0,
314 NULL, buf, sizeof (buf)) > 0);
315 print_resp (stdout, &_res);
316 return;
317
318 case test_gethostbyname:
319 setup_nss_dns_and_chroot ();
320 /* Trigger implicit initialization of the _res structure. The
321 actual lookup result is immaterial. */
322 (void )gethostbyname ("www.example");
323 print_resp (stdout, &_res);
324 return;
325
326 case test_getaddrinfo:
327 setup_nss_dns_and_chroot ();
328 /* Trigger implicit initialization of the _res structure. The
329 actual lookup result is immaterial. */
330 struct addrinfo *ai;
331 (void) getaddrinfo ("www.example", NULL, NULL, &ai);
332 print_resp (stdout, &_res);
333 return;
334 }
335
336 FAIL_EXIT1 ("invalid init method %d", ctx->init);
337 }
338
339 #if TEST_THREAD
340 /* Helper function which calls run_res_init from a thread. */
341 static void *
342 run_res_init_thread_func (void *closure)
343 {
344 run_res_init (closure);
345 return NULL;
346 }
347
348 /* Variant of res_run_init which runs the function on a non-main
349 thread. */
350 static void
351 run_res_init_on_thread (void *closure)
352 {
353 xpthread_join (xpthread_create (NULL, run_res_init_thread_func, closure));
354 }
355 #endif /* TEST_THREAD */
356
357 struct test_case test_cases[] =
358 {
359 {.name = "empty file",
360 .conf = "",
361 .expected = "search example.com\n"
362 "nameserver 127.0.0.1\n"
363 },
364 {.name = "empty file with LOCALDOMAIN",
365 .conf = "",
366 .expected = "search example.net\n"
367 "nameserver 127.0.0.1\n",
368 .localdomain = "example.net",
369 },
370 {.name = "empty file with RES_OPTIONS",
371 .conf = "",
372 .expected = "options attempts:5 edns0\n"
373 "search example.com\n"
374 "nameserver 127.0.0.1\n",
375 .res_options = "edns0 attempts:5",
376 },
377 {.name = "empty file with RES_OPTIONS and LOCALDOMAIN",
378 .conf = "",
379 .expected = "options attempts:5 edns0\n"
380 "search example.org\n"
381 "nameserver 127.0.0.1\n",
382 .localdomain = "example.org",
383 .res_options = "edns0 attempts:5",
384 },
385 {.name = "basic",
386 .conf = "domain example.net\n"
387 "search corp.example.com example.com\n"
388 "nameserver 192.0.2.1\n",
389 .expected = "search corp.example.com example.com\n"
390 "nameserver 192.0.2.1\n"
391 },
392 {.name = "whitespace",
393 .conf = "# This test covers comment and whitespace processing "
394 " (trailing whitespace,\n"
395 "# missing newline at end of file).\n"
396 "\n"
397 "domain example.net\n"
398 ";search commented out\n"
399 "search corp.example.com\texample.com\n"
400 "#nameserver 192.0.2.3\n"
401 "nameserver 192.0.2.1 \n"
402 "nameserver 192.0.2.2", /* No \n at end of file. */
403 .expected = "search corp.example.com example.com\n"
404 "nameserver 192.0.2.1\n"
405 "nameserver 192.0.2.2\n"
406 },
407 {.name = "option values, multiple servers",
408 .conf = "options\tinet6\tndots:3 edns0\tattempts:5\ttimeout:19\n"
409 "domain example.net\n"
410 ";domain comment\n"
411 "search corp.example.com\texample.com\n"
412 "nameserver 192.0.2.1\n"
413 "nameserver ::1\n"
414 "nameserver 192.0.2.2\n",
415 .expected = "options ndots:3 timeout:19 attempts:5 inet6 edns0\n"
416 "search corp.example.com example.com\n"
417 "nameserver 192.0.2.1\n"
418 "nameserver ::1\n"
419 "nameserver 192.0.2.2\n"
420 },
421 {.name = "out-of-range option vales",
422 .conf = "options use-vc timeout:999 attempts:999 ndots:99\n"
423 "search example.com\n",
424 .expected = "options ndots:15 timeout:30 attempts:5 use-vc\n"
425 "search example.com\n"
426 "nameserver 127.0.0.1\n"
427 },
428 {.name = "repeated directives",
429 .conf = "options ndots:3 use-vc\n"
430 "options edns0 ndots:2\n"
431 "domain corp.example\n"
432 "search example.net corp.example.com example.com\n"
433 "search example.org\n"
434 "search\n",
435 .expected = "options ndots:2 use-vc edns0\n"
436 "search example.org\n"
437 "nameserver 127.0.0.1\n"
438 },
439 {.name = "many name servers, sortlist",
440 .conf = "options single-request\n"
441 "search example.org example.com example.net corp.example.com\n"
442 "sortlist 192.0.2.0/255.255.255.0\n"
443 "nameserver 192.0.2.1\n"
444 "nameserver 192.0.2.2\n"
445 "nameserver 192.0.2.3\n"
446 "nameserver 192.0.2.4\n"
447 "nameserver 192.0.2.5\n"
448 "nameserver 192.0.2.6\n"
449 "nameserver 192.0.2.7\n"
450 "nameserver 192.0.2.8\n",
451 .expected = "options single-request\n"
452 "search example.org example.com example.net corp.example.com\n"
453 "sortlist 192.0.2.0/255.255.255.0\n"
454 "nameserver 192.0.2.1\n"
455 "nameserver 192.0.2.2\n"
456 "nameserver 192.0.2.3\n"
457 },
458 {.name = "IPv4 and IPv6 nameservers",
459 .conf = "options single-request\n"
460 "search example.org example.com example.net corp.example.com"
461 " legacy.example.com\n"
462 "sortlist 192.0.2.0\n"
463 "nameserver 192.0.2.1\n"
464 "nameserver 2001:db8::2\n"
465 "nameserver 192.0.2.3\n"
466 "nameserver 2001:db8::4\n"
467 "nameserver 192.0.2.5\n"
468 "nameserver 2001:db8::6\n"
469 "nameserver 192.0.2.7\n"
470 "nameserver 2001:db8::8\n",
471 .expected = "options single-request\n"
472 "search example.org example.com example.net corp.example.com"
473 " legacy.example.com\n"
474 "sortlist 192.0.2.0/255.255.255.0\n"
475 "nameserver 192.0.2.1\n"
476 "nameserver 2001:db8::2\n"
477 "nameserver 192.0.2.3\n"
478 },
479 {.name = "garbage after nameserver",
480 .conf = "nameserver 192.0.2.1 garbage\n"
481 "nameserver 192.0.2.2:5353\n"
482 "nameserver 192.0.2.3 5353\n",
483 .expected = "search example.com\n"
484 "nameserver 192.0.2.1\n"
485 "nameserver 192.0.2.3\n"
486 },
487 {.name = "RES_OPTIONS is cummulative",
488 .conf = "options timeout:7 ndots:2 use-vc\n"
489 "nameserver 192.0.2.1\n",
490 .expected = "options ndots:3 timeout:7 attempts:5 use-vc edns0\n"
491 "search example.com\n"
492 "nameserver 192.0.2.1\n",
493 .res_options = "attempts:5 ndots:3 edns0 ",
494 },
495 { NULL }
496 };
497
498 /* Run the indicated test case. This function assumes that the chroot
499 contents has already been set up. */
500 static void
501 test_file_contents (const struct test_case *t)
502 {
503 #if TEST_THREAD
504 for (int do_thread = 0; do_thread < 2; ++do_thread)
505 #endif
506 for (int init_method = 0; init_method <= test_init_method_last;
507 ++init_method)
508 {
509 if (test_verbose > 0)
510 printf ("info: testing init method %d\n", init_method);
511 struct test_context ctx = { .init = init_method, .t = t };
512 void (*func) (void *) = run_res_init;
513 #if TEST_THREAD
514 if (do_thread)
515 func = run_res_init_on_thread;
516 #endif
517 struct support_capture_subprocess proc
518 = support_capture_subprocess (func, &ctx);
519 if (strcmp (proc.out.buffer, t->expected) != 0)
520 {
521 support_record_failure ();
522 printf ("error: output mismatch for %s\n", t->name);
523 support_run_diff ("expected", t->expected,
524 "actual", proc.out.buffer);
525 }
526 support_capture_subprocess_check (&proc, t->name, 0,
527 sc_allow_stdout);
528 support_capture_subprocess_free (&proc);
529 }
530 }
531
532 /* Dummy DNS server. It ensures that the probe queries sent by
533 gethostbyname and getaddrinfo receive a reply even if the system
534 applies a very strict rate limit to localhost. */
535 static pid_t
536 start_dummy_server (void)
537 {
538 int server_socket = xsocket (AF_INET, SOCK_DGRAM, 0);
539 {
540 struct sockaddr_in sin =
541 {
542 .sin_family = AF_INET,
543 .sin_addr = { .s_addr = htonl (INADDR_LOOPBACK) },
544 .sin_port = htons (53),
545 };
546 int ret = bind (server_socket, (struct sockaddr *) &sin, sizeof (sin));
547 if (ret < 0)
548 {
549 if (errno == EACCES)
550 /* The port is reserved, which means we cannot start the
551 server. */
552 return -1;
553 FAIL_EXIT1 ("cannot bind socket to port 53: %m");
554 }
555 }
556
557 pid_t pid = xfork ();
558 if (pid == 0)
559 {
560 /* Child process. Echo back queries as SERVFAIL responses. */
561 while (true)
562 {
563 union
564 {
565 HEADER header;
566 unsigned char bytes[512];
567 } packet;
568 struct sockaddr_in sin;
569 socklen_t sinlen = sizeof (sin);
570
571 ssize_t ret = recvfrom
572 (server_socket, &packet, sizeof (packet),
573 MSG_NOSIGNAL, (struct sockaddr *) &sin, &sinlen);
574 if (ret < 0)
575 FAIL_EXIT1 ("recvfrom on fake server socket: %m");
576 if (ret > sizeof (HEADER))
577 {
578 /* Turn the query into a SERVFAIL response. */
579 packet.header.qr = 1;
580 packet.header.rcode = ns_r_servfail;
581
582 /* Send the response. */
583 ret = sendto (server_socket, &packet, ret,
584 MSG_NOSIGNAL, (struct sockaddr *) &sin, sinlen);
585 if (ret < 0)
586 /* The peer may have closed socket prematurely, so
587 this is not an error. */
588 printf ("warning: sending DNS server reply: %m\n");
589 }
590 }
591 }
592
593 /* In the parent, close the socket. */
594 xclose (server_socket);
595
596 return pid;
597 }
598
599 static int
600 do_test (void)
601 {
602 support_become_root ();
603 support_enter_network_namespace ();
604 if (!support_in_uts_namespace () || !support_can_chroot ())
605 return EXIT_UNSUPPORTED;
606
607 /* We are in an UTS namespace, so we can set the host name without
608 altering the state of the entire system. */
609 if (sethostname (test_hostname, strlen (test_hostname)) != 0)
610 FAIL_EXIT1 ("sethostname: %m");
611
612 /* These environment variables affect resolv.conf parsing. */
613 unsetenv ("LOCALDOMAIN");
614 unsetenv ("RES_OPTIONS");
615
616 /* Ensure that the chroot setup worked. */
617 {
618 struct support_capture_subprocess proc
619 = support_capture_subprocess (check_chroot_working, NULL);
620 support_capture_subprocess_check (&proc, "chroot", 0, sc_allow_none);
621 support_capture_subprocess_free (&proc);
622 }
623
624 pid_t server = start_dummy_server ();
625
626 for (size_t i = 0; test_cases[i].name != NULL; ++i)
627 {
628 if (test_verbose > 0)
629 printf ("info: running test: %s\n", test_cases[i].name);
630 TEST_VERIFY (test_cases[i].conf != NULL);
631 TEST_VERIFY (test_cases[i].expected != NULL);
632
633 support_write_file_string (path_resolv_conf, test_cases[i].conf);
634
635 test_file_contents (&test_cases[i]);
636
637 /* The expected output from the empty file test is used for
638 further tests. */
639 if (test_cases[i].conf[0] == '\0')
640 {
641 if (test_verbose > 0)
642 printf ("info: special test: missing file\n");
643 TEST_VERIFY (unlink (path_resolv_conf) == 0);
644 test_file_contents (&test_cases[i]);
645
646 if (test_verbose > 0)
647 printf ("info: special test: dangling symbolic link\n");
648 TEST_VERIFY (symlink ("does-not-exist", path_resolv_conf) == 0);
649 test_file_contents (&test_cases[i]);
650 TEST_VERIFY (unlink (path_resolv_conf) == 0);
651
652 if (test_verbose > 0)
653 printf ("info: special test: unreadable file\n");
654 support_write_file_string (path_resolv_conf, "");
655 TEST_VERIFY (chmod (path_resolv_conf, 0) == 0);
656 test_file_contents (&test_cases[i]);
657
658 /* Restore the empty file. */
659 TEST_VERIFY (unlink (path_resolv_conf) == 0);
660 support_write_file_string (path_resolv_conf, "");
661 }
662 }
663
664 if (server > 0)
665 {
666 if (kill (server, SIGTERM) < 0)
667 FAIL_EXIT1 ("could not terminate server process: %m");
668 xwaitpid (server, NULL, 0);
669 }
670
671 free (path_chroot);
672 path_chroot = NULL;
673 free (path_resolv_conf);
674 path_resolv_conf = NULL;
675 return 0;
676 }
677
678 #define PREPARE prepare
679 #include <support/test-driver.c>