svn commit: samba r5452 - in branches/SAMBA_4_0/source: rpc_server/echo torture/rpc

jelmer at samba.org jelmer at samba.org
Fri Feb 18 23:30:26 GMT 2005


Author: jelmer
Date: 2005-02-18 23:30:26 +0000 (Fri, 18 Feb 2005)
New Revision: 5452

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5452

Log:
Add implementation + torture test for echo_Surrounding

Modified:
   branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c
   branches/SAMBA_4_0/source/torture/rpc/echo.c


Changeset:
Modified: branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c	2005-02-18 23:13:51 UTC (rev 5451)
+++ branches/SAMBA_4_0/source/rpc_server/echo/rpc_echo.c	2005-02-18 23:30:26 UTC (rev 5452)
@@ -137,6 +137,20 @@
 	}
 }
 
+static NTSTATUS echo_TestSurrounding(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSurrounding *r)
+{
+	if (!r->in.data) {
+		r->out.data = NULL;
+		return NT_STATUS_OK;
+	}
+
+	r->out.data = talloc(mem_ctx, struct echo_Surrounding);
+	r->out.data->x = 2 * r->in.data->x;
+	r->out.data->surrounding = talloc_zero_array(mem_ctx, uint16_t, r->out.data->x);
+
+	return NT_STATUS_OK;
+}
+
 static long echo_TestSleep(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct echo_TestSleep *r)
 {
 	struct echo_TestSleep_private *p;

Modified: branches/SAMBA_4_0/source/torture/rpc/echo.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/echo.c	2005-02-18 23:13:51 UTC (rev 5451)
+++ branches/SAMBA_4_0/source/torture/rpc/echo.c	2005-02-18 23:30:26 UTC (rev 5452)
@@ -319,6 +319,40 @@
 	return ret;
 }
 
+/*
+  test surrounding conformant array handling
+*/
+static BOOL test_surrounding(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+	NTSTATUS status;
+	struct echo_TestSurrounding r;
+	BOOL ret = True;
+
+	ZERO_STRUCT(r);
+	r.in.data = talloc(mem_ctx, struct echo_Surrounding);
+
+	r.in.data->x = 20;
+	r.in.data->surrounding = talloc_zero_array(mem_ctx, uint16_t, r.in.data->x);
+
+	r.out.data = talloc(mem_ctx, struct echo_Surrounding);
+
+	printf("\nTesting TestSurrounding\n");
+	status = dcerpc_echo_TestSurrounding(p, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("TestSurrounding failed - %s\n", nt_errstr(status));
+		ret = False;
+	}
+	
+	if (r.out.data->x != 2 * r.in.data->x) {
+		printf("TestSurrounding did not make the array twice as large\n");
+		ret = False;
+	}
+
+	return ret;
+}
+
+
+
 BOOL torture_rpc_echo(void)
 {
         NTSTATUS status;
@@ -344,6 +378,7 @@
 	ret &= test_testcall2(p, mem_ctx);
 	ret &= test_enum(p, mem_ctx);
 	ret &= test_sleep(p, mem_ctx);
+	ret &= test_surrounding(p, mem_ctx);
 
 	printf("\n");
 	



More information about the samba-cvs mailing list