diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-01 19:16:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:03:22 -0500 |
commit | 26ed05364d3172f17a0d4e1159e39a830f8a7217 (patch) | |
tree | 7b68da0f76bea0f09ba1b6618d9595d1817832ca /source4/librpc/tests | |
parent | 477ecbd4987663b0c121d77fb72bce4f318ee7bb (diff) | |
download | samba-26ed05364d3172f17a0d4e1159e39a830f8a7217.tar.gz samba-26ed05364d3172f17a0d4e1159e39a830f8a7217.tar.bz2 samba-26ed05364d3172f17a0d4e1159e39a830f8a7217.zip |
r24866: Put remainder of binding string tests in librpc/ directory.
(This used to be commit 5b78d845a4d107e6a0e77a6e57e2b0e22fc0db95)
Diffstat (limited to 'source4/librpc/tests')
-rw-r--r-- | source4/librpc/tests/binding_string.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/librpc/tests/binding_string.c b/source4/librpc/tests/binding_string.c index 18cf4dfb46..362848049b 100644 --- a/source4/librpc/tests/binding_string.c +++ b/source4/librpc/tests/binding_string.c @@ -95,6 +95,41 @@ static const char *test_strings[] = { "ncacn_unix_stream:[/tmp/epmapper,sign]", }; +static bool test_parse_check_results(struct torture_context *tctx) +{ + struct dcerpc_binding *b; + struct GUID uuid; + + torture_assert_ntstatus_ok(tctx, + GUID_from_string("308FB580-1EB2-11CA-923B-08002B1075A7", &uuid), + "parsing uuid"); + + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_np:$SERVER", &b), "parse"); + torture_assert(tctx, b->transport == NCACN_NP, "ncacn_np expected"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_ip_tcp:$SERVER", &b), "parse"); + torture_assert(tctx, b->transport == NCACN_IP_TCP, "ncacn_ip_tcp expected"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_np:$SERVER[rpcecho]", &b), "parse"); + torture_assert_str_equal(tctx, b->endpoint, "rpcecho", "endpoint"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_np:$SERVER[/pipe/rpcecho]", &b), "parse"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_np:$SERVER[/pipe/rpcecho,sign,seal]", &b), "parse"); + torture_assert(tctx, b->flags == DCERPC_SIGN+DCERPC_SEAL, "sign+seal flags"); + torture_assert_str_equal(tctx, b->endpoint, "/pipe/rpcecho", "endpoint"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_np:$SERVER[,sign]", &b), "parse"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncacn_ip_tcp:$SERVER[,sign]", &b), "parse"); + torture_assert(tctx, b->endpoint == NULL, "endpoint"); + torture_assert(tctx, b->flags == DCERPC_SIGN, "sign flag"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, "ncalrpc:", &b), "parse"); + torture_assert(tctx, b->transport == NCALRPC, "ncalrpc expected"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, + "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:$SERVER", &b), "parse"); + torture_assert(tctx, GUID_equal(&b->object.uuid, &uuid), "object uuid"); + torture_assert_int_equal(tctx, b->object.if_version, 0, "object version"); + torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, + "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:$SERVER", &b), "parse"); + + return true; +} + static bool test_no_transport(struct torture_context *tctx) { const char *binding = "somehost"; @@ -129,5 +164,7 @@ struct torture_suite *torture_local_binding_string(TALLOC_CTX *mem_ctx) torture_suite_add_simple_test(suite, "no transport", test_no_transport); + torture_suite_add_simple_test(suite, "parsing results", test_parse_check_results); + return suite; } |