summaryrefslogtreecommitdiffstats
path: root/source4/librpc/tests
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-02-11 07:28:53 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:15 +0100
commit06410872a14fae40b2fc94279f42e1454d54eec3 (patch)
tree370c08e26d560fa113d3c9a54c4c4a79f60bec89 /source4/librpc/tests
parentc2e1dedb81d72a6ccc7fb695bc35bf43862316ad (diff)
downloadsamba-06410872a14fae40b2fc94279f42e1454d54eec3.tar.gz
samba-06410872a14fae40b2fc94279f42e1454d54eec3.tar.xz
samba-06410872a14fae40b2fc94279f42e1454d54eec3.zip
s4:librpc/tests: add dcerpc_binding target_hostname/target_principal tests
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4/librpc/tests')
-rw-r--r--source4/librpc/tests/binding_string.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source4/librpc/tests/binding_string.c b/source4/librpc/tests/binding_string.c
index bda92096bc7..5f072eac8e9 100644
--- a/source4/librpc/tests/binding_string.c
+++ b/source4/librpc/tests/binding_string.c
@@ -122,6 +122,7 @@ static const char *test_strings[] = {
"ncacn_unix_stream:[/tmp/epmapper]",
"ncalrpc:[IDENTIFIER]",
"ncacn_unix_stream:[/tmp/epmapper,sign]",
+ "ncacn_ip_tcp:127.0.0.1[75,target_hostname=port75.example.com,target_principal=host/port75.example.com]",
};
static bool test_parse_check_results(struct torture_context *tctx)
@@ -176,6 +177,24 @@ static bool test_parse_check_results(struct torture_context *tctx)
"192.168.1.1", "localaddress");
torture_assert_str_equal(tctx, "ncacn_ip_tcp:$SERVER[,sign,localaddress=192.168.1.1]",
dcerpc_binding_string(tctx, b), "back to string");
+ torture_assert_str_equal(tctx, dcerpc_binding_get_string_option(b, "host"),
+ "$SERVER", "host");
+ torture_assert_str_equal(tctx, dcerpc_binding_get_string_option(b, "target_hostname"),
+ "$SERVER", "target_hostname");
+
+ torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx,
+ "ncacn_ip_tcp:$HOST[,target_hostname=$HOSTNAME,target_principal=$PRINCIPAL]",
+ &b), "parse");
+ torture_assert_str_equal(tctx, dcerpc_binding_get_string_option(b, "host"),
+ "$HOST", "host");
+ torture_assert_str_equal(tctx, dcerpc_binding_get_string_option(b, "target_hostname"),
+ "$HOSTNAME", "target_hostname");
+ torture_assert_str_equal(tctx, dcerpc_binding_get_string_option(b, "target_principal"),
+ "$PRINCIPAL", "target_principal");
+ torture_assert_str_equal(tctx,
+ dcerpc_binding_string(tctx, b),
+ "ncacn_ip_tcp:$HOST[,target_hostname=$HOSTNAME,target_principal=$PRINCIPAL]",
+ "back to string");
return true;
}