Bug 10854 - ldbsearch overwrite file without warning
ldbsearch overwrite file without warning
Status: NEW
Product: TDB
Classification: Unclassified
Component: tools
unspecified
All All
: P5 major
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-05 19:28 UTC by Harry Jede
Modified: 2015-05-05 08:52 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harry Jede 2014-10-05 19:28:48 UTC
if one by accident points the ldbsearch command to any file, which is 
not a ldb file, this file is silently converted to a tdb file ;-) .


root@dc0:~# file /tmp/t2.ldif
/tmp/t2.ldif: ASCII text

root@dc0:~# ldbsearch -H /tmp/t2.ldif
# returned 0 records
# 0 entries
# 0 referrals

root@dc0:~# file /tmp/t2.ldif
/tmp/t2.ldif: TDB database version 6, little-endian hash size 10000 
bytes


This behaviour my be OK for ldbadd/ldbmodify. But for a search command?

Samba version is:
Version 4.1.11-Debian
Comment 1 Andrey Repin 2015-05-05 08:52:35 UTC
This behavior MAY only be "ok" if the file is empty (zero length). Even then, I would say the behavior is HIGHLY questionable.
What if the file was a damaged LDB? The operation will just destroy it completely.
If a file format can't be read, the application MUST throw an exception. Not silently destroy the data.