Bug 2344 - tdbtool delete command fails
Summary: tdbtool delete command fails
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Client Tools (show other bugs)
Version: 3.0.9
Hardware: x86 Linux
: P3 normal
Target Milestone: none
Assignee: Michael Adam
QA Contact: Samba QA Contact
Depends on:
Reported: 2005-02-14 04:13 UTC by Ed van Gasteren
Modified: 2008-07-09 06:51 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ed van Gasteren 2005-02-14 04:13:41 UTC
I tried to delete an entry from my secrets.tdb with tdbtool but that didn't
work. Here's what it looks like (with all the secret and here not relevant stuff

root@lt2 /etc/samba> tdbtool
tdb> open secrets.tdb
tdb> dump

key 57 bytes
data 24 bytes
[000] ...

key 15 bytes
data 68 bytes
[000] ...  

key 17 bytes
data 68 bytes
[000] ...

tdb> delete SECRETS/LDAP_BIND_PW/cn=samba,ou=dsa,dc=vangasteren,dc=nl
delete failed

Root has rw access rights to the file, so that is not the issue.

P.S. I use samba-3.0.10-1.fc3 but that version is not in the list above.
Comment 1 Michael Adam 2008-07-08 09:39:54 UTC
I have just stumbled over this bug and found this bugzilla entry...

I have the issue with all commands that are not traverse commands
but act on one key.

I have fixed in 

Cheers - Michael
Comment 2 Michael Adam 2008-07-08 09:41:24 UTC
marking bug as fixed. 
please reopen if the problem persists.

Comment 3 Michael Adam 2008-07-09 06:39:47 UTC
Oops, I think I was overly enthusiastic about my commit.
Matters are not as simple.
Comment 4 Michael Adam 2008-07-09 06:51:35 UTC
The tdb keys are stored in different formats:
Some are stored as strings with trailing zeros,
some are stored without trailing zeros.

tdbtool takes the strings as the are provided.
Non-printable characters can be specified as
hex numbers in the form of \<digit> or \<digit><digit>.

The LDAP_BIND_PW key is stored with trailing zero, so
you will be able to delete it with the folowing ommand:

tdb> delete SECRETS/LDAP_BIND_PW/cn=samba,ou=dsa,dc=vangasteren,dc=nl\0

i.e. by appending "\0" at the end.

So it is not a bug in tdbtool but a (somewhat undocumented)
method of usage.

Marking the bug as resolved/invalid.
Please reopen if problems pertain.

Cheers - Michael