2 Unix SMB/CIFS implementation.
3 Test suite for libnet calls.
5 Copyright (C) Rafal Szczesniak 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "libnet/libnet.h"
24 #include "libnet/composite.h"
25 #include "libcli/composite/monitor.h"
26 #include "librpc/gen_ndr/ndr_nbt.h"
29 BOOL torture_lookup(void)
33 struct libnet_Lookup lookup;
34 const char address[16];
35 const char** methods = lp_name_resolve_order();
37 mem_ctx = talloc_init("test_lookup");
39 lookup.in.hostname = lp_netbios_name();
40 lookup.in.methods = lp_name_resolve_order();
41 lookup.in.type = NBT_NAME_CLIENT;
42 lookup.out.address = (const char**)&address;
44 status = libnet_Lookup(mem_ctx, &lookup);
46 if (!NT_STATUS_IS_OK(status)) {
47 printf("Couldn't lookup name %s: %s\n", lookup.in.hostname, nt_errstr(status));
55 BOOL torture_lookup_host(void)
59 struct libnet_Lookup lookup;
60 const char address[16];
61 const char** methods = lp_name_resolve_order();
63 mem_ctx = talloc_init("test_lookup_host");
65 lookup.in.hostname = lp_netbios_name();
66 lookup.in.methods = lp_name_resolve_order();
67 lookup.out.address = (const char**)&address;
69 status = libnet_LookupHost(mem_ctx, &lookup);
71 if (!NT_STATUS_IS_OK(status)) {
72 printf("Couldn't lookup host %s: %s\n", lookup.in.hostname, nt_errstr(status));
80 BOOL torture_lookup_pdc(void)
84 struct libnet_Lookup lookup;
85 const char address[16];
86 const char** methods = lp_name_resolve_order();
88 mem_ctx = talloc_init("test_lookup_pdc");
90 lookup.in.hostname = lp_workgroup();
91 lookup.in.methods = lp_name_resolve_order();
92 lookup.out.address = (const char**)&address;
94 status = libnet_LookupPdc(mem_ctx, &lookup);
96 if (!NT_STATUS_IS_OK(status)) {
97 printf("Couldn't lookup pdc %s: %s\n", lookup.in.hostname, nt_errstr(status));