mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r26530: Add NET-API-GROUPLIST test.
(This used to be commit 73566f520c
)
This commit is contained in:
parent
131c40a421
commit
b8313b19fb
@ -42,6 +42,7 @@ NTSTATUS torture_net_init(void)
|
||||
torture_suite_add_simple_test(suite, "API-USERINFO", torture_userinfo_api);
|
||||
torture_suite_add_simple_test(suite, "API-USERLIST", torture_userlist);
|
||||
torture_suite_add_simple_test(suite, "API-GROUPINFO", torture_groupinfo_api);
|
||||
torture_suite_add_simple_test(suite, "API-GROUPLIST", torture_grouplist);
|
||||
torture_suite_add_simple_test(suite, "API-RPCCONN-BIND", torture_rpc_connect_binding);
|
||||
torture_suite_add_simple_test(suite, "API-RPCCONN-SRV", torture_rpc_connect_srv);
|
||||
torture_suite_add_simple_test(suite, "API-RPCCONN-PDC", torture_rpc_connect_pdc);
|
||||
|
@ -202,6 +202,25 @@ static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
|
||||
static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *domain_handle)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct lsa_Close r;
|
||||
|
||||
r.in.handle = domain_handle;
|
||||
r.out.handle = domain_handle;
|
||||
|
||||
status = dcerpc_lsa_Close(p, mem_ctx, &r);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("Close lsa domain failed - %s\n", nt_errstr(status));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool torture_groupinfo_api(struct torture_context *torture)
|
||||
{
|
||||
const char *name = TEST_GROUPNAME;
|
||||
@ -269,3 +288,64 @@ done:
|
||||
talloc_free(mem_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool torture_grouplist(struct torture_context *torture)
|
||||
{
|
||||
bool ret = true;
|
||||
NTSTATUS status;
|
||||
TALLOC_CTX *mem_ctx = NULL;
|
||||
struct libnet_context *ctx;
|
||||
struct lsa_String domain_name;
|
||||
struct libnet_GroupList req;
|
||||
int i;
|
||||
|
||||
ctx = libnet_context_init(NULL, torture->lp_ctx);
|
||||
ctx->cred = cmdline_credentials;
|
||||
|
||||
domain_name.string = lp_workgroup(torture->lp_ctx);
|
||||
mem_ctx = talloc_init("torture group list");
|
||||
|
||||
ZERO_STRUCT(req);
|
||||
|
||||
printf("listing group accounts:\n");
|
||||
|
||||
do {
|
||||
req.in.domain_name = domain_name.string;
|
||||
req.in.page_size = 128;
|
||||
req.in.resume_index = req.out.resume_index;
|
||||
|
||||
status = libnet_GroupList(ctx, mem_ctx, &req);
|
||||
if (!NT_STATUS_IS_OK(status) &&
|
||||
!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) break;
|
||||
|
||||
for (i = 0; i < req.out.count; i++) {
|
||||
printf("\tgroup: %s, sid=%s\n",
|
||||
req.out.groups[i].groupname, req.out.groups[i].sid);
|
||||
}
|
||||
|
||||
} while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
|
||||
|
||||
if (!(NT_STATUS_IS_OK(status) ||
|
||||
NT_STATUS_EQUAL(status, NT_STATUS_NO_MORE_ENTRIES))) {
|
||||
printf("libnet_GroupList call failed: %s\n", nt_errstr(status));
|
||||
ret = false;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
|
||||
printf("domain close failed\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (!test_lsa_close(ctx->lsa.pipe, mem_ctx, &ctx->lsa.handle)) {
|
||||
printf("lsa domain close failed\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
talloc_free(ctx);
|
||||
|
||||
done:
|
||||
talloc_free(mem_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user