diff options
author | Rafal Szczesniak <mimir@samba.org> | 2006-08-27 20:39:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:49 -0500 |
commit | e1e0645d18490c0e10e03bfde4396388c5e9b297 (patch) | |
tree | da80d3a7639c3c003466e13bc5e3239a684d535a | |
parent | 1e46d3a46a2556eb3c8704d344f51a013059ba97 (diff) | |
download | samba-e1e0645d18490c0e10e03bfde4396388c5e9b297.tar.gz samba-e1e0645d18490c0e10e03bfde4396388c5e9b297.tar.bz2 samba-e1e0645d18490c0e10e03bfde4396388c5e9b297.zip |
r17857: A couple of new tests.
rafal
(This used to be commit 6db488cc6e29704ae2ae17b2875a76ded5d86b88)
-rw-r--r-- | source4/torture/libnet/libnet.c | 4 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_lookup.c | 25 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 61 |
3 files changed, 90 insertions, 0 deletions
diff --git a/source4/torture/libnet/libnet.c b/source4/torture/libnet/libnet.c index 588b06bafa..2d4699c024 100644 --- a/source4/torture/libnet/libnet.c +++ b/source4/torture/libnet/libnet.c @@ -32,9 +32,11 @@ NTSTATUS torture_net_init(void) register_torture_op("NET-API-LOOKUP", torture_lookup); register_torture_op("NET-API-LOOKUPHOST", torture_lookup_host); register_torture_op("NET-API-LOOKUPPDC", torture_lookup_pdc); + register_torture_op("NET-API-LOOKUPNAME", torture_lookup_sam_name); register_torture_op("NET-API-CREATEUSER", torture_createuser); register_torture_op("NET-API-DELETEUSER", torture_deleteuser); register_torture_op("NET-API-MODIFYUSER", torture_modifyuser); + register_torture_op("NET-API-USERINFO", torture_userinfo_api); register_torture_op("NET-API-RPCCONN-BIND", torture_rpc_connect_binding); register_torture_op("NET-API-RPCCONN-SRV", torture_rpc_connect_srv); register_torture_op("NET-API-RPCCONN-PDC", torture_rpc_connect_pdc); @@ -42,6 +44,8 @@ NTSTATUS torture_net_init(void) register_torture_op("NET-API-RPCCONN-DCINFO", torture_rpc_connect_dc_info); register_torture_op("NET-API-LISTSHARES", torture_listshares); register_torture_op("NET-API-DELSHARE", torture_delshare); + register_torture_op("NET-API-DOMOPENLSA", torture_domain_open_lsa); + register_torture_op("NET-API-DOMCLOSELSA", torture_domain_close_lsa); return NT_STATUS_OK; } diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index ac2f19b983..eb03eb5eca 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -165,3 +165,28 @@ done: talloc_free(mem_ctx); return ret; } + + +BOOL torture_lookup_sam_name(struct torture_context *torture) +{ + NTSTATUS status; + TALLOC_CTX *mem_ctx; + struct libnet_context *ctx; + struct libnet_LookupName r; + + ctx = libnet_context_init(NULL); + ctx->cred = cmdline_credentials; + + mem_ctx = talloc_init("torture lookup sam name"); + if (mem_ctx == NULL) return False; + + r.in.name = "Administrator"; + r.in.domain_name = lp_workgroup(); + + status = libnet_LookupName(ctx, mem_ctx, &r); + + talloc_free(mem_ctx); + talloc_free(ctx); + + return True; +} diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index fca73a2977..085796130f 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -509,3 +509,64 @@ done: talloc_free(mem_ctx); return ret; } + + +BOOL torture_userinfo_api(struct torture_context *torture) +{ + const char *name = TEST_USERNAME; + const char *binding; + BOOL ret = True; + NTSTATUS status; + TALLOC_CTX *mem_ctx, *prep_mem_ctx; + struct libnet_context *ctx; + struct dcerpc_pipe *p; + struct policy_handle h; + struct lsa_String domain_name; + struct libnet_UserInfo req; + + prep_mem_ctx = talloc_init("torture user info"); + binding = lp_parm_string(-1, "torture", "binding"); + + ctx = libnet_context_init(NULL); + ctx->cred = cmdline_credentials; + + status = torture_rpc_connection(prep_mem_ctx, + &p, + &dcerpc_table_samr); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + domain_name.string = lp_workgroup(); + if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { + ret = False; + goto done; + } + + if (!test_createuser(p, prep_mem_ctx, &h, name)) { + ret = False; + goto done; + } + + ZERO_STRUCT(req); + + req.in.domain_name = domain_name.string; + req.in.user_name = name; + + status = libnet_UserInfo(ctx, mem_ctx, &req); + if (!NT_STATUS_IS_OK(status)) { + printf("libnet_UserInfo call failed: %s\n", nt_errstr(status)); + ret = False; + } + + if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) { + printf("cleanup failed\n"); + ret = False; + goto done; + } + +done: + talloc_free(ctx); + talloc_free(mem_ctx); + return ret; +} |