[Samba4] ldb_map: mapped vs. fallback db

Jelmer Vernooij jelmer at samba.org
Tue Jun 20 10:39:16 GMT 2006

Hi Martin,

Sorry it took a few days to get back to you.

On Thu, 2006-06-15 at 15:15 +0200, Martin Kühl wrote:
> When mapping an `add' request, the module tries to be smart about
> objectClass handling of the mapped database:  When an attribute should
> be mapped, it is only added to the mapped message if this is valid
> with that messages objectClasses.  Otherwise the attribute is added to
> the fallback message.
> There is, however, no such handling of objectClass constraints for any
> other requests, which, I think, could lead to a situation where
> `modify' requests fail because the attribute they modify is supposed
> to be mapped but was added to the fallback db instead.
Yes, that's definitely something that should be checked, if it's not
done yet.

> For a solution, wouldn't it make sense to skip the smart objectClass
> handling and just try to add all mapped attributes to the mapped db?
> If there were problems with the defined mappings this request should
> fail, giving an earlier indication of and possibly better error
> message about the problem.
Yes, but what if there are multiple objectClasses ? Are you simply going
to try all permutations of the attributes until one of them succeeds?

> For most requests, the functions `map_find_attr_*' are used to find
> *one* mapping for a given attribute, but for `add' and `modify'
> requests, the available attribute maps are looped over and every
> matching mapping is considered and applied.
This is for usability sake. Writing separate generators for each
attribute is troublesome, since most mappings are simple renames. Also,
mappings generated using generators can't be used in searches easily.

> In `modify' requests, when the fallback request fails it is turned
> into an `add' request (around line 1270), but nothing like this is
> done for the mapped request.  As far as I understood Jelmer, records
> aren't required to be present in the mapped database but in the
> fallback database, so shouldn't this be the other way round?
Yes, it should indeed be the other way around. It should also be made
sure (then) that the fallback record is *always* added.

Extending the testsuite for ldb_map would probably help the catch a lot
of these corner cases. See testprogs for a simple testcase.



Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20060620/24078ed3/attachment.bin

More information about the samba-technical mailing list