s3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lo...
commit52990c9a211362006ab4d262a8c90bd3891252fb
authorJeremy Allison <jra@samba.org>
Fri, 28 Feb 2014 00:19:53 +0000 (27 16:19 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 10 Mar 2014 15:34:06 +0000 (10 16:34 +0100)
tree133b812cf6acc0be3a8a6e4773b89926bd08d9ea
parentf4b804512b2fcc471030911547543f1432057721
s3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lock even if there are no locks.

brl_get_locks_internal() currently returns NULL when it can't
find any byte range locks on the file. This is an error - it
should return a valid struct byte_range_lock containing num_locks == 0
so it can be cached.

Returning NULL when there are no locks causes POSIX lock
tests to fail returning NT_STATUS_NO_MEMORY (as it thinks
it can't allocate the struct) instead of NT_STATUS_OK.

This is a back-port of git commit abf08ed544ce05ea5a6e6ea2e531b6a2d97e15cc
that went into master.

Fixes bug:

Bug 10431 - STATUS_NO_MEMORY response from Query File Posix Lock request

https://bugzilla.samba.org/show_bug.cgi?id=10431

Signed-off-by: Jeremy Allison <jra@samba.org>
source3/locking/brlock.c