[Samba] First 8 bytes of the value of keys in group_mapping.tdb

Ceron rceron at gmail.com
Thu Sep 8 16:13:09 GMT 2005

I'm trying to build a hack to add/modify a groupmap entry in the
group_mapping.tdb file by hand. What I'd like to do is to manually
perform something like this:

echo -e "open group_mapping.tdb\ninsert my_key my_value\nq" | tdbtool

In this attempt, I expect to add a new group map entry in the tdb file.

The key I'm using is the same as samba uses:  domain_group/SID. I'm
having trouble with the value of the {key,value} pair.

When I issue a dump of a functional group_mapping.tdb file, I notice
that the values of keys are the samba group names with an 8-byte
prefix. I need to know what those 8 bytes mean, so that later when I
do a "net groupmap list", the group I've inserted by hand appears

If I don't append these 8 bytes, the new group does not show up in
"net groupmap list", so I assume they are of great importance. My
assumption is that they're needed to correctly unpack the value back
from the file.

By tracking down the source code, I can reach the part in which one
packs the key,value pair using tdb_pack and I know that it builds the
value according to the type of parameter (in variable fmt) being used
(unsigned 8-bit integer, null terminated string, etc...).

I'd like to know how difficult it would be to do by hand the same
thing this pack does so that I can use the hack I mentioned, ie, a
means of building those 8 bytes to use together with the value in

Thanks in advance.

PS: I'm not sure whether this should be posted here or in the
samba-technical list.

PS2: Why am I doing this? I'm currently developing providers for samba
to be used with openpegasus. I need to handle user/group accounts in a
local way, that's why I can't use "net" to do the above. I can't link
against tdb or samba code neither cause the provider is licensed under

More information about the samba mailing list