Fix races, don't waste IDs in idmap_tdb.

John H Terpstra jht at samba.org
Sat Jun 21 15:41:18 GMT 2003


Andrew,

If not yet done, would you check this in please.

- John T.


On Sat, 21 Jun 2003, Andrew Bartlett wrote:

> This patch fixes some issues with idmap_tdb as raised by bug #181
>
> The idea here is to eliminate the need to *set* the 'HWM' (High Water
> Mark) in the tdb.  Instead, each caller wanting to add an item to the
> TDB uses the fact that an insert will *fail* if entry already exists.
>
> More importantly, this means that we don't need to know the value of the
> idmap uid/gid values when setting arbitrary entries, which can occur on
> an smb.conf without such values specified.
>
> Then all we need to do is loop until we get an id that will insert.
> This means that the HWM does not need to be accurate, and we can have
> IDs allocates safely above the HWM.
>
> Setting the HWM to an arbitrary value was racy in the past - now we
> don't even do it.
>
> This patch also adds paranoia in reading the tdb - both the entry, and
> it's reverse entry must be present.  This means that we don't need to
> 'clean up' after an abnormal failure (which would probably fail too),
> instead we rely on readers to ignore the half-completed entry.  The way
> this is done will allow SIDs to then allocated an ID when things are
> normal again.
>
> Andrew Bartlett
>
>

-- 
John H Terpstra
Email: jht at samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: idmap_tdb-races.patch
Type: text/x-patch
Size: 7013 bytes
Desc: 
Url : http://lists.samba.org/archive/samba-technical/attachments/20030621/c232b91e/idmap_tdb-races.bin


More information about the samba-technical mailing list