2 * Unix SMB/CIFS implementation.
3 * Internal DNS query structures
4 * Copyright (C) Volker Lendecke 2018
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 #include "libcli/dns/resolvconf.h"
25 #include "lib/util/memory.h"
27 static int resolvconftest1(void)
30 "#foo\nbar\nnameserver 1.2.3.4\nnameserver 2.3.4.5";
35 size_t num_nameservers
;
37 file
= strdup(content
);
39 perror("strdup failed");
42 fp
= fmemopen(file
, strlen(file
), "r");
44 perror("fmemopen failed");
48 ret
= parse_resolvconf_fp(fp
, NULL
, &nameservers
, &num_nameservers
);
50 fprintf(stderr
, "parse_resolvconf_fp failed: %s\n",
55 if (num_nameservers
!= 2) {
56 fprintf(stderr
, "expected 2 nameservers, got %zu\n",
60 if ((strcmp(nameservers
[0], "1.2.3.4") != 0) ||
61 (strcmp(nameservers
[1], "2.3.4.5") != 0)) {
62 fprintf(stderr
, "got wrong nameservers\n");
66 TALLOC_FREE(nameservers
);
76 ret
= resolvconftest1();