summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-07-23 10:27:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:58 -0500
commit64f31e424b3db792a1edb909195eb592a9460aaf (patch)
treef100ed66a70a9da9fce8c6718f4635d88c5d0669 /source4/torture
parent23924170cc1db85fecf21e0bfebf4d7b4ac42c25 (diff)
downloadsamba-64f31e424b3db792a1edb909195eb592a9460aaf.tar.gz
samba-64f31e424b3db792a1edb909195eb592a9460aaf.tar.bz2
samba-64f31e424b3db792a1edb909195eb592a9460aaf.zip
r8721: Further work on libnet_rpc_usermod function. Now it can change
both account name and full name. rafal (This used to be commit 1a779f8643c43677c62fed6ec4bfb54b08647f5b)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/userman.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c
index 0b499a2bd9..ed07cf019a 100644
--- a/source4/torture/libnet/userman.c
+++ b/source4/torture/libnet/userman.c
@@ -272,13 +272,17 @@ 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)
+ struct policy_handle *handle, const char *username,
+ struct usermod_change *change)
{
NTSTATUS status;
struct libnet_rpc_usermod user;
user.in.domain_handle = *handle;
user.in.username = username;
+ user.in.change = *change;
+
+ printf("modifying user\n");
status = libnet_rpc_usermod(p, mem_ctx, &user);
if (!NT_STATUS_IS_OK(status)) {
@@ -404,10 +408,16 @@ BOOL torture_usermod(void)
struct dcerpc_pipe *p;
struct policy_handle h;
struct lsa_String domain_name;
- const char *name = TEST_USERNAME;
+ char *name = TEST_USERNAME;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
+ int i;
+ struct usermod_change changes[] = {
+ { USERMOD_FIELD_ACCOUNT_NAME, "changed", NULL },
+ { USERMOD_FIELD_FULL_NAME, NULL, "Testing full account name" }
+ };
+
mem_ctx = talloc_init("test_userdel");
binding = lp_parm_string(-1, "torture", "binding");
@@ -433,9 +443,15 @@ BOOL torture_usermod(void)
goto done;
}
- if (!test_usermod(p, mem_ctx, &h, name)) {
- ret = False;
- goto done;
+ for (i = 0; i < (sizeof(changes)/sizeof(struct usermod_change)); i++) {
+ if (!test_usermod(p, mem_ctx, &h, name, &changes[i])) {
+ ret = False;
+ goto done;
+ }
+
+ if (changes[i].fields & USERMOD_FIELD_ACCOUNT_NAME) {
+ name = talloc_strdup(mem_ctx, changes[i].account_name);
+ }
}
if (!test_cleanup(p, mem_ctx, &h, name)) {