source: trunk/server/source3/torture/rpc_open_tcp.c@ 690

Last change on this file since 690 was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 3.3 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * test program for rpc_pipe_open_tcp().
4 *
5 * Copyright (C) Michael Adam 2008
6 *
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 3 of the License, or
10 * (at your option) any later version.
11 *
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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "includes.h"
22
23#include "librpc/gen_ndr/ndr_dfs.h"
24#include "librpc/gen_ndr/ndr_drsuapi.h"
25#include "librpc/gen_ndr/ndr_dssetup.h"
26#include "librpc/gen_ndr/ndr_echo.h"
27#include "librpc/gen_ndr/ndr_epmapper.h"
28#include "librpc/gen_ndr/ndr_eventlog.h"
29#include "librpc/gen_ndr/ndr_initshutdown.h"
30#include "librpc/gen_ndr/ndr_lsa.h"
31#include "librpc/gen_ndr/ndr_netlogon.h"
32#include "librpc/gen_ndr/ndr_ntsvcs.h"
33#include "librpc/gen_ndr/ndr_samr.h"
34#include "librpc/gen_ndr/ndr_srvsvc.h"
35#include "librpc/gen_ndr/ndr_svcctl.h"
36#include "librpc/gen_ndr/ndr_winreg.h"
37#include "librpc/gen_ndr/ndr_wkssvc.h"
38
39extern const struct ndr_interface_table ndr_table_netdfs;
40extern const struct ndr_interface_table ndr_table_drsuapi;
41extern const struct ndr_interface_table ndr_table_dssetup;
42extern const struct ndr_interface_table ndr_table_rpcecho;
43extern const struct ndr_interface_table ndr_table_epmapper;
44extern const struct ndr_interface_table ndr_table_eventlog;
45extern const struct ndr_interface_table ndr_table_initshutdown;
46extern const struct ndr_interface_table ndr_table_lsarpc;
47extern const struct ndr_interface_table ndr_table_netlogon;
48extern const struct ndr_interface_table ndr_table_ntsvcs;
49extern const struct ndr_interface_table ndr_table_samr;
50extern const struct ndr_interface_table ndr_table_srvsvc;
51extern const struct ndr_interface_table ndr_table_svcctl;
52extern const struct ndr_interface_table ndr_table_winreg;
53extern const struct ndr_interface_table ndr_table_wkssvc;
54
55const struct ndr_interface_table *tables[] = {
56 &ndr_table_netdfs,
57 &ndr_table_drsuapi,
58 &ndr_table_dssetup,
59 &ndr_table_rpcecho,
60 &ndr_table_epmapper,
61 &ndr_table_eventlog,
62 &ndr_table_initshutdown,
63 &ndr_table_lsarpc,
64 &ndr_table_netlogon,
65 &ndr_table_ntsvcs,
66 &ndr_table_samr,
67 &ndr_table_srvsvc,
68 &ndr_table_svcctl,
69 &ndr_table_winreg,
70 &ndr_table_wkssvc,
71 NULL
72};
73
74int main(int argc, const char **argv)
75{
76 const struct ndr_interface_table **table;
77 NTSTATUS status;
78 struct rpc_pipe_client *rpc_pipe = NULL;
79 TALLOC_CTX *mem_ctx = talloc_stackframe();
80
81 if (argc != 3) {
82 d_printf("USAGE: %s interface host\n", argv[0]);
83 return -1;
84 }
85
86 for (table = tables; *table != NULL; table++) {
87 if (strequal((*table)->name, argv[1])) {
88 break;
89 }
90 }
91
92 if (*table == NULL) {
93 d_printf("ERROR: unknown interface '%s' given\n", argv[1]);
94 return -1;
95 }
96
97 status = rpc_pipe_open_tcp(mem_ctx, argv[2], &((*table)->syntax_id),
98 &rpc_pipe);
99 if (!NT_STATUS_IS_OK(status)) {
100 d_printf("ERROR calling rpc_pipe_open_tcp(): %s\n",
101 nt_errstr(status));
102 return -1;
103 }
104
105 TALLOC_FREE(mem_ctx);
106
107 return 0;
108}
109
Note: See TracBrowser for help on using the repository browser.