summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-06-22 12:38:19 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:55 +0200
commitcda44b9e8e8f0edc111f5fa8daf6f8a9f5bf2a7f (patch)
tree0acea0c0048a46ce80ccaa491a1496513da0b351 /source3
parenta6f58b76cccc95f2ac69f5e215fd3a0c9d639c9e (diff)
downloadsamba-cda44b9e8e8f0edc111f5fa8daf6f8a9f5bf2a7f.tar.gz
samba-cda44b9e8e8f0edc111f5fa8daf6f8a9f5bf2a7f.tar.bz2
samba-cda44b9e8e8f0edc111f5fa8daf6f8a9f5bf2a7f.zip
s3:idmap_rid: use ranges from idmap_domain struct in idmap_rid_id_to_sid()
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/idmap_rid.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source3/winbindd/idmap_rid.c b/source3/winbindd/idmap_rid.c
index 6d57ace498..b09f2e9453 100644
--- a/source3/winbindd/idmap_rid.c
+++ b/source3/winbindd/idmap_rid.c
@@ -106,22 +106,26 @@ failed:
return ret;
}
-static NTSTATUS idmap_rid_id_to_sid(struct idmap_rid_context *ctx, struct id_map *map)
+static NTSTATUS idmap_rid_id_to_sid(struct idmap_domain *dom, struct id_map *map)
{
- struct winbindd_domain *domain;
+ struct winbindd_domain *domain;
+ struct idmap_rid_context *ctx;
+
+ ctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
/* apply filters before checking */
- if ((map->xid.id < ctx->low_id) || (map->xid.id > ctx->high_id)) {
+ if (!idmap_unix_id_is_in_range(map->xid.id, dom)) {
DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n",
- map->xid.id, ctx->low_id, ctx->high_id));
+ map->xid.id, dom->low_id, dom->high_id));
return NT_STATUS_NONE_MAPPED;
}
- if ( (domain = find_domain_from_name_noinit(ctx->domain_name)) == NULL ) {
+ domain = find_domain_from_name_noinit(dom->name);
+ if (domain == NULL ) {
return NT_STATUS_NO_SUCH_DOMAIN;
}
-
- sid_compose(map->sid, &domain->sid, map->xid.id - ctx->low_id + ctx->base_rid);
+
+ sid_compose(map->sid, &domain->sid, map->xid.id - dom->low_id + ctx->base_rid);
/* We **really** should have some way of validating
the SID exists and is the correct type here. But
@@ -167,7 +171,6 @@ static NTSTATUS idmap_rid_sid_to_id(struct idmap_rid_context *ctx, struct id_map
static NTSTATUS idmap_rid_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids)
{
- struct idmap_rid_context *ridctx;
NTSTATUS ret;
int i;
@@ -175,12 +178,10 @@ static NTSTATUS idmap_rid_unixids_to_sids(struct idmap_domain *dom, struct id_ma
for (i = 0; ids[i]; i++) {
ids[i]->status = ID_UNKNOWN;
}
-
- ridctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
for (i = 0; ids[i]; i++) {
- ret = idmap_rid_id_to_sid(ridctx, ids[i]);
+ ret = idmap_rid_id_to_sid(dom, ids[i]);
if (( ! NT_STATUS_IS_OK(ret)) &&
( ! NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED))) {