From 0e71bf8148684bbdb2a89f7099b59edc157c2f52 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 21 Sep 2004 03:51:38 +0000 Subject: r2458: Rename policy handle parameters for the SAMR pipe. Parameters now have the handle type implied by the parameter name. There are four types of handle: connect, domain, user and group handles. The various samr_Connect functions return a connect handle, and the samr_OpenFoo functions return a foo handle. There is one exception - the samr_{Get,Set}Security function can take any type of handle. Fix up all C callers. (This used to be commit 32f0f3154a8eb63de83145cbc8806b8906ccdc3e) --- source4/torture/rpc/autoidl.c | 2 +- source4/torture/rpc/samr.c | 228 ++++++++++++++++++++--------------------- source4/torture/rpc/svcctl.c | 1 - source4/torture/rpc/testjoin.c | 36 +++---- 4 files changed, 133 insertions(+), 134 deletions(-) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 1c164af333..d05390cb5a 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -34,7 +34,7 @@ static BOOL get_policy_handle(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.system_name = 0; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.handle = handle; + r.out.connect_handle = handle; status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index cf44142d2d..4b335a19aa 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -72,7 +72,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return True; } - r.in.handle = handle; + r.in.connect_handle = handle; printf("testing samr_Shutdown\n"); @@ -169,13 +169,13 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, union samr_UserInfo u; BOOL ret = True; - s.in.handle = handle; + s.in.user_handle = handle; s.in.info = &u; - s2.in.handle = handle; + s2.in.user_handle = handle; s2.in.info = &u; - q.in.handle = handle; + q.in.user_handle = handle; q.out.info = &u; q0 = q; @@ -349,7 +349,7 @@ static BOOL test_SetUserPass(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, DATA_BLOB session_key; char *newpass = samr_rand_pass(mem_ctx); - s.in.handle = handle; + s.in.user_handle = handle; s.in.info = &u; s.in.level = 24; @@ -391,7 +391,7 @@ static BOOL test_SetUserPass_23(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, DATA_BLOB session_key; char *newpass = samr_rand_pass(mem_ctx); - s.in.handle = handle; + s.in.user_handle = handle; s.in.info = &u; s.in.level = 23; @@ -438,7 +438,7 @@ static BOOL test_SetUserPassEx(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, char *newpass = samr_rand_pass(mem_ctx); struct MD5Context ctx; - s.in.handle = handle; + s.in.user_handle = handle; s.in.info = &u; s.in.level = 26; @@ -489,7 +489,7 @@ static BOOL test_SetUserPass_25(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, char *newpass = samr_rand_pass(mem_ctx); struct MD5Context ctx; - s.in.handle = handle; + s.in.user_handle = handle; s.in.info = &u; s.in.level = 25; @@ -547,7 +547,7 @@ static BOOL test_SetAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0;iname); @@ -1417,10 +1417,10 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, init_samr_Name(&name, TEST_ACCOUNT_NAME); - r.in.handle = domain_handle; + r.in.domain_handle = domain_handle; r.in.account_name = &name; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.acct_handle = user_handle; + r.out.user_handle = user_handle; r.out.rid = &rid; printf("Testing CreateUser(%s)\n", r.in.account_name->name); @@ -1444,7 +1444,7 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } - q.in.handle = user_handle; + q.in.user_handle = user_handle; q.in.level = 16; status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); @@ -1505,8 +1505,8 @@ static BOOL test_DeleteUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing DeleteUser\n"); - d.in.handle = user_handle; - d.out.handle = user_handle; + d.in.user_handle = user_handle; + d.out.user_handle = user_handle; status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { @@ -1524,7 +1524,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_CreateUser2 r; struct samr_QueryUserInfo q; struct samr_DeleteUser d; - struct policy_handle acct_handle; + struct policy_handle user_handle; uint32_t rid; struct samr_Name name; BOOL ret = True; @@ -1558,11 +1558,11 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, init_samr_Name(&name, account_types[i].account_name); - r.in.handle = handle; + r.in.domain_handle = handle; r.in.account_name = &name; r.in.acct_flags = acct_flags; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.acct_handle = &acct_handle; + r.out.user_handle = &user_handle; r.out.access_granted = &access_granted; r.out.rid = &rid; @@ -1588,7 +1588,7 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (NT_STATUS_IS_OK(status)) { - q.in.handle = &acct_handle; + q.in.user_handle = &user_handle; q.in.level = 16; status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &q); @@ -1605,14 +1605,14 @@ static BOOL test_CreateUser2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } } - if (!test_user_ops(p, mem_ctx, &acct_handle)) { + if (!test_user_ops(p, mem_ctx, &user_handle)) { ret = False; } printf("Testing DeleteUser (createuser2 test)\n"); - d.in.handle = &acct_handle; - d.out.handle = &acct_handle; + d.in.user_handle = &user_handle; + d.out.user_handle = &user_handle; status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { @@ -1637,7 +1637,7 @@ static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, for (i=0;icount; n.in.names = talloc(mem_ctx, r.out.sam->count * sizeof(struct samr_Name)); for (i=0;icount;i++) { @@ -1975,7 +1975,7 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing LookupRids\n"); - lr.in.handle = handle; + lr.in.domain_handle = handle; lr.in.num_rids = r.out.sam->count; lr.in.rids = talloc(mem_ctx, r.out.sam->count * sizeof(uint32_t)); for (i=0;icount;i++) { @@ -2010,7 +2010,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct printf("Testing EnumDomainUsers_async\n"); - r.in.handle = handle; + r.in.domain_handle = handle; r.in.resume_handle = &resume_handle; r.in.acct_flags = 0; r.in.max_size = (uint32_t)-1; @@ -2045,7 +2045,7 @@ static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing EnumDomainGroups\n"); - r.in.handle = handle; + r.in.domain_handle = handle; r.in.resume_handle = &resume_handle; r.in.max_size = (uint32_t)-1; r.out.resume_handle = &resume_handle; @@ -2080,7 +2080,7 @@ static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing EnumDomainAliases\n"); - r.in.handle = handle; + r.in.domain_handle = handle; r.in.resume_handle = &resume_handle; r.in.account_flags = (uint32_t)-1; r.out.resume_handle = &resume_handle; @@ -2117,7 +2117,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m for (i=0;iname); /* check for correct error codes */ - r.in.handle = handle; + r.in.connect_handle = handle; r.in.domain = &n2; n2.name = NULL; @@ -2875,7 +2875,7 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } - r.in.handle = handle; + r.in.connect_handle = handle; r.in.domain = domain; status = dcerpc_samr_LookupDomain(p, mem_ctx, &r); @@ -2905,7 +2905,7 @@ static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, int i; BOOL ret = True; - r.in.handle = handle; + r.in.connect_handle = handle; r.in.resume_handle = &resume_handle; r.in.buf_size = (uint32_t)-1; r.out.resume_handle = &resume_handle; @@ -2953,7 +2953,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.system_name = 0; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.handle = handle; + r.out.connect_handle = handle; status = dcerpc_samr_Connect(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -2965,7 +2965,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r2.in.system_name = NULL; r2.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r2.out.handle = handle; + r2.out.connect_handle = handle; status = dcerpc_samr_Connect2(p, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { @@ -2978,7 +2978,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r3.in.system_name = NULL; r3.in.unknown = 0; r3.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r3.out.handle = handle; + r3.out.connect_handle = handle; status = dcerpc_samr_Connect3(p, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { @@ -2991,7 +2991,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r4.in.system_name = ""; r4.in.unknown = 0; r4.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r4.out.handle = handle; + r4.out.connect_handle = handle; status = dcerpc_samr_Connect4(p, mem_ctx, &r4); if (!NT_STATUS_IS_OK(status)) { @@ -3009,7 +3009,7 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r5.in.level = 1; r5.in.info = &info; r5.out.info = &info; - r5.out.handle = handle; + r5.out.connect_handle = handle; status = dcerpc_samr_Connect5(p, mem_ctx, &r5); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c index 1467aeaad8..6fd80f5fa7 100644 --- a/source4/torture/rpc/svcctl.c +++ b/source4/torture/rpc/svcctl.c @@ -28,7 +28,6 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; uint32 resume_handle = 0; struct ENUM_SERVICE_STATUS *service = NULL; - uint32 needed, sr; r.in.handle = h; r.in.type = SERVICE_TYPE_WIN32; diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 32ea6c5ce4..9cae85b658 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -31,7 +31,7 @@ struct test_join { TALLOC_CTX *mem_ctx; struct dcerpc_pipe *p; const char *machine_password; - struct policy_handle acct_handle; + struct policy_handle user_handle; }; @@ -40,7 +40,7 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct samr_DeleteUser d; - struct policy_handle acct_handle; + struct policy_handle user_handle; uint32_t rid; struct samr_LookupNames n; struct samr_Name sname; @@ -48,7 +48,7 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, sname.name = name; - n.in.handle = handle; + n.in.domain_handle = handle; n.in.num_names = 1; n.in.names = &sname; @@ -59,10 +59,10 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return status; } - r.in.handle = handle; + r.in.domain_handle = handle; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; r.in.rid = rid; - r.out.acct_handle = &acct_handle; + r.out.user_handle = &user_handle; status = dcerpc_samr_OpenUser(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { @@ -70,8 +70,8 @@ static NTSTATUS DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return status; } - d.in.handle = &acct_handle; - d.out.handle = &acct_handle; + d.in.user_handle = &user_handle; + d.out.user_handle = &user_handle; status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { return status; @@ -135,7 +135,7 @@ void *torture_join_domain(const char *machine_name, c.in.system_name = NULL; c.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - c.out.handle = &handle; + c.out.connect_handle = &handle; status = dcerpc_samr_Connect(join->p, mem_ctx, &c); if (!NT_STATUS_IS_OK(status)) { @@ -150,7 +150,7 @@ void *torture_join_domain(const char *machine_name, printf("Opening domain %s\n", domain); name.name = domain; - l.in.handle = &handle; + l.in.connect_handle = &handle; l.in.domain = &name; status = dcerpc_samr_LookupDomain(join->p, mem_ctx, &l); @@ -159,7 +159,7 @@ void *torture_join_domain(const char *machine_name, goto failed; } - o.in.handle = &handle; + o.in.connect_handle = &handle; o.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; o.in.sid = l.out.sid; o.out.domain_handle = &domain_handle; @@ -174,11 +174,11 @@ void *torture_join_domain(const char *machine_name, again: name.name = talloc_asprintf(mem_ctx, "%s$", machine_name); - r.in.handle = &domain_handle; + r.in.domain_handle = &domain_handle; r.in.account_name = &name; r.in.acct_flags = acct_flags; r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - r.out.acct_handle = &join->acct_handle; + r.out.user_handle = &join->user_handle; r.out.access_granted = &access_granted; r.out.rid = &rid; @@ -196,7 +196,7 @@ again: goto failed; } - pwp.in.handle = &join->acct_handle; + pwp.in.user_handle = &join->user_handle; status = dcerpc_samr_GetUserPwInfo(join->p, mem_ctx, &pwp); if (NT_STATUS_IS_OK(status)) { @@ -207,7 +207,7 @@ again: printf("Setting machine account password '%s'\n", join->machine_password); - s.in.handle = &join->acct_handle; + s.in.user_handle = &join->user_handle; s.in.info = &u; s.in.level = 24; @@ -230,7 +230,7 @@ again: goto failed; } - s.in.handle = &join->acct_handle; + s.in.user_handle = &join->user_handle; s.in.info = &u; s.in.level = 16; @@ -263,9 +263,9 @@ void torture_leave_domain(void *join_ctx) struct samr_DeleteUser d; NTSTATUS status; - if (!uuid_all_zero(&join->acct_handle.uuid)) { - d.in.handle = &join->acct_handle; - d.out.handle = &join->acct_handle; + if (!uuid_all_zero(&join->user_handle.uuid)) { + d.in.user_handle = &join->user_handle; + d.out.user_handle = &join->user_handle; status = dcerpc_samr_DeleteUser(join->p, join->mem_ctx, &d); if (!NT_STATUS_IS_OK(status)) { -- cgit