diff options
author | Michael Adam <obnox@samba.org> | 2008-05-22 11:08:47 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-05-22 11:30:03 +0200 |
commit | 5a2206f254328f8afcfa0e4925a7ce342d8874c8 (patch) | |
tree | 462d91d576e1deb2d1310b4ea0039497ae612570 | |
parent | b398a96b09af5268e71bd3108f6c1e97568736f8 (diff) | |
download | samba-5a2206f254328f8afcfa0e4925a7ce342d8874c8.tar.gz samba-5a2206f254328f8afcfa0e4925a7ce342d8874c8.tar.bz2 samba-5a2206f254328f8afcfa0e4925a7ce342d8874c8.zip |
torture: add a test program rpc_open_tcp() to test the rpc_pipe_open_tcp() func.
This is still very raw and has yet to be integrated into the test suite.
Michael
(This used to be commit 3ec3ab4e5309c63bbf2fa5efa5d2c47856560a0f)
-rw-r--r-- | source3/Makefile.in | 20 | ||||
-rw-r--r-- | source3/torture/rpc_open_tcp.c | 115 |
2 files changed, 135 insertions, 0 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index faf4ccf4f6..1a970bf988 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1153,6 +1153,20 @@ VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \ $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(GROUPDB_OBJ) $(LDB_OBJ) \ $(DISPLAY_SEC_OBJ) +RPC_OPEN_TCP_OBJ = torture/rpc_open_tcp.o \ + $(LIBSMB_OBJ) \ + $(PARAM_OBJ) \ + $(PASSDB_OBJ) \ + @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \ + $(LIB_NONSMBD_OBJ) \ + $(KRBCLIENT_OBJ) \ + $(RPC_PARSE_OBJ2) \ + $(RPC_CLIENT_OBJ1) \ + rpc_client/cli_pipe.o \ + librpc/rpc/binding.o \ + $(LIBMSRPC_GEN_OBJ) + + ###################################################################### # now the rules... ###################################################################### @@ -2073,6 +2087,12 @@ bin/timelimit@EXEEXT@: script/tests/timelimit.o @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o +bin/rpc_open_tcp@EXEEXT@: $(BINARY_PREREQS) $(RPC_OPEN_TCP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ + @echo "Linking $@" + @$(CC) $(FLAGS) -o $@ $(RPC_OPEN_TCP_OBJ) $(LDFLAGS) $(DYNEXP) \ + $(LIBS) @LIBTALLOC_LIBS@ @LIBTDB_SHARED@ @WINBIND_LIBS@ \ + $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) + install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSSPNEGO@ installman \ installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \ installlibtalloc \ diff --git a/source3/torture/rpc_open_tcp.c b/source3/torture/rpc_open_tcp.c new file mode 100644 index 0000000000..c28c722679 --- /dev/null +++ b/source3/torture/rpc_open_tcp.c @@ -0,0 +1,115 @@ +/* + * Unix SMB/CIFS implementation. + * test program for rpc_pipe_open_tcp(). + * + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "includes.h" + +#include "librpc/gen_ndr/ndr_dfs.h" +#if 0 +#include "librpc/gen_ndr/ndr_drsuapi.h" +#endif +#include "librpc/gen_ndr/ndr_dssetup.h" +#include "librpc/gen_ndr/ndr_echo.h" +#include "librpc/gen_ndr/ndr_epmapper.h" +#include "librpc/gen_ndr/ndr_eventlog.h" +#include "librpc/gen_ndr/ndr_initshutdown.h" +#include "librpc/gen_ndr/ndr_lsa.h" +#include "librpc/gen_ndr/ndr_netlogon.h" +#include "librpc/gen_ndr/ndr_ntsvcs.h" +#include "librpc/gen_ndr/ndr_samr.h" +#include "librpc/gen_ndr/ndr_srvsvc.h" +#include "librpc/gen_ndr/ndr_svcctl.h" +#include "librpc/gen_ndr/ndr_winreg.h" +#include "librpc/gen_ndr/ndr_wkssvc.h" + +extern const struct ndr_interface_table ndr_table_netdfs; +#if 0 +extern const struct ndr_interface_table ndr_table_drsuapi; +#endif +extern const struct ndr_interface_table ndr_table_dssetup; +extern const struct ndr_interface_table ndr_table_rpcecho; +extern const struct ndr_interface_table ndr_table_epmapper; +extern const struct ndr_interface_table ndr_table_eventlog; +extern const struct ndr_interface_table ndr_table_initshutdown; +extern const struct ndr_interface_table ndr_table_lsarpc; +extern const struct ndr_interface_table ndr_table_netlogon; +extern const struct ndr_interface_table ndr_table_ntsvcs; +extern const struct ndr_interface_table ndr_table_samr; +extern const struct ndr_interface_table ndr_table_srvsvc; +extern const struct ndr_interface_table ndr_table_svcctl; +extern const struct ndr_interface_table ndr_table_winreg; +extern const struct ndr_interface_table ndr_table_wkssvc; + +const struct ndr_interface_table *tables[] = { + &ndr_table_netdfs, +#if 0 + &ndr_table_drsuapi, +#endif + &ndr_table_dssetup, + &ndr_table_rpcecho, + &ndr_table_epmapper, + &ndr_table_eventlog, + &ndr_table_initshutdown, + &ndr_table_lsarpc, + &ndr_table_netlogon, + &ndr_table_ntsvcs, + &ndr_table_samr, + &ndr_table_srvsvc, + &ndr_table_svcctl, + &ndr_table_winreg, + &ndr_table_wkssvc, + NULL +}; + +int main(int argc, const char **argv) +{ + const struct ndr_interface_table **table; + NTSTATUS status; + struct rpc_pipe_client *rpc_pipe = NULL; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + + if (argc != 3) { + d_printf("USAGE: %s interface host\n", argv[0]); + return -1; + } + + for (table = tables; *table != NULL; table++) { + if (strequal((*table)->name, argv[1])) { + break; + } + } + + if (*table == NULL) { + d_printf("ERROR: unknown interface '%s' given\n", argv[1]); + return -1; + } + + status = rpc_pipe_open_tcp(mem_ctx, argv[2], &((*table)->syntax_id), + &rpc_pipe); + if (!NT_STATUS_IS_OK(status)) { + d_printf("ERROR calling rpc_pipe_open_tcp(): %s\n", + nt_errstr(status)); + return -1; + } + + TALLOC_FREE(mem_ctx); + + return 0; +} + |