summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/libnet/libnet.c1
-rw-r--r--source4/torture/libnet/libnet_user.c58
2 files changed, 58 insertions, 1 deletions
diff --git a/source4/torture/libnet/libnet.c b/source4/torture/libnet/libnet.c
index 85708e492e..588b06bafa 100644
--- a/source4/torture/libnet/libnet.c
+++ b/source4/torture/libnet/libnet.c
@@ -34,6 +34,7 @@ NTSTATUS torture_net_init(void)
register_torture_op("NET-API-LOOKUPPDC", torture_lookup_pdc);
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-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);
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index 244d6c16ca..4f1de6ed40 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -27,7 +27,8 @@
#include "torture/rpc/rpc.h"
-#define TEST_USERNAME "libnetusertest"
+#define TEST_USERNAME "libnetusertest"
+#define TEST_CHANGEDUSERNAME "newlibnetusertest"
static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
@@ -289,3 +290,58 @@ done:
talloc_free(mem_ctx);
return ret;
}
+
+
+BOOL torture_modifyuser(struct torture_context *torture)
+{
+ NTSTATUS status;
+ const char *binding;
+ struct dcerpc_pipe *p;
+ TALLOC_CTX *prep_mem_ctx, *mem_ctx;
+ struct policy_handle h;
+ struct lsa_String domain_name;
+ const char *name = TEST_USERNAME;
+ struct libnet_context *ctx;
+ struct libnet_ModifyUser req;
+ BOOL ret = True;
+
+ prep_mem_ctx = talloc_init("prepare test_deleteuser");
+ 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;
+ }
+
+ mem_ctx = talloc_init("test_modifyuser");
+
+ req.in.user_name = TEST_USERNAME;
+ req.in.domain_name = lp_workgroup();
+
+ status = libnet_ModifyUser(ctx, mem_ctx, &req);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status));
+ return False;
+ }
+
+done:
+ talloc_free(prep_mem_ctx);
+ talloc_free(mem_ctx);
+ return ret;
+}