summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-04 23:27:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:17 -0500
commit7588a01cb6d387440d778e3bd77225b287cf48bc (patch)
tree9b69ed4a4847d6a28ceaa4568ae034f3eba434db
parent8448dd6ea0c706e0d5ec5d8773939aa188b62904 (diff)
downloadsamba-7588a01cb6d387440d778e3bd77225b287cf48bc.tar.gz
samba-7588a01cb6d387440d778e3bd77225b287cf48bc.tar.bz2
samba-7588a01cb6d387440d778e3bd77225b287cf48bc.zip
r4520: added a enum test function to the echo pipe
(This used to be commit f9e0aa1ab1faac039893db241819907c9c4bb510)
-rw-r--r--source4/librpc/idl/echo.idl26
-rw-r--r--source4/rpc_server/echo/rpc_echo.c6
-rw-r--r--source4/torture/rpc/echo.c39
3 files changed, 71 insertions, 0 deletions
diff --git a/source4/librpc/idl/echo.idl b/source4/librpc/idl/echo.idl
index 46a4d89478..f2d8960558 100644
--- a/source4/librpc/idl/echo.idl
+++ b/source4/librpc/idl/echo.idl
@@ -92,4 +92,30 @@ interface rpcecho
uint32 echo_TestSleep(
[in] uint32 seconds
);
+
+ typedef enum {
+ ECHO_ENUM1 = 1,
+ ECHO_ENUM2 = 2
+ } echo_Enum1;
+
+ typedef [v1_enum] enum {
+ ECHO_ENUM1_32 = 1,
+ ECHO_ENUM2_32 = 2
+ } echo_Enum1_32;
+
+ typedef struct {
+ echo_Enum1 e1;
+ echo_Enum1_32 e2;
+ } echo_Enum2;
+
+ typedef union {
+ [case(ECHO_ENUM1)] echo_Enum1 e1;
+ [case(ECHO_ENUM2)] echo_Enum2 e2;
+ } echo_Enum3;
+
+ void echo_TestEnum(
+ [in,out,ref] echo_Enum1 *foo1,
+ [in,out,ref] echo_Enum2 *foo2,
+ [in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3
+ );
}
diff --git a/source4/rpc_server/echo/rpc_echo.c b/source4/rpc_server/echo/rpc_echo.c
index f86ae6debf..543bca1073 100644
--- a/source4/rpc_server/echo/rpc_echo.c
+++ b/source4/rpc_server/echo/rpc_echo.c
@@ -107,6 +107,12 @@ static NTSTATUS echo_TestCall2(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
return NT_STATUS_OK;
}
+static NTSTATUS echo_TestEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestEnum *r)
+{
+ r->out.foo2->e1 = ECHO_ENUM2;
+ return NT_STATUS_OK;
+}
+
static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r)
{
sleep(r->in.seconds);
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index c141d4be9c..5db438afd0 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -262,6 +262,41 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
}
#endif
+
+/*
+ test enum handling
+*/
+static BOOL test_enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct echo_TestEnum r;
+ BOOL ret = True;
+ enum echo_Enum1 v = ECHO_ENUM1;
+ struct echo_Enum2 e2;
+ union echo_Enum3 e3;
+
+ r.in.foo1 = &v;
+ r.in.foo2 = &e2;
+ r.in.foo3 = &e3;
+ r.out.foo1 = &v;
+ r.out.foo2 = &e2;
+ r.out.foo3 = &e3;
+
+ e2.e1 = 76;
+ e2.e2 = ECHO_ENUM1_32;
+ e3.e1 = ECHO_ENUM2;
+
+ printf("\nTesting TestEnum\n");
+ status = dcerpc_echo_TestEnum(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("TestEnum failed - %s\n", nt_errstr(status));
+ ret = False;
+ }
+
+ return ret;
+}
+
+
BOOL torture_rpc_echo(void)
{
NTSTATUS status;
@@ -303,6 +338,10 @@ BOOL torture_rpc_echo(void)
ret = False;
}
+ if (!test_enum(p, mem_ctx)) {
+ ret = False;
+ }
+
/*
if (!test_sleep(p, mem_ctx)) {
ret = False;