summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-19 04:13:39 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-19 04:13:39 +0000
commit98e66d04491f5d1035b5164027658e638fec8629 (patch)
treec951658e7174a2c975ef5a6829049ae0497a8213
parentdb22c0c5f94ecc12339efbd3950fe1c5648fde76 (diff)
downloadsamba-98e66d04491f5d1035b5164027658e638fec8629.tar.gz
samba-98e66d04491f5d1035b5164027658e638fec8629.tar.bz2
samba-98e66d04491f5d1035b5164027658e638fec8629.zip
fixed the AddAliasMem test code
(This used to be commit abe7ffcece5fcb75b0cf5633dd5871fa3e3c1723)
-rw-r--r--source4/librpc/ndr/ndr_sec.c23
-rw-r--r--source4/torture/rpc/samr.c34
2 files changed, 44 insertions, 13 deletions
diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c
index 1a8d355149..a3be697c49 100644
--- a/source4/librpc/ndr/ndr_sec.c
+++ b/source4/librpc/ndr/ndr_sec.c
@@ -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;
+}
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 9f50d0ff06..e5e4493480 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -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");
- r.in.handle = alias_handle;
+ sid = dom_sid_add_rid(mem_ctx, domain_sid, 512);
- return True;
+ printf("testing AddAliasMem\n");
+ r.in.handle = alias_handle;
+ 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;
}