Suhas Athani has uploaded this change for review.
XDR: reject empty file handles, client ids and state owners
GitHub Issue: #1404
The variable length opaques that identify an object or a client were
decoded with inline_xdr_bytes(), which accepts a zero length. An empty
client id reached get_client_record() and used to trip an assert there
(since replaced by a LogCrit and error return). Empty file handles and
empty open/lock owners were likewise only caught, if at all, deep in
the operation code.
Add xdr_bytes_nonempty(), a wrapper around inline_xdr_bytes() that
fails a zero length opaque on both decode and encode, and use it for:
- nfs_fh4 (all file handles)
- nfs_client_id4.id (SETCLIENTID)
- client_owner4.co_ownerid (EXCHANGE_ID)
- state_owner4.owner (open and lock owners)
libntirpc's generic xdr_bytes() is unchanged, and opaques that may
legitimately be empty (attrlist4, layoutupdate/layoutreturn bodies,
notifylist4, SSV fields, sec_oid4, gsshandle4_t) keep using
inline_xdr_bytes(). server_owner4.so_major_id is only ever encoded
from server configuration and is also left alone.
Change-Id: Iecd44e5719173f4b7be844683bc743535cff081d
Signed-off-by: Suhas Athani <Suhas.Athani@ibm.com>
---
M src/include/nfsv41.h
1 file changed, 29 insertions(+), 10 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/65/1252765/1
To view, visit change 1252765. To unsubscribe, or for help writing mail filters, visit settings.