r6528: - in tdb_fetch() we effectively disallowed zero length records by
authorAndrew Tridgell <tridge@samba.org>
Sat, 30 Apr 2005 09:04:14 +0000 (09:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:16:23 +0000 (13:16 -0500)
commit162bbe4402b9de6ac06103df904b9fc204fbff29
tree53b46cdc4d4dfd0b30535e12207a637a267a7093
parentb32c159c384c988385f13bbb16e610d825820e18
r6528: - in tdb_fetch() we effectively disallowed zero length records by
  returning NULL/0, which is the same as we used for a failure. Having
  to look at tdb->ecode (which we never do) is too error prone.

  Instead, tdb_fetch() should behave like malloc() and talloc(), where
  zero length is not special and malloc(0) returns a valid pointer.

- similarly in data_blob(), asking for data_blob(NULL, 0) should
  return a zero blob, but asking for data_blob(ptr, 0) should return a
  zero length blob with a valid pointer, just like talloc() and malloc()

This change fixes the SummaryInformation stream stored in the tdb
backend when manipulated from w2k. The w2k client was using
SET_EOF_INFORMATION to create a zero-length stream, which we return
STATUS_NOT_FOUND on, as the tdb_fetch() gave us back a NULL/0 blob,
which we returned as not-found
source/lib/data_blob.c
source/lib/tdb/common/tdb.c