s3:idmap_tdb2: use filter from idmap_domain rather than from idmap_tdb2_context
authorMichael Adam <obnox@samba.org>
Wed, 16 Jun 2010 15:12:44 +0000 (17:12 +0200)
committerMichael Adam <obnox@samba.org>
Sat, 14 Aug 2010 00:10:43 +0000 (02:10 +0200)
source3/winbindd/idmap_tdb2.c

index 5f813580fe1af67fee62e5dc7c50765f0b98b41f..6520e9951b60826fa079a4de2c0d612abf626adf 100644 (file)
@@ -551,10 +551,9 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_domain *dom, struct id_map *ma
        ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
 
        /* apply filters before checking */
-       if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
-           (ctx->filter_high_id && (map->xid.id > ctx->filter_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->filter_low_id, ctx->filter_high_id));
+                               map->xid.id, dom->low_id, dom->high_id));
                return NT_STATUS_NONE_MAPPED;
        }
 
@@ -680,14 +679,10 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_domain *dom, struct id_map *ma
                }
 
                /* apply filters before returning result */
-               if ((ctx->filter_low_id
-                    && (map->xid.id < ctx->filter_low_id)) ||
-                   (ctx->filter_high_id
-                    && (map->xid.id > ctx->filter_high_id))) {
+               if (!idmap_unix_id_is_in_range(map->xid.id, dom)) {
                        DEBUG(5, ("Script returned id (%u) out of range "
                                  "(%u - %u). Filtered!\n",
-                                 map->xid.id,
-                                 ctx->filter_low_id, ctx->filter_high_id));
+                                 map->xid.id, dom->low_id, dom->high_id));
                        ret = NT_STATUS_NONE_MAPPED;
                        goto done;
                }
@@ -728,10 +723,9 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_domain *dom, struct id_map *ma
        }
 
        /* apply filters before returning result */
-       if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) ||
-           (ctx->filter_high_id && (map->xid.id > ctx->filter_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->filter_low_id, ctx->filter_high_id));
+                               map->xid.id, dom->low_id, dom->high_id));
                ret = NT_STATUS_NONE_MAPPED;
        }