[Samba] TDB database commands (TDB used by SAMBA)

Andrew Bartlett abartlet at samba.org
Mon Aug 17 23:03:46 UTC 2020


On Mon, 2020-08-17 at 12:36 -0700, Jeremy Allison via samba wrote:
> On Fri, Aug 14, 2020 at 08:33:33PM -0300, Suporte - KONNTROL via
> samba wrote:
> > Background:  FREEBSD 11.2 - SAMBA 4.10.15
> > 
> > Hello everyone,
> > Good evening/afternoon/morning.
> > 
> > I am trying to "reuse" the TDB database to my portal, where I want
> > to store
> > basically 3 information:
> > 
> > IP address , Name, TimeStamp - where IP would be the KEY and
> > "NAME,TIMESTAMP" would be the VALUE.
> > 
> > I am using the tdbtool to insert/store data successfully (like the
> > example
> > below)
> > 
> > tdbtool myfile.tdb store "key1" "value1,value2,value3,value4"
> > 
> > The problem is when I want to READ the information back. It brings
> > hexadecimal code in a strange format. (see below)
> > 
> > tdbtool myfile.tdb show "key1"
> > 
> > key 4 bytes
> > key1
> > data 27 bytes
> > [000] 76 61 6C 75 65 31 2C 76  61 6C 75 65 32 2C 76 61  value1,v
> > alue2,va
> > [010] 6C 75 65 33 2C 76 61 6C  75 65 34                 lue3,val
> > ue4
> > 
> > 
> > Is there any command format/syntax to change that? Unfortunately I
> > didn't
> > find ANY documentation about it, so knowing it's part of SAMBA, I
> > am
> > wondering if someone could help me on that.
> 
> No, there's no current command to change that - tdb values
> may not be printable strings I'm afraid. You could request
> an enhancement via the samba bugzilla.

My best suggestion is that there are python bindings, and probably some
in many other languages, for tdb.  If the portal is written in a
language with a binding, use that, otherwise I would write a tool that
presents exactly the desired output in python, and call that rather
than tdbtool.

Andrew Bartlett

-- 
Andrew Bartlett                       https://samba.org/~abartlet/
Authentication Developer, Samba Team  https://samba.org
Samba Developer, Catalyst IT          
https://catalyst.net.nz/services/samba






More information about the samba mailing list