static bool test_BindingString(struct torture_context *tctx, const void *test_data) { const char *binding = test_data; struct dcerpc_binding *b, *b2; const char *s, *s2; struct epm_tower tower; TALLOC_CTX *mem_ctx = tctx; /* Parse */ torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(mem_ctx, binding, &b), "Error parsing binding string"); s = dcerpc_binding_string(mem_ctx, b); torture_assert(tctx, s != NULL, "Error converting binding back to string"); torture_assert_casestr_equal(tctx, binding, s, "Mismatch while comparing original and regenerated binding strings"); /* Generate protocol towers */ torture_assert_ntstatus_ok(tctx, dcerpc_binding_build_tower(mem_ctx, b, &tower), "Error generating protocol tower"); /* Convert back to binding and then back to string and compare */ torture_assert_ntstatus_ok(tctx, dcerpc_binding_from_tower(mem_ctx, &tower, &b2), "Error generating binding from tower for original binding"); /* Compare to a stripped down version of the binding string because * the protocol tower doesn't contain the extra option data */ b->options = NULL; b->flags = 0; s = dcerpc_binding_string(mem_ctx, b); torture_assert(tctx, s != NULL, "Error converting binding back to string for (stripped down)"); s2 = dcerpc_binding_string(mem_ctx, b2); torture_assert(tctx, s != NULL, "Error converting binding back to string"); if (is_ipaddress(b->host)) torture_assert_casestr_equal(tctx, s, s2, "Mismatch while comparing original and from protocol tower generated binding strings"); return true; }
static bool test_no_transport(struct torture_context *tctx) { const char *binding = "somehost"; struct dcerpc_binding *b; const char *s; /* Parse */ torture_assert_ntstatus_ok(tctx, dcerpc_parse_binding(tctx, binding, &b), "Error parsing binding string"); torture_assert(tctx, b->transport == NCA_UNKNOWN, "invalid transport"); s = dcerpc_binding_string(tctx, b); torture_assert(tctx, s != NULL, "Error converting binding back to string"); torture_assert_casestr_equal(tctx, binding, s, "Mismatch while comparing original and regenerated binding strings"); return true; }