diff options
author | Michael Adam <obnox@samba.org> | 2013-04-25 19:47:00 +0200 |
---|---|---|
committer | Christian Ambach <ambi@samba.org> | 2013-05-06 16:33:39 +0200 |
commit | 30a27ba428f346ff2fd56f9727ce0f1fb18a5a41 (patch) | |
tree | 394d3d305760563ca25728fb04e6ee709557ac5e /source3/libsmb/libsmb_file.c | |
parent | a0ea6c2536b6b07f2fee799518b5f84da36e53ba (diff) | |
download | samba-30a27ba428f346ff2fd56f9727ce0f1fb18a5a41.tar.gz samba-30a27ba428f346ff2fd56f9727ce0f1fb18a5a41.tar.bz2 samba-30a27ba428f346ff2fd56f9727ce0f1fb18a5a41.zip |
s3:idmap:autorid: make calculation in idmap_autorid_sid_to_id much more obvious
This is my attempt to make the sid->unix-id calculation much more obvious.
Especially with the introduction of the multi-range support an the originally
named "multiplier", the calculation
id = low_id + range_size * domain_number + rid - range_size * multiplier
was rather opaque to me.
What really happens here is this:
The rid is split into a reduced_rid part that is < rangesize and
a multiple of rangesize. This is given by the formula
rid = rid % range_size + (rid / range_size) * range_size
We define
reduced_rid := rid % range_size
and
domain_range_index := rid / range_size ( == the original multiplier)
and the original formula is equivalent to:
id = reduced_rid + low_id + range_number * range_size;
and reads
id = reduced_rid + range_minvalue
if we set range_minvalue := low_id + range_number * range_size.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
Diffstat (limited to 'source3/libsmb/libsmb_file.c')
0 files changed, 0 insertions, 0 deletions