Ejemplo n.º 1
0
static bool test_Insert(struct torture_context *tctx, 
						struct dcerpc_pipe *p)
{
	NTSTATUS status;
	struct epm_Insert r;
	struct dcerpc_binding *bd;

	r.in.num_ents = 1;

	r.in.entries = talloc_array(tctx, struct epm_entry_t, 1);
	ZERO_STRUCT(r.in.entries[0].object);
	r.in.entries[0].annotation = "smbtorture endpoint";
	status = dcerpc_parse_binding(tctx, "ncalrpc:[SMBTORTURE]", &bd);
	torture_assert_ntstatus_ok(tctx, status, 
							   "Unable to generate dcerpc_binding struct");

	r.in.entries[0].tower = talloc(tctx, struct epm_twr_t);

	status = dcerpc_binding_build_tower(tctx, bd, &r.in.entries[0].tower->tower);
	torture_assert_ntstatus_ok(tctx, status, 
							   "Unable to build tower from binding struct");
	
	r.in.replace = 0;

	status = dcerpc_epm_Insert(p, tctx, &r);
	torture_assert_ntstatus_ok(tctx, status, "Insert failed");

	torture_assert(tctx, r.out.result == 0, "Insert failed");

	if (!test_Delete(p, tctx, r.in.entries)) {
		return false; 
	}

	return true;
}
Ejemplo n.º 2
0
static bool test_Insert_noreplace(struct torture_context *tctx,
				  struct dcerpc_pipe *p)
{
	bool ok;
	NTSTATUS status;
	struct epm_Insert r;
	struct dcerpc_binding *b;
	struct dcerpc_binding_handle *h = p->binding_handle;

	torture_comment(tctx, "Testing epm_Insert(noreplace) and epm_Delete\n");

	if (torture_setting_bool(tctx, "samba4", false)) {
		torture_skip(tctx, "Skip Insert test against Samba4");
	}

	r.in.num_ents = 1;
	r.in.entries = talloc_array(tctx, struct epm_entry_t, 1);

	ZERO_STRUCT(r.in.entries[0].object);
	r.in.entries[0].annotation = "smbtorture endpoint";

	status = dcerpc_parse_binding(tctx, "ncalrpc:[SMBTORTURE]", &b);
	torture_assert_ntstatus_ok(tctx,
				   status,
				   "Unable to generate dcerpc_binding struct");

	r.in.entries[0].tower = talloc(tctx, struct epm_twr_t);

	status = dcerpc_binding_build_tower(tctx,
					    b,
					    &r.in.entries[0].tower->tower);
	torture_assert_ntstatus_ok(tctx,
				   status,
				   "Unable to build tower from binding struct");
	r.in.replace = 0;

	status = dcerpc_epm_Insert_r(h, tctx, &r);
	torture_assert_ntstatus_ok(tctx, status, "epm_Insert failed");

	torture_assert(tctx, r.out.result == 0, "epm_Insert failed");

	ok = test_Delete(tctx, h, "smbtorture", b);
	if (!ok) {
		return false;
	}

	return true;
}
Ejemplo n.º 3
0
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(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(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);
		printf("NOT CONSIDERING AS A FAILURE\n");
		return True;
	}

	if (!test_Delete(p, mem_ctx, r.in.entries)) {
		return False; 
	}

	return True;
}
Ejemplo n.º 4
0
void
TestFolder_run_tests()
{
    TestBatch *batch = TestBatch_new(79);

    TestBatch_Plan(batch);
    test_Exists(batch);
    test_Set_Path_and_Get_Path(batch);
    test_MkDir_and_Is_Directory(batch);
    test_Enclosing_Folder_and_Find_Folder(batch);
    test_List(batch);
    test_Open_Dir(batch);
    test_Open_FileHandle(batch);
    test_Open_Out(batch);
    test_Open_In(batch);
    test_Delete(batch);
    test_Delete_Tree(batch);
    test_Slurp_File(batch);

    DECREF(batch);
}
Ejemplo n.º 5
0
static bool test_Map_full(struct torture_context *tctx,
			   struct dcerpc_pipe *p)
{
	const struct ndr_syntax_id obj = {
		{ 0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8}, {0x08,0x00,0x2b,0x10,0x48,0x60} },
		2
	};
	struct dcerpc_binding_handle *h = p->binding_handle;
	const char *annotation = "SMBTORTURE";
	struct dcerpc_binding *b;
	NTSTATUS status;
	bool ok;

	status = dcerpc_parse_binding(tctx, "ncacn_ip_tcp:216.83.154.106[41768]", &b);
	torture_assert_ntstatus_ok(tctx,
				   status,
				   "Unable to generate dcerpc_binding struct");
	b->object = obj;

	ok = test_Insert(tctx, h, obj, annotation, b);
	if (!ok) {
		return false;
	}

	ok = test_Map_tcpip(tctx, h, obj);
	if (!ok) {
		return false;
	}

	ok = test_Delete(tctx, h, annotation, b);
	if (!ok) {
		return false;
	}

	return true;
}