1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

r17857: A couple of new tests.

rafal
This commit is contained in:
Rafal Szczesniak 2006-08-27 20:39:50 +00:00 committed by Gerald (Jerry) Carter
parent 4a932255a0
commit 6db488cc6e
3 changed files with 90 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}