diff options
author | Rafal Szczesniak <mimir@samba.org> | 2007-12-30 19:18:17 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-30 13:21:01 -0600 |
commit | 011248fbe128298611d4250419311ed6c6835765 (patch) | |
tree | c713545c772f7ce952d12d2624d868c8251474e2 /source4 | |
parent | 3a0a6e810ae7f259649e3be800942617b741242d (diff) | |
download | samba-011248fbe128298611d4250419311ed6c6835765.tar.gz samba-011248fbe128298611d4250419311ed6c6835765.tar.bz2 samba-011248fbe128298611d4250419311ed6c6835765.zip |
r26634: Add NET-API-CREATEGROUP test.
(This used to be commit 3d7a18b8231a98ac40bcfb8287b100209190beab)
Diffstat (limited to 'source4')
-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; +} |