diff options
-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; +} |