The branch, master has been updated via 528bced s3:build: don't use librpc/gen_ndr/cli_echo.[ch] anymore via 494e57d s3:torture: use dcerpc_echo_X() functions via 85db5c9 s3:rpcclient: use dcerpc_echo_X() functions from d3abc90 s3: Avoid a few calls to cli_errstr
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 528bcedbc55e9fa9e700db74c2f7e7323c3f08c1 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 15 09:17:55 2011 +0100 s3:build: don't use librpc/gen_ndr/cli_echo.[ch] anymore metze Autobuild-User: Stefan Metzmacher <me...@samba.org> Autobuild-Date: Mon Jan 17 09:34:12 CET 2011 on sn-devel-104 commit 494e57d913ba2502b9a4bd3172228949590e0ae6 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 15 09:15:34 2011 +0100 s3:torture: use dcerpc_echo_X() functions metze commit 85db5c9f8f76822999765650def55b8342ef6244 Author: Stefan Metzmacher <me...@samba.org> Date: Sat Jan 15 09:14:56 2011 +0100 s3:rpcclient: use dcerpc_echo_X() functions metze ----------------------------------------------------------------------- Summary of changes: source3/Makefile.in | 3 +- source3/rpcclient/cmd_echo.c | 67 ++++++++++++++++++++---------------- source3/torture/test_async_echo.c | 10 +++-- source3/wscript_build | 8 +--- 4 files changed, 46 insertions(+), 42 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/Makefile.in b/source3/Makefile.in index dd719a1..1ebc579 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -357,8 +357,7 @@ LIBCLI_DRSUAPI_OBJ = librpc/gen_ndr/ndr_drsuapi_c.o LIBCLI_DFS_OBJ = librpc/gen_ndr/ndr_dfs_c.o -LIBCLI_ECHO_OBJ = librpc/gen_ndr/cli_echo.o \ - librpc/gen_ndr/ndr_echo_c.o +LIBCLI_ECHO_OBJ = librpc/gen_ndr/ndr_echo_c.o LIBCLI_INITSHUTDOWN_OBJ = librpc/gen_ndr/ndr_initshutdown_c.o diff --git a/source3/rpcclient/cmd_echo.c b/source3/rpcclient/cmd_echo.c index cf5f9e0..78787b0 100644 --- a/source3/rpcclient/cmd_echo.c +++ b/source3/rpcclient/cmd_echo.c @@ -20,38 +20,41 @@ #include "includes.h" #include "rpcclient.h" -#include "../librpc/gen_ndr/cli_echo.h" +#include "../librpc/gen_ndr/ndr_echo_c.h" static NTSTATUS cmd_echo_add_one(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = cli->binding_handle; uint32 request = 1, response; - NTSTATUS result; + NTSTATUS status; if (argc > 2) { printf("Usage: %s [num]\n", argv[0]); return NT_STATUS_OK; } - if (argc == 2) + if (argc == 2) { request = atoi(argv[1]); + } - result = rpccli_echo_AddOne(cli, mem_ctx, request, &response); - - if (!NT_STATUS_IS_OK(result)) + status = dcerpc_echo_AddOne(b, mem_ctx, request, &response); + if (!NT_STATUS_IS_OK(status)) { goto done; + } printf("%d + 1 = %d\n", request, response); done: - return result; + return status; } static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = cli->binding_handle; uint32 size, i; - NTSTATUS result; + NTSTATUS status; uint8_t *in_data = NULL, *out_data = NULL; if (argc != 2) { @@ -63,29 +66,30 @@ static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) { printf("Failure to allocate buff of %d bytes\n", size); - result = NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; goto done; } if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) { printf("Failure to allocate buff of %d bytes\n", size); - result = NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; goto done; } - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { in_data[i] = i & 0xff; + } - result = rpccli_echo_EchoData(cli, mem_ctx, size, in_data, out_data); - - if (!NT_STATUS_IS_OK(result)) + status = dcerpc_echo_EchoData(b, mem_ctx, size, in_data, out_data); + if (!NT_STATUS_IS_OK(status)) { goto done; + } for (i = 0; i < size; i++) { if (in_data[i] != out_data[i]) { printf("mismatch at offset %d, %d != %d\n", i, in_data[i], out_data[i]); - result = NT_STATUS_UNSUCCESSFUL; + status = NT_STATUS_UNSUCCESSFUL; } } @@ -93,15 +97,16 @@ done: SAFE_FREE(in_data); SAFE_FREE(out_data); - return result; + return status; } static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = cli->binding_handle; uint32 size, i; - NTSTATUS result; + NTSTATUS status; uint8_t *out_data = NULL; if (argc != 2) { @@ -113,35 +118,36 @@ static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli, if ( (out_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) { printf("Failure to allocate buff of %d bytes\n", size); - result = NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; goto done; } - result = rpccli_echo_SourceData(cli, mem_ctx, size, out_data); - - if (!NT_STATUS_IS_OK(result)) + status = dcerpc_echo_SourceData(b, mem_ctx, size, out_data); + if (!NT_STATUS_IS_OK(status)) { goto done; + } for (i = 0; i < size; i++) { if (out_data && out_data[i] != (i & 0xff)) { printf("mismatch at offset %d, %d != %d\n", i, out_data[i], i & 0xff); - result = NT_STATUS_UNSUCCESSFUL; + status = NT_STATUS_UNSUCCESSFUL; } } done: SAFE_FREE(out_data); - return result; + return status; } static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { + struct dcerpc_binding_handle *b = cli->binding_handle; uint32 size, i; - NTSTATUS result; + NTSTATUS status; uint8_t *in_data = NULL; if (argc != 2) { @@ -153,22 +159,23 @@ static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ if ( (in_data = (uint8_t*)SMB_MALLOC(size)) == NULL ) { printf("Failure to allocate buff of %d bytes\n", size); - result = NT_STATUS_NO_MEMORY; + status = NT_STATUS_NO_MEMORY; goto done; } - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { in_data[i] = i & 0xff; + } - result = rpccli_echo_SinkData(cli, mem_ctx, size, in_data); - - if (!NT_STATUS_IS_OK(result)) + status = dcerpc_echo_SinkData(b, mem_ctx, size, in_data); + if (!NT_STATUS_IS_OK(status)) { goto done; + } done: SAFE_FREE(in_data); - return result; + return status; } /* List of commands exported by this module */ diff --git a/source3/torture/test_async_echo.c b/source3/torture/test_async_echo.c index 13d4679..dec5e74 100644 --- a/source3/torture/test_async_echo.c +++ b/source3/torture/test_async_echo.c @@ -19,15 +19,15 @@ #include "includes.h" #include "torture/proto.h" -#include "librpc/gen_ndr/cli_echo.h" +#include "librpc/gen_ndr/ndr_echo_c.h" static void rpccli_sleep_done(struct tevent_req *req) { int *done = (int *)tevent_req_callback_data_void(req); NTSTATUS status; - uint32_t result; + uint32_t result = UINT32_MAX; - status = rpccli_echo_TestSleep_recv(req, talloc_tos(), &result); + status = dcerpc_echo_TestSleep_recv(req, talloc_tos(), &result); TALLOC_FREE(req); printf("sleep returned %s, %d\n", nt_errstr(status), (int)result); *done -= 1; @@ -60,6 +60,7 @@ bool run_async_echo(int dummy) { struct cli_state *cli = NULL; struct rpc_pipe_client *p; + struct dcerpc_binding_handle *b; struct tevent_context *ev; struct tevent_req *req; NTSTATUS status; @@ -85,10 +86,11 @@ bool run_async_echo(int dummy) printf("Could not open echo pipe: %s\n", nt_errstr(status)); goto fail; } + b = p->binding_handle; num_reqs = 0; - req = rpccli_echo_TestSleep_send(ev, ev, p, 15); + req = dcerpc_echo_TestSleep_send(ev, ev, b, 15); if (req == NULL) { printf("rpccli_echo_TestSleep_send failed\n"); goto fail; diff --git a/source3/wscript_build b/source3/wscript_build index 205aabe..ef39d16 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1079,10 +1079,6 @@ bld.SAMBA_SUBSYSTEM('NDR_NBT_BUF', deps='talloc', autoproto='nbtname.h') -bld.SAMBA_SUBSYSTEM('RPCCLI_ECHO', - source='../librpc/gen_ndr/cli_echo.c', - public_deps='RPC_NDR_ECHO') - bld.SAMBA_SUBSYSTEM('RPCCLI_SAMR', source='../librpc/gen_ndr/cli_samr.c', public_deps='RPC_NDR_SAMR') @@ -1170,7 +1166,7 @@ bld.SAMBA_BINARY('rpcclient/rpcclient', source=RPCCLIENT_SRC, deps='''talloc tdb cap resolv POPT_SAMBA PASSDB LIBSMB LIB_NONSMBD PARAM_WITHOUT_REG wbclient PARAM KRBCLIENT LIBMSRPC_GEN LIBMSRPC - LIBADS SMBREADLINE DCUTIL RPC_NDR_WINREG RPCCLI_ECHO + LIBADS SMBREADLINE DCUTIL RPC_NDR_WINREG RPC_NDR_ECHO RPC_CLIENT_SCHANNEL LIBCLI_SAMR LIBCLI_LSA LIBRPCCLI_NETLOGON LIBCLI_SPOOLSS RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_DSSETUP RPC_NDR_DFS @@ -1269,7 +1265,7 @@ bld.SAMBA_BINARY('nmblookup', bld.SAMBA_BINARY('smbtorture', source=SMBTORTURE_SRC, deps='''talloc tdb tevent cap resolv wbclient PARAM LIBSMB KRBCLIENT TLDAP - LIB_NONSMBD POPT_SAMBA ASN1_UTIL LIBTSOCKET NDR_LSA LIBMSRPC LIBMSRPC_GEN RPCCLI_ECHO''', + LIB_NONSMBD POPT_SAMBA ASN1_UTIL LIBTSOCKET NDR_LSA LIBMSRPC LIBMSRPC_GEN RPC_NDR_ECHO''', vars=locals()) bld.SAMBA_BINARY('smbconftort', -- Samba Shared Repository