From 6c2d6ada42779b1c7015ddf3cf0dc420c4558be1 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Tue, 29 Jan 2013 17:19:17 +0100 Subject: [PATCH] s3:auth small optimization in create_token_from_sid save some calls to lp_idmap_default_range(), calling it once is enough Signed-off-by: Christian Ambach Reviewed-by: Michael Adam Autobuild-User(master): Michael Adam Autobuild-Date(master): Tue Feb 5 19:14:25 CET 2013 on sn-devel-104 --- source3/auth/token_util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 33b5507744f..d86d589cc3d 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -565,6 +565,8 @@ static NTSTATUS create_token_from_sid(TALLOC_CTX *mem_ctx, uint32_t num_group_sids; uint32_t num_gids; uint32_t i; + uint32_t high, low; + bool range_ok; if (sid_check_is_in_our_sam(user_sid)) { bool ret; @@ -757,13 +759,13 @@ static NTSTATUS create_token_from_sid(TALLOC_CTX *mem_ctx, to 'valid user = "Domain Admins"'. --jerry */ num_gids = num_group_sids; + range_ok = lp_idmap_default_range(&low, &high); for ( i=0; i= low) && (gids[i] <= high) ) + if (range_ok && (gids[i] >= low) && (gids[i] <= high)) { continue; + } gid_to_unix_groups_sid(gids[i], &unix_group_sid); -- 2.11.4.GIT