1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

fixed the AddAliasMem test code

(This used to be commit abe7ffcece)
This commit is contained in:
Andrew Tridgell 2003-12-19 04:13:39 +00:00
parent db22c0c5f9
commit 98e66d0449
2 changed files with 44 additions and 13 deletions

View File

@ -138,3 +138,26 @@ size_t ndr_size_security_descriptor(struct security_descriptor *sd)
ret += ndr_size_security_acl(sd->sacl);
return ret;
}
/*
add a rid to a domain dom_sid to make a full dom_sid
*/
struct dom_sid *dom_sid_add_rid(TALLOC_CTX *mem_ctx,
const struct dom_sid *domain_sid,
uint32 rid)
{
struct dom_sid *sid;
sid = talloc_p(mem_ctx, struct dom_sid);
if (!sid) return NULL;
*sid = *domain_sid;
sid->sub_auths = talloc_array_p(mem_ctx, uint32, sid->num_auths+1);
if (!sid->sub_auths) {
return NULL;
}
memcpy(sid->sub_auths, domain_sid->sub_auths, sid->num_auths*sizeof(uint32));
sid->sub_auths[sid->num_auths] = rid;
sid->num_auths++;
return sid;
}

View File

@ -315,29 +315,33 @@ static BOOL test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static BOOL test_AddMemberToAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *alias_handle,
struct policy_handle *domain_handle )
struct policy_handle *domain_handle,
const struct dom_sid *domain_sid)
{
struct samr_AddAliasMem r;
struct samr_DelAliasMem d;
NTSTATUS status;
BOOL ret = True;
struct dom_sid *sid;
printf("testing ADD_ALIASMEM\n");
sid = dom_sid_add_rid(mem_ctx, domain_sid, 512);
printf("testing AddAliasMem\n");
r.in.handle = alias_handle;
return True;
r.in.sid = sid;
status = dcerpc_samr_AddAliasMem(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("ADD_ALIASMEM failed - %s\n", nt_errstr(status));
printf("AddAliasMem failed - %s\n", nt_errstr(status));
ret = False;
}
d.in.handle = alias_handle;
d.in.sid = sid;
status = dcerpc_samr_DelAliasMem(p, mem_ctx, &d);
if (!NT_STATUS_IS_OK(status)) {
printf("DEL_ALIASMEM failed - %s\n", nt_errstr(status));
printf("DelAliasMem failed - %s\n", nt_errstr(status));
ret = False;
}
@ -369,8 +373,9 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *alias_handle,
struct policy_handle *domain_handle)
struct policy_handle *alias_handle,
struct policy_handle *domain_handle,
const struct dom_sid *domain_sid)
{
BOOL ret = True;
@ -386,7 +391,8 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
if (!test_AddMemberToAlias(p, mem_ctx, alias_handle, domain_handle)) {
if (!test_AddMemberToAlias(p, mem_ctx, alias_handle,
domain_handle, domain_sid)) {
ret = False;
}
@ -501,7 +507,9 @@ static BOOL test_DeleteAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle, struct policy_handle *alias_handle)
struct policy_handle *domain_handle,
struct policy_handle *alias_handle,
const struct dom_sid *domain_sid)
{
NTSTATUS status;
struct samr_CreateDomAlias r;
@ -537,7 +545,7 @@ static BOOL test_CreateAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
if (!test_alias_ops(p, mem_ctx, alias_handle, domain_handle)) {
if (!test_alias_ops(p, mem_ctx, alias_handle, domain_handle, domain_sid)) {
ret = False;
}
@ -1136,7 +1144,7 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct dom_sid2 *sid)
struct policy_handle *handle, struct dom_sid *sid)
{
NTSTATUS status;
struct samr_OpenDomain r;
@ -1169,7 +1177,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
if (!test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle)) {
if (!test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle, sid)) {
ret = False;
}