diff options
-rw-r--r-- | source4/torture/libnet/libnet.c | 1 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_group.c | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/source4/torture/libnet/libnet.c b/source4/torture/libnet/libnet.c index 0bb70df1e0..261012edae 100644 --- a/source4/torture/libnet/libnet.c +++ b/source4/torture/libnet/libnet.c @@ -43,6 +43,7 @@ NTSTATUS torture_net_init(void) 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-CREATEGROUP", torture_creategroup); 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); diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index 83aab48e90..cabccdbe66 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -349,3 +349,45 @@ done: talloc_free(mem_ctx); return ret; } + + +bool torture_creategroup(struct torture_context *torture) +{ + bool ret = true; + NTSTATUS status; + TALLOC_CTX *mem_ctx = NULL; + struct libnet_context *ctx; + struct libnet_CreateGroup req; + + mem_ctx = talloc_init("test_creategroup"); + + ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx->cred = cmdline_credentials; + + req.in.group_name = TEST_GROUPNAME; + req.in.domain_name = lp_workgroup(torture->lp_ctx); + req.out.error_string = NULL; + + status = libnet_CreateGroup(ctx, mem_ctx, &req); + if (!NT_STATUS_IS_OK(status)) { + printf("libnet_CreateGroup call failed: %s\n", nt_errstr(status)); + ret = false; + goto done; + } + + if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) { + printf("cleanup failed\n"); + ret = false; + goto done; + } + + if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) { + printf("domain close failed\n"); + ret = false; + } + +done: + talloc_free(ctx); + talloc_free(mem_ctx); + return ret; +} |