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 "lib/cmdline/popt_common.h"
24 #include "libnet/libnet.h"
25 #include "libnet/composite.h"
28 BOOL test_lsa_connect(struct libnet_context *ctx)
31 struct libnet_RpcConnect connect;
32 connect.level = LIBNET_RPC_CONNECT_PDC;
33 connect.in.domain_name = lp_workgroup();
34 connect.in.dcerpc_iface = &dcerpc_table_lsarpc;
36 status = libnet_RpcConnect(ctx, ctx, &connect);
38 if (!NT_STATUS_IS_OK(status)) {
39 printf("Couldn't connect to rpc service %s on %s: %s\n",
40 connect.in.dcerpc_iface->name, connect.in.domain_name,
50 BOOL test_samr_connect(struct libnet_context *ctx)
53 struct libnet_RpcConnect connect;
54 connect.level = LIBNET_RPC_CONNECT_PDC;
55 connect.in.domain_name = lp_workgroup();
56 connect.in.dcerpc_iface = &dcerpc_table_samr;
58 status = libnet_RpcConnect(ctx, ctx, &connect);
60 if (!NT_STATUS_IS_OK(status)) {
61 printf("Couldn't connect to rpc service %s on %s: %s\n",
62 connect.in.dcerpc_iface->name, connect.in.domain_name,
72 BOOL torture_rpc_connect(void)
74 struct libnet_context *ctx;
76 ctx = libnet_context_init(NULL);
77 ctx->cred = cmdline_credentials;
79 if (!test_lsa_connect(ctx)) {
80 printf("failed to connect lsarpc interface\n");
84 if (!test_samr_connect(ctx)) {
85 printf("failed to connect samr interface\n");