summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-01-09 14:24:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:35 -0500
commit9ca6e1976772c2f8661c1a4879dc2d38a073f7cb (patch)
tree303c19de9d9600007cc3c308fd68de7693eef5b1
parent46a32687da249174a666d9166fccbe705c8beba0 (diff)
downloadsamba-9ca6e1976772c2f8661c1a4879dc2d38a073f7cb.tar.gz
samba-9ca6e1976772c2f8661c1a4879dc2d38a073f7cb.tar.bz2
samba-9ca6e1976772c2f8661c1a4879dc2d38a073f7cb.zip
r4621: Add torture tests for epm_Insert and epm_Delete
(This used to be commit b1ff60667038aa1e2d7c6ad2015ba33ac5a90dc6)
-rw-r--r--source4/torture/rpc/epmapper.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/source4/torture/rpc/epmapper.c b/source4/torture/rpc/epmapper.c
index b649c6d377..f6b3d9ce8f 100644
--- a/source4/torture/rpc/epmapper.c
+++ b/source4/torture/rpc/epmapper.c
@@ -270,6 +270,73 @@ static BOOL test_Lookup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
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 @@ BOOL torture_rpc_epmapper(void)
ret = False;
}
+ if (!test_Insert(p, mem_ctx)) {
+ ret = False;
+ }
+
if (!test_InqObject(p, mem_ctx)) {
ret = False;
}