Skip to content

Commit

Permalink
s3:auth small optimization in create_token_from_sid
Browse files Browse the repository at this point in the history
save some calls to lp_idmap_default_range(), calling it
once is enough

Signed-off-by: Christian Ambach <[email protected]>
Reviewed-by: Michael Adam <[email protected]>

Autobuild-User(master): Michael Adam <[email protected]>
Autobuild-Date(master): Tue Feb  5 19:14:25 CET 2013 on sn-devel-104
  • Loading branch information
der-ambi authored and obnoxxx committed Feb 5, 2013
1 parent deea99a commit 6c2d6ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source3/auth/token_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<num_gids; i++ ) {
uint32_t high, low;

/* don't pickup anything managed by Winbind */

if ( lp_idmap_default_range(&low, &high) && (gids[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);

Expand Down

0 comments on commit 6c2d6ad

Please sign in to comment.