mirror of
https://github.com/samba-team/samba.git
synced 2025-08-07 09:49:30 +03:00
r18572: Use the autogenerated client and server for the echo interface and implement
some of the missing functions. RPC-ECHO now passes against Samba3.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
990e7c3f8e
commit
9e9a053661
@ -213,8 +213,8 @@ LIBNDR_OBJ = librpc/ndr/ndr_basic.o librpc/ndr/ndr.o librpc/ndr/ndr_misc.o \
|
||||
librpc/ndr/ndr_sec_helper.o librpc/ndr/ndr_string.o librpc/ndr/sid.o
|
||||
|
||||
LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_unixinfo.o librpc/gen_ndr/ndr_lsa.o \
|
||||
librpc/gen_ndr/ndr_dfs.o librpc/gen_ndr/ndr_winreg.o \
|
||||
librpc/gen_ndr/ndr_initshutdown.o
|
||||
librpc/gen_ndr/ndr_dfs.o librpc/gen_ndr/ndr_echo.o \
|
||||
librpc/gen_ndr/ndr_winreg.o librpc/gen_ndr/ndr_initshutdown.o
|
||||
|
||||
RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
|
||||
|
||||
@ -294,13 +294,13 @@ LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
|
||||
rpc_client/cli_wkssvc.o \
|
||||
rpc_client/cli_reg.o $(RPC_CLIENT_OBJ) \
|
||||
rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o \
|
||||
rpc_client/cli_ds.o rpc_client/cli_echo.o \
|
||||
rpc_client/cli_ds.o \
|
||||
rpc_client/cli_shutdown.o rpc_client/cli_svcctl.o \
|
||||
rpc_client/ndr.o
|
||||
|
||||
LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_unixinfo.o librpc/gen_ndr/cli_lsa.o \
|
||||
librpc/gen_ndr/cli_dfs.o librpc/gen_ndr/cli_winreg.o \
|
||||
librpc/gen_ndr/cli_initshutdown.o \
|
||||
librpc/gen_ndr/cli_dfs.o librpc/gen_ndr/cli_echo.o \
|
||||
librpc/gen_ndr/cli_winreg.o librpc/gen_ndr/cli_initshutdown.o \
|
||||
$(LIBMSRPC_GEN_OBJ1) $(LIBNDR_GEN_OBJ) $(LIBNDR_OBJ)
|
||||
|
||||
REGOBJS_OBJ = registry/reg_objects.o
|
||||
@ -343,7 +343,7 @@ RPC_EVENTLOG_OBJ = rpc_server/srv_eventlog.o rpc_server/srv_eventlog_nt.o rpc_se
|
||||
RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o \
|
||||
rpc_server/srv_pipe.o rpc_server/srv_lsa_hnd.o
|
||||
|
||||
RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o
|
||||
RPC_ECHO_OBJ = librpc/gen_ndr/srv_echo.o rpc_server/srv_echo_nt.o
|
||||
|
||||
RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ)
|
||||
|
||||
@ -356,7 +356,7 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_net.o \
|
||||
rpc_parse/parse_samr.o rpc_parse/parse_srv.o \
|
||||
rpc_parse/parse_wks.o rpc_parse/parse_ds.o \
|
||||
rpc_parse/parse_spoolss.o \
|
||||
rpc_parse/parse_echo.o rpc_parse/parse_shutdown.o \
|
||||
rpc_parse/parse_shutdown.o \
|
||||
rpc_parse/parse_svcctl.o \
|
||||
rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \
|
||||
rpc_parse/parse_ntsvcs.o $(REGOBJS_OBJ)
|
||||
@ -846,7 +846,7 @@ cac: SHOWFLAGS $(LIBMSRPC)
|
||||
|
||||
#####################################################################
|
||||
## Perl IDL Compiler
|
||||
IDL_FILES = unixinfo.idl lsa.idl dfs.idl winreg.idl initshutdown.idl
|
||||
IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl
|
||||
|
||||
pidl/Makefile: pidl/Makefile.PL
|
||||
@echo Building Perl IDL Compiler....
|
||||
|
@ -595,7 +595,7 @@ dnl These are preferably build shared, and static if dlopen() is not available
|
||||
default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script"
|
||||
|
||||
if test "x$developer" = xyes; then
|
||||
default_static_modules="$default_static_modules rpc_echo"
|
||||
default_static_modules="$default_static_modules rpc_rpcecho"
|
||||
default_shared_modules="$default_shared_modules charset_weird"
|
||||
fi
|
||||
|
||||
@ -5686,7 +5686,7 @@ SMB_MODULE(rpc_srv, \$(RPC_SVC_OBJ), "bin/librpc_srvsvc.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_eventlog, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_echo, \$(RPC_ECHO_OBJ), "bin/librpc_echo.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_echo.$SHLIBEXT", RPC)
|
||||
SMB_MODULE(rpc_unixinfo, \$(RPC_UNIXINFO_OBJ), "bin/librpc_unixinfo.$SHLIBEXT", RPC)
|
||||
SMB_SUBSYSTEM(RPC,smbd/server.o)
|
||||
|
||||
|
@ -1006,10 +1006,10 @@ extern int errno;
|
||||
#include "rpc_spoolss.h"
|
||||
#include "rpc_eventlog.h"
|
||||
#include "rpc_ds.h"
|
||||
#include "rpc_echo.h"
|
||||
#include "rpc_shutdown.h"
|
||||
#include "rpc_perfcount.h"
|
||||
#include "rpc_perfcount_defs.h"
|
||||
#include "librpc/gen_ndr/echo.h"
|
||||
#include "nt_printing.h"
|
||||
#include "idmap.h"
|
||||
#include "client.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/* autogenerated client stubs */
|
||||
|
||||
#include "librpc/gen_ndr/cli_echo.h"
|
||||
#include "librpc/gen_ndr/cli_unixinfo.h"
|
||||
#include "librpc/gen_ndr/cli_dfs.h"
|
||||
#include "librpc/gen_ndr/cli_lsa.h"
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Samba rpcecho definitions.
|
||||
|
||||
Copyright (C) Tim Potter 2003
|
||||
|
||||
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 2 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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_ECHO_H
|
||||
#define _RPC_ECHO_H
|
||||
|
||||
#define ECHO_ADD_ONE 0x00
|
||||
#define ECHO_DATA 0x01
|
||||
#define ECHO_SINK_DATA 0x02
|
||||
#define ECHO_SOURCE_DATA 0x03
|
||||
|
||||
typedef struct echo_q_add_one
|
||||
{
|
||||
uint32 request;
|
||||
} ECHO_Q_ADD_ONE;
|
||||
|
||||
typedef struct echo_r_add_one
|
||||
{
|
||||
uint32 response;
|
||||
} ECHO_R_ADD_ONE;
|
||||
|
||||
typedef struct echo_q_echo_data
|
||||
{
|
||||
uint32 size;
|
||||
char *data;
|
||||
} ECHO_Q_ECHO_DATA;
|
||||
|
||||
typedef struct echo_r_echo_data
|
||||
{
|
||||
uint32 size;
|
||||
char *data;
|
||||
} ECHO_R_ECHO_DATA;
|
||||
|
||||
typedef struct echo_q_source_data
|
||||
{
|
||||
uint32 size;
|
||||
} ECHO_Q_SOURCE_DATA;
|
||||
|
||||
typedef struct echo_r_source_data
|
||||
{
|
||||
uint32 size;
|
||||
char *data;
|
||||
} ECHO_R_SOURCE_DATA;
|
||||
|
||||
typedef struct echo_q_sink_data
|
||||
{
|
||||
uint32 size;
|
||||
char *data;
|
||||
} ECHO_Q_SINK_DATA;
|
||||
|
||||
typedef struct echo_r_sink_data
|
||||
{
|
||||
int dummy; /* unused */
|
||||
} ECHO_R_SINK_DATA;
|
||||
|
||||
#endif
|
@ -205,7 +205,7 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
|
||||
#define PI_WINREG 6
|
||||
#define PI_SPOOLSS 7
|
||||
#define PI_NETDFS 8
|
||||
#define PI_ECHO 9
|
||||
#define PI_RPCECHO 9
|
||||
#define PI_INITSHUTDOWN 10
|
||||
#define PI_SVCCTL 11
|
||||
#define PI_EVENTLOG 12
|
||||
|
203
source/librpc/gen_ndr/cli_echo.c
Normal file
203
source/librpc/gen_ndr/cli_echo.c
Normal file
@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* client auto-generated by pidl. DO NOT MODIFY!
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "librpc/gen_ndr/cli_echo.h"
|
||||
|
||||
NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data)
|
||||
{
|
||||
struct echo_AddOne r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.in_data = in_data;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_ADDONE, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_AddOne, (ndr_push_flags_fn_t)ndr_push_echo_AddOne);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*out_data = *r.out.out_data;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data)
|
||||
{
|
||||
struct echo_EchoData r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.len = len;
|
||||
r.in.in_data = in_data;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_ECHODATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_EchoData, (ndr_push_flags_fn_t)ndr_push_echo_EchoData);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*out_data = *r.out.out_data;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data)
|
||||
{
|
||||
struct echo_SinkData r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.len = len;
|
||||
r.in.data = data;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_SINKDATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_SinkData, (ndr_push_flags_fn_t)ndr_push_echo_SinkData);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data)
|
||||
{
|
||||
struct echo_SourceData r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.len = len;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_SOURCEDATA, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_SourceData, (ndr_push_flags_fn_t)ndr_push_echo_SourceData);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*data = *r.out.data;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2)
|
||||
{
|
||||
struct echo_TestCall r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.s1 = s1;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTCALL, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestCall, (ndr_push_flags_fn_t)ndr_push_echo_TestCall);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*s2 = *r.out.s2;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info)
|
||||
{
|
||||
struct echo_TestCall2 r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.level = level;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTCALL2, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestCall2, (ndr_push_flags_fn_t)ndr_push_echo_TestCall2);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*info = *r.out.info;
|
||||
|
||||
/* Return result */
|
||||
return r.out.result;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds)
|
||||
{
|
||||
struct echo_TestSleep r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.seconds = seconds;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTSLEEP, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestSleep, (ndr_push_flags_fn_t)ndr_push_echo_TestSleep);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
|
||||
/* Return result */
|
||||
/* Sorry, don't know how to convert uint32 to NTSTATUS */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3)
|
||||
{
|
||||
struct echo_TestEnum r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.foo1 = foo1;
|
||||
r.in.foo2 = foo2;
|
||||
r.in.foo3 = foo3;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTENUM, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestEnum, (ndr_push_flags_fn_t)ndr_push_echo_TestEnum);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*foo1 = *r.out.foo1;
|
||||
*foo2 = *r.out.foo2;
|
||||
*foo3 = *r.out.foo3;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data)
|
||||
{
|
||||
struct echo_TestSurrounding r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.data = data;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTSURROUNDING, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestSurrounding, (ndr_push_flags_fn_t)ndr_push_echo_TestSurrounding);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
*data = *r.out.data;
|
||||
|
||||
/* Return result */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data)
|
||||
{
|
||||
struct echo_TestDoublePointer r;
|
||||
NTSTATUS status;
|
||||
|
||||
/* In parameters */
|
||||
r.in.data = data;
|
||||
status = cli_do_rpc_ndr(cli, mem_ctx, PI_RPCECHO, DCERPC_ECHO_TESTDOUBLEPOINTER, &r, (ndr_pull_flags_fn_t)ndr_pull_echo_TestDoublePointer, (ndr_push_flags_fn_t)ndr_push_echo_TestDoublePointer);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Return variables */
|
||||
|
||||
/* Return result */
|
||||
/* Sorry, don't know how to convert uint16 to NTSTATUS */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
14
source/librpc/gen_ndr/cli_echo.h
Normal file
14
source/librpc/gen_ndr/cli_echo.h
Normal file
@ -0,0 +1,14 @@
|
||||
#include "librpc/gen_ndr/ndr_echo.h"
|
||||
#ifndef __CLI_RPCECHO__
|
||||
#define __CLI_RPCECHO__
|
||||
NTSTATUS rpccli_echo_AddOne(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t in_data, uint32_t *out_data);
|
||||
NTSTATUS rpccli_echo_EchoData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *in_data, uint8_t *out_data);
|
||||
NTSTATUS rpccli_echo_SinkData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data);
|
||||
NTSTATUS rpccli_echo_SourceData(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t len, uint8_t *data);
|
||||
NTSTATUS rpccli_echo_TestCall(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *s1, const char **s2);
|
||||
NTSTATUS rpccli_echo_TestCall2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t level, union echo_Info *info);
|
||||
NTSTATUS rpccli_echo_TestSleep(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t seconds);
|
||||
NTSTATUS rpccli_echo_TestEnum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3);
|
||||
NTSTATUS rpccli_echo_TestSurrounding(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct echo_Surrounding *data);
|
||||
NTSTATUS rpccli_echo_TestDoublePointer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t ***data);
|
||||
#endif /* __CLI_RPCECHO__ */
|
195
source/librpc/gen_ndr/echo.h
Normal file
195
source/librpc/gen_ndr/echo.h
Normal file
@ -0,0 +1,195 @@
|
||||
/* header auto-generated by pidl */
|
||||
|
||||
#ifndef _HEADER_rpcecho
|
||||
#define _HEADER_rpcecho
|
||||
|
||||
struct echo_info1 {
|
||||
uint8_t v;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info2 {
|
||||
uint16_t v;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info3 {
|
||||
uint32_t v;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info4 {
|
||||
uint64_t v;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info5 {
|
||||
uint8_t v1;/* [keepref] */
|
||||
uint64_t v2;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info6 {
|
||||
uint8_t v1;/* [keepref] */
|
||||
struct echo_info1 info1;/* [keepref] */
|
||||
};
|
||||
|
||||
struct echo_info7 {
|
||||
uint8_t v1;/* [keepref] */
|
||||
struct echo_info4 info4;/* [keepref] */
|
||||
};
|
||||
|
||||
union echo_Info {
|
||||
struct echo_info1 info1;/* [keepref,case] */
|
||||
struct echo_info2 info2;/* [keepref,case(2)] */
|
||||
struct echo_info3 info3;/* [keepref,case(3)] */
|
||||
struct echo_info4 info4;/* [keepref,case(4)] */
|
||||
struct echo_info5 info5;/* [keepref,case(5)] */
|
||||
struct echo_info6 info6;/* [keepref,case(6)] */
|
||||
struct echo_info7 info7;/* [keepref,case(7)] */
|
||||
}/* [switch_type(uint16)] */;
|
||||
|
||||
enum echo_Enum1 {
|
||||
ECHO_ENUM1=1,
|
||||
ECHO_ENUM2=2
|
||||
};
|
||||
|
||||
enum echo_Enum1_32 {
|
||||
ECHO_ENUM1_32=1,
|
||||
ECHO_ENUM2_32=2
|
||||
};
|
||||
|
||||
struct echo_Enum2 {
|
||||
enum echo_Enum1 e1;/* [keepref] */
|
||||
enum echo_Enum1_32 e2;/* [keepref] */
|
||||
};
|
||||
|
||||
union echo_Enum3 {
|
||||
enum echo_Enum1 e1;/* [keepref,case(ECHO_ENUM1)] */
|
||||
struct echo_Enum2 e2;/* [keepref,case(ECHO_ENUM2)] */
|
||||
}/* [switch_type(uint16)] */;
|
||||
|
||||
struct echo_Surrounding {
|
||||
uint32_t x;/* [keepref] */
|
||||
uint16_t *surrounding;/* [keepref,size_is(x)] */
|
||||
};
|
||||
|
||||
|
||||
struct echo_AddOne {
|
||||
struct {
|
||||
uint32_t in_data;/* [keepref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint32_t *out_data;/* [keepref,ref] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_EchoData {
|
||||
struct {
|
||||
uint32_t len;/* [keepref] */
|
||||
uint8_t *in_data;/* [keepref,size_is(len)] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint8_t *out_data;/* [keepref,size_is(len)] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_SinkData {
|
||||
struct {
|
||||
uint32_t len;/* [keepref] */
|
||||
uint8_t *data;/* [keepref,size_is(len)] */
|
||||
} in;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_SourceData {
|
||||
struct {
|
||||
uint32_t len;/* [keepref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint8_t *data;/* [keepref,size_is(len)] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestCall {
|
||||
struct {
|
||||
const char *s1;/* [keepref,ref,charset(UTF16)] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
const char **s2;/* [keepref,ref,charset(UTF16)] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestCall2 {
|
||||
struct {
|
||||
uint16_t level;/* [keepref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
union echo_Info *info;/* [keepref,ref,switch_is(level)] */
|
||||
NTSTATUS result;
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestSleep {
|
||||
struct {
|
||||
uint32_t seconds;/* [keepref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint32_t result;
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestEnum {
|
||||
struct {
|
||||
enum echo_Enum1 *foo1;/* [keepref,ref] */
|
||||
struct echo_Enum2 *foo2;/* [keepref,ref] */
|
||||
union echo_Enum3 *foo3;/* [keepref,ref,switch_is(*foo1)] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
enum echo_Enum1 *foo1;/* [keepref,ref] */
|
||||
struct echo_Enum2 *foo2;/* [keepref,ref] */
|
||||
union echo_Enum3 *foo3;/* [keepref,ref,switch_is(*foo1)] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestSurrounding {
|
||||
struct {
|
||||
struct echo_Surrounding *data;/* [keepref,ref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
struct echo_Surrounding *data;/* [keepref,ref] */
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct echo_TestDoublePointer {
|
||||
struct {
|
||||
uint16_t ***data;/* [keepref,ref] */
|
||||
} in;
|
||||
|
||||
struct {
|
||||
uint16_t result;
|
||||
} out;
|
||||
|
||||
};
|
||||
|
||||
#endif /* _HEADER_rpcecho */
|
1466
source/librpc/gen_ndr/ndr_echo.c
Normal file
1466
source/librpc/gen_ndr/ndr_echo.c
Normal file
File diff suppressed because it is too large
Load Diff
59
source/librpc/gen_ndr/ndr_echo.h
Normal file
59
source/librpc/gen_ndr/ndr_echo.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* header auto-generated by pidl */
|
||||
|
||||
#include "librpc/gen_ndr/echo.h"
|
||||
|
||||
#ifndef _HEADER_NDR_rpcecho
|
||||
#define _HEADER_NDR_rpcecho
|
||||
|
||||
#include "librpc/ndr/libndr.h"
|
||||
#define DCERPC_RPCECHO_UUID "60a15ec5-4de8-11d7-a637-005056a20182"
|
||||
#define DCERPC_RPCECHO_VERSION 1.0
|
||||
#define DCERPC_RPCECHO_NAME "rpcecho"
|
||||
#define DCERPC_RPCECHO_HELPSTRING "Simple echo pipe"
|
||||
extern const struct dcerpc_interface_table dcerpc_table_rpcecho;
|
||||
NTSTATUS dcerpc_server_rpcecho_init(void);
|
||||
#define DCERPC_ECHO_ADDONE (0x00)
|
||||
|
||||
#define DCERPC_ECHO_ECHODATA (0x01)
|
||||
|
||||
#define DCERPC_ECHO_SINKDATA (0x02)
|
||||
|
||||
#define DCERPC_ECHO_SOURCEDATA (0x03)
|
||||
|
||||
#define DCERPC_ECHO_TESTCALL (0x04)
|
||||
|
||||
#define DCERPC_ECHO_TESTCALL2 (0x05)
|
||||
|
||||
#define DCERPC_ECHO_TESTSLEEP (0x06)
|
||||
|
||||
#define DCERPC_ECHO_TESTENUM (0x07)
|
||||
|
||||
#define DCERPC_ECHO_TESTSURROUNDING (0x08)
|
||||
|
||||
#define DCERPC_ECHO_TESTDOUBLEPOINTER (0x09)
|
||||
|
||||
#define DCERPC_RPCECHO_CALL_COUNT (10)
|
||||
void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r);
|
||||
void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r);
|
||||
void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r);
|
||||
void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r);
|
||||
void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r);
|
||||
void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r);
|
||||
void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r);
|
||||
void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const union echo_Info *r);
|
||||
void ndr_print_echo_Enum1(struct ndr_print *ndr, const char *name, enum echo_Enum1 r);
|
||||
void ndr_print_echo_Enum1_32(struct ndr_print *ndr, const char *name, enum echo_Enum1_32 r);
|
||||
void ndr_print_echo_Enum2(struct ndr_print *ndr, const char *name, const struct echo_Enum2 *r);
|
||||
void ndr_print_echo_Enum3(struct ndr_print *ndr, const char *name, const union echo_Enum3 *r);
|
||||
void ndr_print_echo_Surrounding(struct ndr_print *ndr, const char *name, const struct echo_Surrounding *r);
|
||||
void ndr_print_echo_AddOne(struct ndr_print *ndr, const char *name, int flags, const struct echo_AddOne *r);
|
||||
void ndr_print_echo_EchoData(struct ndr_print *ndr, const char *name, int flags, const struct echo_EchoData *r);
|
||||
void ndr_print_echo_SinkData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SinkData *r);
|
||||
void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SourceData *r);
|
||||
void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall *r);
|
||||
void ndr_print_echo_TestCall2(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall2 *r);
|
||||
void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSleep *r);
|
||||
void ndr_print_echo_TestEnum(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestEnum *r);
|
||||
void ndr_print_echo_TestSurrounding(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSurrounding *r);
|
||||
void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestDoublePointer *r);
|
||||
#endif /* _HEADER_NDR_rpcecho */
|
568
source/librpc/gen_ndr/srv_echo.c
Normal file
568
source/librpc/gen_ndr/srv_echo.c
Normal file
@ -0,0 +1,568 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* server auto-generated by pidl. DO NOT MODIFY!
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "librpc/gen_ndr/srv_echo.h"
|
||||
|
||||
static BOOL api_echo_AddOne(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_AddOne r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_AddOne");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_AddOne(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.out_data = talloc_size(mem_ctx, sizeof(*r.out.out_data));
|
||||
if (r.out.out_data == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
_echo_AddOne(p, r.in.in_data, r.out.out_data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_AddOne(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_EchoData(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_EchoData r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_EchoData");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_EchoData(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.out_data = talloc_array_size(mem_ctx, sizeof(*r.out.out_data), r.in.len);
|
||||
if (r.out.out_data == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
_echo_EchoData(p, r.in.len, r.in.in_data, r.out.out_data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_EchoData(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_SinkData(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_SinkData r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_SinkData");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_SinkData(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
_echo_SinkData(p, r.in.len, r.in.data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_SinkData(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_SourceData(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_SourceData r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_SourceData");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_SourceData(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.data = talloc_array_size(mem_ctx, sizeof(*r.out.data), r.in.len);
|
||||
if (r.out.data == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
_echo_SourceData(p, r.in.len, r.out.data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_SourceData(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestCall(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestCall r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestCall(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.s2 = talloc_size(mem_ctx, sizeof(*r.out.s2));
|
||||
if (r.out.s2 == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
_echo_TestCall(p, r.in.s1, r.out.s2);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestCall(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestCall2(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestCall2 r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestCall2");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestCall2(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.info = talloc_size(mem_ctx, sizeof(*r.out.info));
|
||||
if (r.out.info == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.result = _echo_TestCall2(p, r.in.level, r.out.info);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestCall2(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestSleep(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestSleep r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSleep");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestSleep(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.result = _echo_TestSleep(p, r.in.seconds);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestSleep(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestEnum(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestEnum r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestEnum");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestEnum(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.foo1 = r.in.foo1;
|
||||
r.out.foo2 = r.in.foo2;
|
||||
r.out.foo3 = r.in.foo3;
|
||||
_echo_TestEnum(p, r.in.foo1, r.in.foo2, r.in.foo3);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestEnum(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestSurrounding(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestSurrounding r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestSurrounding");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestSurrounding(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.data = r.in.data;
|
||||
_echo_TestSurrounding(p, r.in.data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestSurrounding(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_TestDoublePointer(pipes_struct *p)
|
||||
{
|
||||
struct ndr_pull *pull;
|
||||
struct ndr_push *push;
|
||||
NTSTATUS status;
|
||||
DATA_BLOB blob;
|
||||
struct echo_TestDoublePointer r;
|
||||
TALLOC_CTX *mem_ctx = talloc_init("api_echo_TestDoublePointer");
|
||||
|
||||
if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
if (pull == NULL)
|
||||
return False;
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
status = ndr_pull_echo_TestDoublePointer(pull, NDR_IN, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
r.out.result = _echo_TestDoublePointer(p, r.in.data);
|
||||
|
||||
push = ndr_push_init_ctx(mem_ctx);
|
||||
if (push == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
status = ndr_push_echo_TestDoublePointer(push, NDR_OUT, &r);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
blob = ndr_push_blob(push);
|
||||
if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) {
|
||||
talloc_free(mem_ctx);
|
||||
return False;
|
||||
}
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
/* Tables */
|
||||
static struct api_struct api_rpcecho_cmds[] =
|
||||
{
|
||||
{"ECHO_ADDONE", DCERPC_ECHO_ADDONE, api_echo_AddOne},
|
||||
{"ECHO_ECHODATA", DCERPC_ECHO_ECHODATA, api_echo_EchoData},
|
||||
{"ECHO_SINKDATA", DCERPC_ECHO_SINKDATA, api_echo_SinkData},
|
||||
{"ECHO_SOURCEDATA", DCERPC_ECHO_SOURCEDATA, api_echo_SourceData},
|
||||
{"ECHO_TESTCALL", DCERPC_ECHO_TESTCALL, api_echo_TestCall},
|
||||
{"ECHO_TESTCALL2", DCERPC_ECHO_TESTCALL2, api_echo_TestCall2},
|
||||
{"ECHO_TESTSLEEP", DCERPC_ECHO_TESTSLEEP, api_echo_TestSleep},
|
||||
{"ECHO_TESTENUM", DCERPC_ECHO_TESTENUM, api_echo_TestEnum},
|
||||
{"ECHO_TESTSURROUNDING", DCERPC_ECHO_TESTSURROUNDING, api_echo_TestSurrounding},
|
||||
{"ECHO_TESTDOUBLEPOINTER", DCERPC_ECHO_TESTDOUBLEPOINTER, api_echo_TestDoublePointer},
|
||||
};
|
||||
|
||||
void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
|
||||
{
|
||||
*fns = api_rpcecho_cmds;
|
||||
*n_fns = sizeof(api_rpcecho_cmds) / sizeof(struct api_struct);
|
||||
}
|
||||
|
||||
NTSTATUS rpc_rpcecho_init(void)
|
||||
{
|
||||
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));
|
||||
}
|
16
source/librpc/gen_ndr/srv_echo.h
Normal file
16
source/librpc/gen_ndr/srv_echo.h
Normal file
@ -0,0 +1,16 @@
|
||||
#include "librpc/gen_ndr/ndr_echo.h"
|
||||
#ifndef __SRV_RPCECHO__
|
||||
#define __SRV_RPCECHO__
|
||||
void _echo_AddOne(pipes_struct *p, uint32_t in_data, uint32_t *out_data);
|
||||
void _echo_EchoData(pipes_struct *p, uint32_t len, uint8_t *in_data, uint8_t *out_data);
|
||||
void _echo_SinkData(pipes_struct *p, uint32_t len, uint8_t *data);
|
||||
void _echo_SourceData(pipes_struct *p, uint32_t len, uint8_t *data);
|
||||
void _echo_TestCall(pipes_struct *p, const char *s1, const char **s2);
|
||||
NTSTATUS _echo_TestCall2(pipes_struct *p, uint16_t level, union echo_Info *info);
|
||||
uint32 _echo_TestSleep(pipes_struct *p, uint32_t seconds);
|
||||
void _echo_TestEnum(pipes_struct *p, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3);
|
||||
void _echo_TestSurrounding(pipes_struct *p, struct echo_Surrounding *data);
|
||||
uint16 _echo_TestDoublePointer(pipes_struct *p, uint16_t ***data);
|
||||
void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns);
|
||||
NTSTATUS rpc_rpcecho_init(void);
|
||||
#endif /* __SRV_RPCECHO__ */
|
@ -492,11 +492,8 @@ NTSTATUS ndr_push_sptr_ptr(struct ndr_push *ndr, const void *p)
|
||||
/*
|
||||
push always a 0, if a pointer is NULL it's a fatal error
|
||||
*/
|
||||
NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
|
||||
NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr)
|
||||
{
|
||||
if (p == NULL) {
|
||||
return NT_STATUS_INVALID_PARAMETER_MIX;
|
||||
}
|
||||
return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1);
|
||||
}
|
||||
|
||||
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
RPC pipe client
|
||||
|
||||
Copyright (C) Tim Potter 2003
|
||||
Copyright (C) Jeremy Allison 2005.
|
||||
|
||||
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 2 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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
NTSTATUS rpccli_echo_add_one(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 request, uint32 *response)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
ECHO_Q_ADD_ONE q;
|
||||
ECHO_R_ADD_ONE r;
|
||||
BOOL result = False;
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
init_echo_q_add_one(&q, request);
|
||||
|
||||
CLI_DO_RPC( cli, mem_ctx, PI_ECHO, ECHO_ADD_ONE,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
echo_io_q_add_one,
|
||||
echo_io_r_add_one,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
if (response)
|
||||
*response = r.response;
|
||||
|
||||
result = True;
|
||||
|
||||
return result ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 size, char *in_data, char **out_data)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
ECHO_Q_ECHO_DATA q;
|
||||
ECHO_R_ECHO_DATA r;
|
||||
BOOL result = False;
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
init_echo_q_echo_data(&q, size, in_data);
|
||||
|
||||
CLI_DO_RPC( cli, mem_ctx, PI_ECHO, ECHO_DATA,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
echo_io_q_echo_data,
|
||||
echo_io_r_echo_data,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
result = True;
|
||||
|
||||
if (out_data) {
|
||||
*out_data = (char *)TALLOC(mem_ctx, size);
|
||||
if (!*out_data) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
memcpy(*out_data, r.data, size);
|
||||
}
|
||||
|
||||
return result ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 size, char *in_data)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
ECHO_Q_SINK_DATA q;
|
||||
ECHO_R_SINK_DATA r;
|
||||
BOOL result = False;
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
init_echo_q_sink_data(&q, size, in_data);
|
||||
|
||||
CLI_DO_RPC( cli, mem_ctx, PI_ECHO, ECHO_SINK_DATA,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
echo_io_q_sink_data,
|
||||
echo_io_r_sink_data,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
result = True;
|
||||
|
||||
return result ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
NTSTATUS rpccli_echo_source_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 size, char **out_data)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
ECHO_Q_SOURCE_DATA q;
|
||||
ECHO_R_SOURCE_DATA r;
|
||||
BOOL result = False;
|
||||
|
||||
ZERO_STRUCT(q);
|
||||
ZERO_STRUCT(r);
|
||||
|
||||
/* Marshall data and send request */
|
||||
|
||||
init_echo_q_source_data(&q, size);
|
||||
|
||||
CLI_DO_RPC( cli, mem_ctx, PI_ECHO, ECHO_SOURCE_DATA,
|
||||
q, r,
|
||||
qbuf, rbuf,
|
||||
echo_io_q_source_data,
|
||||
echo_io_r_source_data,
|
||||
NT_STATUS_UNSUCCESSFUL);
|
||||
|
||||
result = True;
|
||||
|
||||
return result ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
*
|
||||
* RPC Pipe client / server routines
|
||||
*
|
||||
* Copyright (C) Tim Potter 2003
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_PARSE
|
||||
|
||||
void init_echo_q_add_one(ECHO_Q_ADD_ONE *q_d, uint32 request)
|
||||
{
|
||||
q_d->request = request;
|
||||
}
|
||||
|
||||
BOOL echo_io_q_add_one(const char *desc, ECHO_Q_ADD_ONE *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("request", ps, 0, &q_d->request))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL echo_io_r_add_one(const char *desc, ECHO_R_ADD_ONE *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("response", ps, 0, &q_d->response))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
void init_echo_q_echo_data(ECHO_Q_ECHO_DATA *q_d, uint32 size, char *data)
|
||||
{
|
||||
q_d->size = size;
|
||||
q_d->data = data;
|
||||
}
|
||||
|
||||
BOOL echo_io_q_echo_data(const char *desc, ECHO_Q_ECHO_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("size", ps, depth, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("size", ps, depth, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
|
||||
|
||||
if (!q_d->data)
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL echo_io_r_echo_data(const char *desc, ECHO_R_ECHO_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("size", ps, 0, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
|
||||
|
||||
if (!q_d->data)
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
void init_echo_q_sink_data(ECHO_Q_SINK_DATA *q_d, uint32 size, char *data)
|
||||
{
|
||||
q_d->size = size;
|
||||
q_d->data = data;
|
||||
}
|
||||
|
||||
BOOL echo_io_q_sink_data(const char *desc, ECHO_Q_SINK_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("size", ps, depth, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("size", ps, depth, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
|
||||
|
||||
if (!q_d->data)
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL echo_io_r_sink_data(const char *desc, ECHO_R_SINK_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
void init_echo_q_source_data(ECHO_Q_SOURCE_DATA *q_d, uint32 size)
|
||||
{
|
||||
q_d->size = size;
|
||||
}
|
||||
|
||||
BOOL echo_io_q_source_data(const char *desc, ECHO_Q_SOURCE_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("size", ps, depth, &q_d->size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
BOOL echo_io_r_source_data(const char *desc, ECHO_R_SOURCE_DATA *q_d,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
if (!prs_uint32("size", ps, 0, &q_d->size))
|
||||
return False;
|
||||
|
||||
if (UNMARSHALLING(ps)) {
|
||||
q_d->data = PRS_ALLOC_MEM(ps, char, q_d->size);
|
||||
|
||||
if (!q_d->data)
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!prs_uint8s(False, "data", ps, depth, (unsigned char *)q_d->data, q_d->size))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* RPC Pipe client / server routines for rpcecho
|
||||
* Copyright (C) Tim Potter 2003.
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* This is the interface to the rpcecho pipe. */
|
||||
|
||||
#include "includes.h"
|
||||
#include "nterr.h"
|
||||
|
||||
#ifdef DEVELOPER
|
||||
|
||||
#undef DBGC_CLASS
|
||||
#define DBGC_CLASS DBGC_RPC_SRV
|
||||
|
||||
static BOOL api_add_one(pipes_struct *p)
|
||||
{
|
||||
ECHO_Q_ADD_ONE q_u;
|
||||
ECHO_R_ADD_ONE r_u;
|
||||
|
||||
prs_struct *data = &p->in_data.data;
|
||||
prs_struct *rdata = &p->out_data.rdata;
|
||||
|
||||
ZERO_STRUCT(q_u);
|
||||
ZERO_STRUCT(r_u);
|
||||
|
||||
if(!echo_io_q_add_one("", &q_u, data, 0))
|
||||
return False;
|
||||
|
||||
_echo_add_one(p, &q_u, &r_u);
|
||||
|
||||
if(!echo_io_r_add_one("", &r_u, rdata, 0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_echo_data(pipes_struct *p)
|
||||
{
|
||||
ECHO_Q_ECHO_DATA q_u;
|
||||
ECHO_R_ECHO_DATA r_u;
|
||||
|
||||
prs_struct *data = &p->in_data.data;
|
||||
prs_struct *rdata = &p->out_data.rdata;
|
||||
|
||||
ZERO_STRUCT(q_u);
|
||||
ZERO_STRUCT(r_u);
|
||||
|
||||
if(!echo_io_q_echo_data("", &q_u, data, 0))
|
||||
return False;
|
||||
|
||||
_echo_data(p, &q_u, &r_u);
|
||||
|
||||
if(!echo_io_r_echo_data("", &r_u, rdata, 0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_source_data(pipes_struct *p)
|
||||
{
|
||||
ECHO_Q_SOURCE_DATA q_u;
|
||||
ECHO_R_SOURCE_DATA r_u;
|
||||
|
||||
prs_struct *data = &p->in_data.data;
|
||||
prs_struct *rdata = &p->out_data.rdata;
|
||||
|
||||
ZERO_STRUCT(q_u);
|
||||
ZERO_STRUCT(r_u);
|
||||
|
||||
if(!echo_io_q_source_data("", &q_u, data, 0))
|
||||
return False;
|
||||
|
||||
_source_data(p, &q_u, &r_u);
|
||||
|
||||
if(!echo_io_r_source_data("", &r_u, rdata, 0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL api_sink_data(pipes_struct *p)
|
||||
{
|
||||
ECHO_Q_SINK_DATA q_u;
|
||||
ECHO_R_SINK_DATA r_u;
|
||||
|
||||
prs_struct *data = &p->in_data.data;
|
||||
prs_struct *rdata = &p->out_data.rdata;
|
||||
|
||||
ZERO_STRUCT(q_u);
|
||||
ZERO_STRUCT(r_u);
|
||||
|
||||
if(!echo_io_q_sink_data("", &q_u, data, 0))
|
||||
return False;
|
||||
|
||||
_sink_data(p, &q_u, &r_u);
|
||||
|
||||
if(!echo_io_r_sink_data("", &r_u, rdata, 0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
\pipe\rpcecho commands
|
||||
********************************************************************/
|
||||
|
||||
struct api_struct api_echo_cmds[] = {
|
||||
{"ADD_ONE", ECHO_ADD_ONE, api_add_one },
|
||||
{"ECHO_DATA", ECHO_DATA, api_echo_data },
|
||||
{"SOURCE_DATA", ECHO_SOURCE_DATA, api_source_data },
|
||||
{"SINK_DATA", ECHO_SINK_DATA, api_sink_data },
|
||||
};
|
||||
|
||||
|
||||
void echo_get_pipe_fns( struct api_struct **fns, int *n_fns )
|
||||
{
|
||||
*fns = api_echo_cmds;
|
||||
*n_fns = sizeof(api_echo_cmds) / sizeof(struct api_struct);
|
||||
}
|
||||
|
||||
NTSTATUS rpc_echo_init(void)
|
||||
{
|
||||
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
|
||||
"rpcecho", "rpcecho", api_echo_cmds,
|
||||
sizeof(api_echo_cmds) / sizeof(struct api_struct));
|
||||
}
|
||||
|
||||
#else /* DEVELOPER */
|
||||
|
||||
NTSTATUS rpc_echo_init(void)
|
||||
{
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
#endif /* DEVELOPER */
|
@ -30,29 +30,25 @@
|
||||
|
||||
/* Add one to the input and return it */
|
||||
|
||||
void _echo_add_one(pipes_struct *p, ECHO_Q_ADD_ONE *q_u, ECHO_R_ADD_ONE *r_u)
|
||||
void _echo_AddOne(pipes_struct *p, uint32_t in_data, uint32_t *out_data)
|
||||
{
|
||||
DEBUG(10, ("_echo_add_one\n"));
|
||||
|
||||
r_u->response = q_u->request + 1;
|
||||
*out_data = in_data + 1;
|
||||
}
|
||||
|
||||
/* Echo back an array of data */
|
||||
|
||||
void _echo_data(pipes_struct *p, ECHO_Q_ECHO_DATA *q_u,
|
||||
ECHO_R_ECHO_DATA *r_u)
|
||||
void _echo_EchoData(pipes_struct *p, uint32_t len, uint8_t *in_data, uint8_t *out_data)
|
||||
{
|
||||
DEBUG(10, ("_echo_data\n"));
|
||||
|
||||
r_u->data = (char *)TALLOC(p->mem_ctx, q_u->size);
|
||||
r_u->size = q_u->size;
|
||||
memcpy(r_u->data, q_u->data, q_u->size);
|
||||
memcpy(out_data, in_data, len);
|
||||
}
|
||||
|
||||
/* Sink an array of data */
|
||||
|
||||
void _sink_data(pipes_struct *p, ECHO_Q_SINK_DATA *q_u,
|
||||
ECHO_R_SINK_DATA *r_u)
|
||||
void _echo_SinkData(pipes_struct *p, uint32_t len, uint8_t *data)
|
||||
{
|
||||
DEBUG(10, ("_sink_data\n"));
|
||||
|
||||
@ -61,18 +57,78 @@ void _sink_data(pipes_struct *p, ECHO_Q_SINK_DATA *q_u,
|
||||
|
||||
/* Source an array of data */
|
||||
|
||||
void _source_data(pipes_struct *p, ECHO_Q_SOURCE_DATA *q_u,
|
||||
ECHO_R_SOURCE_DATA *r_u)
|
||||
void _echo_SourceData(pipes_struct *p, uint32_t len, uint8_t *data)
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
DEBUG(10, ("_source_data\n"));
|
||||
|
||||
r_u->data = (char *)TALLOC(p->mem_ctx, q_u->size);
|
||||
r_u->size = q_u->size;
|
||||
for (i = 0; i < len; i++)
|
||||
data[i] = i & 0xff;
|
||||
}
|
||||
|
||||
for (i = 0; i < r_u->size; i++)
|
||||
r_u->data[i] = i & 0xff;
|
||||
void _echo_TestCall(pipes_struct *p, const char *s1, const char **s2)
|
||||
{
|
||||
*s2 = talloc_strdup(p->mem_ctx, s1);
|
||||
}
|
||||
|
||||
NTSTATUS _echo_TestCall2(pipes_struct *p, uint16_t level, union echo_Info *info)
|
||||
{
|
||||
switch (level) {
|
||||
case 1:
|
||||
info->info1.v = 10;
|
||||
break;
|
||||
case 2:
|
||||
info->info2.v = 20;
|
||||
break;
|
||||
case 3:
|
||||
info->info3.v = 30;
|
||||
break;
|
||||
case 4:
|
||||
info->info4.v = 40;
|
||||
break;
|
||||
case 5:
|
||||
info->info5.v1 = 50;
|
||||
info->info5.v2 = 60;
|
||||
break;
|
||||
case 6:
|
||||
info->info6.v1 = 70;
|
||||
info->info6.info1.v= 80;
|
||||
break;
|
||||
case 7:
|
||||
info->info7.v1 = 80;
|
||||
info->info7.info4.v = 90;
|
||||
break;
|
||||
default:
|
||||
return NT_STATUS_INVALID_LEVEL;
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
uint32 _echo_TestSleep(pipes_struct *p, uint32_t seconds)
|
||||
{
|
||||
sleep(seconds);
|
||||
return seconds;
|
||||
}
|
||||
|
||||
void _echo_TestEnum(pipes_struct *p, enum echo_Enum1 *foo1, struct echo_Enum2 *foo2, union echo_Enum3 *foo3)
|
||||
{
|
||||
}
|
||||
|
||||
void _echo_TestSurrounding(pipes_struct *p, struct echo_Surrounding *data)
|
||||
{
|
||||
data->x *= 2;
|
||||
data->surrounding = talloc_zero_array(p->mem_ctx, uint16_t, data->x);
|
||||
}
|
||||
|
||||
uint16 _echo_TestDoublePointer(pipes_struct *p, uint16_t ***data)
|
||||
{
|
||||
if (!*data)
|
||||
return 0;
|
||||
if (!**data)
|
||||
return 0;
|
||||
return ***data;
|
||||
}
|
||||
|
||||
#endif /* DEVELOPER */
|
||||
|
@ -2385,8 +2385,8 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns )
|
||||
ntsvcs_get_pipe_fns( &cmds, &n_cmds );
|
||||
break;
|
||||
#ifdef DEVELOPER
|
||||
case PI_ECHO:
|
||||
echo_get_pipe_fns( &cmds, &n_cmds );
|
||||
case PI_RPCECHO:
|
||||
rpcecho_get_pipe_fns( &cmds, &n_cmds );
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -36,7 +36,7 @@ static NTSTATUS cmd_echo_add_one(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
|
||||
if (argc == 2)
|
||||
request = atoi(argv[1]);
|
||||
|
||||
result = rpccli_echo_add_one(cli, mem_ctx, request, &response);
|
||||
result = rpccli_echo_AddOne(cli, mem_ctx, request, &response);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
@ -52,7 +52,7 @@ static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
{
|
||||
uint32 size, i;
|
||||
NTSTATUS result;
|
||||
char *in_data = NULL, *out_data = NULL;
|
||||
uint8 *in_data = NULL, *out_data = NULL;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s num\n", argv[0]);
|
||||
@ -60,12 +60,13 @@ static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
size = atoi(argv[1]);
|
||||
in_data = (char *)SMB_MALLOC(size);
|
||||
in_data = (uint8 *)SMB_MALLOC(size);
|
||||
out_data = (uint8 *)SMB_MALLOC(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
in_data[i] = i & 0xff;
|
||||
|
||||
result = rpccli_echo_data(cli, mem_ctx, size, in_data, &out_data);
|
||||
result = rpccli_echo_EchoData(cli, mem_ctx, size, in_data, out_data);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
@ -80,6 +81,7 @@ static NTSTATUS cmd_echo_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
|
||||
done:
|
||||
SAFE_FREE(in_data);
|
||||
SAFE_FREE(out_data);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -90,7 +92,7 @@ static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli,
|
||||
{
|
||||
uint32 size, i;
|
||||
NTSTATUS result;
|
||||
char *out_data = NULL;
|
||||
uint8 *out_data;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s num\n", argv[0]);
|
||||
@ -98,8 +100,9 @@ static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli,
|
||||
}
|
||||
|
||||
size = atoi(argv[1]);
|
||||
out_data = (uint8 *)SMB_MALLOC(size);
|
||||
|
||||
result = rpccli_echo_source_data(cli, mem_ctx, size, &out_data);
|
||||
result = rpccli_echo_SourceData(cli, mem_ctx, size, out_data);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
@ -113,6 +116,8 @@ static NTSTATUS cmd_echo_source_data(struct rpc_pipe_client *cli,
|
||||
}
|
||||
|
||||
done:
|
||||
SAFE_FREE(out_data);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -121,7 +126,7 @@ static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
|
||||
{
|
||||
uint32 size, i;
|
||||
NTSTATUS result;
|
||||
char *in_data = NULL;
|
||||
uint8 *in_data = NULL;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("Usage: %s num\n", argv[0]);
|
||||
@ -129,12 +134,12 @@ static NTSTATUS cmd_echo_sink_data(struct rpc_pipe_client *cli, TALLOC_CTX *mem_
|
||||
}
|
||||
|
||||
size = atoi(argv[1]);
|
||||
in_data = (char *)SMB_MALLOC(size);
|
||||
in_data = (uint8 *)SMB_MALLOC(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
in_data[i] = i & 0xff;
|
||||
|
||||
result = rpccli_echo_sink_data(cli, mem_ctx, size, in_data);
|
||||
result = rpccli_echo_SinkData(cli, mem_ctx, size, in_data);
|
||||
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
goto done;
|
||||
@ -151,9 +156,9 @@ struct cmd_set echo_commands[] = {
|
||||
|
||||
{ "ECHO" },
|
||||
|
||||
{ "echoaddone", RPC_RTYPE_NTSTATUS, cmd_echo_add_one, NULL, PI_ECHO, NULL, "Add one to a number", "" },
|
||||
{ "echodata", RPC_RTYPE_NTSTATUS, cmd_echo_data, NULL, PI_ECHO, NULL, "Echo data", "" },
|
||||
{ "sinkdata", RPC_RTYPE_NTSTATUS, cmd_echo_sink_data, NULL, PI_ECHO, NULL, "Sink data", "" },
|
||||
{ "sourcedata", RPC_RTYPE_NTSTATUS, cmd_echo_source_data, NULL, PI_ECHO, NULL, "Source data", "" },
|
||||
{ "echoaddone", RPC_RTYPE_NTSTATUS, cmd_echo_add_one, NULL, PI_RPCECHO, NULL, "Add one to a number", "" },
|
||||
{ "echodata", RPC_RTYPE_NTSTATUS, cmd_echo_data, NULL, PI_RPCECHO, NULL, "Echo data", "" },
|
||||
{ "sinkdata", RPC_RTYPE_NTSTATUS, cmd_echo_sink_data, NULL, PI_RPCECHO, NULL, "Sink data", "" },
|
||||
{ "sourcedata", RPC_RTYPE_NTSTATUS, cmd_echo_source_data, NULL, PI_RPCECHO, NULL, "Source data", "" },
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -33,9 +33,9 @@ raw="$raw RAW-QFILEINFO RAW-QFSINFO RAW-READ RAW-RENAME RAW-SEARCH RAW-SEEK"
|
||||
raw="$raw RAW-SFILEINFO RAW-SFILEINFO-BUG RAW-STREAMS RAW-UNLINK RAW-WRITE"
|
||||
raw="$raw RAW-SAMBA3HIDE RAW-SAMBA3BADPATH"
|
||||
|
||||
rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY"
|
||||
rpc="$rpc RPC-SAMBA3-SRVSVC RPC-SAMBA3-GETUSERNAME RPC-SAMBA3-SHARESEC"
|
||||
rpc="$rpc RPC-UNIXINFO"
|
||||
rpc="RPC-ECHO RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-NETLOGSAMBA3"
|
||||
rpc="$rpc RPC-SAMBA3SESSIONKEY RPC-SAMBA3-SRVSVC RPC-SAMBA3-GETUSERNAME"
|
||||
rpc="$rpc RPC-SAMBA3-SHARESEC RPC-UNIXINFO"
|
||||
|
||||
tests="$base $raw $rpc"
|
||||
|
||||
|
Reference in New Issue
Block a user