diff options
author | Rafal Szczesniak <mimir@samba.org> | 2005-07-21 22:33:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:54 -0500 |
commit | 6366a8dc2df6e72f162bb44d93b4d329ba8008a7 (patch) | |
tree | 8079c6b28d1863aeda500eaa6863219df489ae3f /source4/torture | |
parent | 6868795a3905d390f3c33aea1aa55dd2937d5f13 (diff) | |
download | samba-6366a8dc2df6e72f162bb44d93b4d329ba8008a7.tar.gz samba-6366a8dc2df6e72f162bb44d93b4d329ba8008a7.tar.bz2 samba-6366a8dc2df6e72f162bb44d93b4d329ba8008a7.zip |
r8693: Test code for usermod routine.
rafal
(This used to be commit 19f5ea9c9c2a46c110e5946605432116cb2ad7b3)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/libnet/userman.c | 71 | ||||
-rw-r--r-- | source4/torture/torture.c | 1 |
2 files changed, 72 insertions, 0 deletions
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index a5049691ed..0b499a2bd9 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -271,6 +271,25 @@ static BOOL test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } +static BOOL test_usermod(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle, const char *username) +{ + NTSTATUS status; + struct libnet_rpc_usermod user; + + user.in.domain_handle = *handle; + user.in.username = username; + + status = libnet_rpc_usermod(p, mem_ctx, &user); + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to call sync libnet_rpc_usermod - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + + BOOL torture_useradd(void) { NTSTATUS status; @@ -376,3 +395,55 @@ done: talloc_free(mem_ctx); return ret; } + + +BOOL torture_usermod(void) +{ + NTSTATUS status; + const char *binding; + struct dcerpc_pipe *p; + struct policy_handle h; + struct lsa_String domain_name; + const char *name = TEST_USERNAME; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + + mem_ctx = talloc_init("test_userdel"); + binding = lp_parm_string(-1, "torture", "binding"); + + status = torture_rpc_connection(mem_ctx, + &p, + DCERPC_SAMR_NAME, + DCERPC_SAMR_UUID, + DCERPC_SAMR_VERSION); + + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + domain_name.string = lp_workgroup(); + + if (!test_opendomain(p, mem_ctx, &h, &domain_name)) { + ret = False; + goto done; + } + + if (!test_createuser(p, mem_ctx, &h, name)) { + ret = False; + goto done; + } + + if (!test_usermod(p, mem_ctx, &h, name)) { + ret = False; + goto done; + } + + if (!test_cleanup(p, mem_ctx, &h, name)) { + ret = False; + goto done; + } + +done: + talloc_free(mem_ctx); + return ret; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 55ad143373..9d5638b255 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2338,6 +2338,7 @@ static struct { {"NET-USERINFO", torture_userinfo, 0}, {"NET-USERADD", torture_useradd, 0}, {"NET-USERDEL", torture_userdel, 0}, + {"NET-USERMOD", torture_usermod, 0}, {"NET-DOMOPEN", torture_domainopen, 0}, {"NET-API-LOOKUP", torture_lookup, 0}, {"NET-API-LOOKUPHOST", torture_lookup_host, 0}, |