svn commit: samba r4621 - in branches/SAMBA_4_0/source/torture/rpc: .

jelmer at samba.org jelmer at samba.org
Sun Jan 9 14:24:52 GMT 2005


Author: jelmer
Date: 2005-01-09 14:24:51 +0000 (Sun, 09 Jan 2005)
New Revision: 4621

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

Log:
Add torture tests for epm_Insert and epm_Delete

Modified:
   branches/SAMBA_4_0/source/torture/rpc/epmapper.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/rpc/epmapper.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/epmapper.c	2005-01-09 12:55:25 UTC (rev 4620)
+++ branches/SAMBA_4_0/source/torture/rpc/epmapper.c	2005-01-09 14:24:51 UTC (rev 4621)
@@ -270,6 +270,73 @@
 	return True;
 }
 
+static BOOL test_Delete(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct epm_entry_t *entries)
+{
+	NTSTATUS status;
+	struct epm_Delete r;
+
+	r.in.num_ents = 1;
+	r.in.entries = entries;
+	
+	status = dcerpc_epm_Delete(p, mem_ctx, &r);
+	if (NT_STATUS_IS_ERR(status)) {
+		printf("Delete failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	if (r.out.result != 0) {
+		printf("Delete failed - %d\n", r.out.result);
+		return False;
+	}
+
+	return True;
+}
+
+static BOOL test_Insert(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+	NTSTATUS status;
+	struct epm_Insert r;
+	struct dcerpc_binding bd;
+
+	r.in.num_ents = 1;
+
+	r.in.entries = talloc_array_p(mem_ctx, struct epm_entry_t, 1);
+	ZERO_STRUCT(r.in.entries[0].object);
+	r.in.entries[0].annotation = "smbtorture endpoint";
+	status = dcerpc_parse_binding(mem_ctx, "ncalrpc:[SMBTORTURE]", &bd);
+	if (NT_STATUS_IS_ERR(status)) {
+		printf("Unable to generate dcerpc_binding struct\n");
+		return False;
+	}
+
+	r.in.entries[0].tower = talloc_p(mem_ctx, struct epm_twr_t);
+
+	status = dcerpc_binding_build_tower(mem_ctx, &bd, &r.in.entries[0].tower->tower);
+	if (NT_STATUS_IS_ERR(status)) {
+		printf("Unable to build tower from binding struct\n");
+		return False;
+	}
+	
+	r.in.replace = 0;
+
+	status = dcerpc_epm_Insert(p, mem_ctx, &r);
+	if (NT_STATUS_IS_ERR(status)) {
+		printf("Insert failed - %s\n", nt_errstr(status));
+		return False;
+	}
+
+	if (r.out.result != 0) {
+		printf("Insert failed - %d\n", r.out.result);
+		return False;
+	}
+
+	if (!test_Delete(p, mem_ctx, r.in.entries)) {
+		return False; 
+	}
+
+	return True;
+}
+
 static BOOL test_InqObject(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 {
 	NTSTATUS status;
@@ -308,6 +375,10 @@
 		ret = False;
 	}
 
+	if (!test_Insert(p, mem_ctx)) {
+		ret = False;
+	}
+
 	if (!test_InqObject(p, mem_ctx)) {
 		ret = False;
 	}



More information about the samba-cvs mailing list