diff options
author | Rafal Szczesniak <mimir@samba.org> | 2006-06-18 22:26:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:09:11 -0500 |
commit | 66cc0cbefc4b6648eb045c877c58ac88272f8d9b (patch) | |
tree | 07718c43fe179d569ccbe9cc02a287012aa97eda /source4/torture/libnet | |
parent | c93508edffda8b612f692be7cf7648545c21ab86 (diff) | |
download | samba-66cc0cbefc4b6648eb045c877c58ac88272f8d9b.tar.gz samba-66cc0cbefc4b6648eb045c877c58ac88272f8d9b.tar.bz2 samba-66cc0cbefc4b6648eb045c877c58ac88272f8d9b.zip |
r16342: Placeholder for a function implementing NET-API-MODIFYUSER test.
rafal
(This used to be commit 82ac02dd18e96312ca15b8f79f6f1e3c330d01de)
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r-- | source4/torture/libnet/libnet.c | 1 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 58 |
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; +} |