static bool test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { const uint16_t level = 10; NTSTATUS status; struct composite_context *c; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; user_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); user.in.level = level; /* this should be extended */ printf("Testing async libnet_rpc_userinfo (SID argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); if (!c) { printf("Failed to call sync libnet_rpc_userinfo_send\n"); return false; } status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); return false; } ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; user.in.username = TEST_USERNAME; user.in.level = level; printf("Testing async libnet_rpc_userinfo (username argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); if (!c) { printf("Failed to call sync libnet_rpc_userinfo_send\n"); return false; } status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); return false; } return true; }
static bool test_userinfo_async(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { const uint16_t level = 10; NTSTATUS status; struct composite_context *c; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; user_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); user.in.level = level; /* this should be extended */ torture_comment(tctx, "Testing async libnet_rpc_userinfo (SID argument)\n"); c = libnet_rpc_userinfo_send(mem_ctx, tctx->ev, p->binding_handle, &user, msg_handler); torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; user.in.username = user_name; user.in.level = level; torture_comment(tctx, "Testing async libnet_rpc_userinfo (username argument)\n"); c = libnet_rpc_userinfo_send(mem_ctx, tctx->ev, p->binding_handle, &user, msg_handler); torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); return true; }