summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-12-27 09:48:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:39 -0500
commit296c0d8eacc9f61810974f996982dfe6c93dfa01 (patch)
tree7702eafe08921806912f498b79ab0812eabde7f7 /source4/rpc_server
parentdcff66281cc7da27b06d605af90fed74076da19f (diff)
downloadsamba-296c0d8eacc9f61810974f996982dfe6c93dfa01.tar.gz
samba-296c0d8eacc9f61810974f996982dfe6c93dfa01.tar.bz2
samba-296c0d8eacc9f61810974f996982dfe6c93dfa01.zip
r4374: Follow metzes hint, change LookupRids a bit
(This used to be commit b8fa5b9419c6397a4266bfdce3a31b1e016d7faa)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 9120bfe468..6ab50fa4df 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -1069,6 +1069,8 @@ static NTSTATUS samr_LookupRids(struct dcesrv_call_state *dce_call, TALLOC_CTX *
struct samr_domain_state *d_state;
int i;
NTSTATUS status = NT_STATUS_OK;
+ struct samr_String *names;
+ uint32_t *ids;
ZERO_STRUCT(r->out.names);
ZERO_STRUCT(r->out.types);
@@ -1080,30 +1082,20 @@ static NTSTATUS samr_LookupRids(struct dcesrv_call_state *dce_call, TALLOC_CTX *
if (r->in.num_rids == 0)
return NT_STATUS_OK;
- r->out.names.names = talloc_array_p(mem_ctx, struct samr_String,
- r->in.num_rids);
- if (r->out.names.names == NULL)
- return NT_STATUS_NO_MEMORY;
+ names = talloc_array_p(mem_ctx, struct samr_String, r->in.num_rids);
+ ids = talloc_array_p(mem_ctx, uint32_t, r->in.num_rids);
- r->out.types.ids = talloc_array_p(mem_ctx, uint32_t, r->in.num_rids);
- if (r->out.types.ids == NULL)
+ if ((names == NULL) || (ids == NULL))
return NT_STATUS_NO_MEMORY;
- r->out.names.count = r->in.num_rids;
- r->out.types.count = r->in.num_rids;
-
for (i=0; i<r->in.num_rids; i++) {
struct ldb_message **res;
int count;
const char * const attrs[] = { "sAMAccountType",
"sAMAccountName", NULL };
- struct samr_String *str;
uint32_t atype;
- str = &r->out.names.names[i];
-
- ZERO_STRUCTP(str);
- r->out.types.ids[i] = 0;
+ ids[i] = SID_NAME_UNKNOWN;
count = samdb_search(d_state->sam_ctx, mem_ctx,
d_state->domain_dn, &res, attrs,
@@ -1114,8 +1106,8 @@ static NTSTATUS samr_LookupRids(struct dcesrv_call_state *dce_call, TALLOC_CTX *
continue;
}
- str->string = samdb_result_string(res[0], "sAMAccountName",
- NULL);
+ names[i].string = samdb_result_string(res[0], "sAMAccountName",
+ NULL);
atype = samdb_result_uint(res[0], "sAMAccountType", 0);
if (atype == 0) {
@@ -1123,14 +1115,20 @@ static NTSTATUS samr_LookupRids(struct dcesrv_call_state *dce_call, TALLOC_CTX *
continue;
}
- r->out.types.ids[i] = samdb_atype_map(atype);
+ ids[i] = samdb_atype_map(atype);
- if (r->out.types.ids[i] == SID_NAME_UNKNOWN) {
+ if (ids[i] == SID_NAME_UNKNOWN) {
status = STATUS_SOME_UNMAPPED;
continue;
}
}
-
+
+ r->out.names.names = names;
+ r->out.names.count = r->in.num_rids;
+
+ r->out.types.ids = ids;
+ r->out.types.count = r->in.num_rids;
+
return status;
}