Properly permission check cache_inode_readdir

Must have rx mode or ACE4_LIST_DIR | ACE4_EXECUTE (SEARCH) permission to
get the handle or attributes of entries in a directory. Additionally,
for NFS v4, if the ACL attribute is requested, we also require
ACE4_READ_ACL.

Intentionally. we never check ACE4_READ_ATTR. Per section 6.2.1.
Attribute 12: acl of RFC 3530 bis, a server may silently ignore an ACL
mask bit if it can not enforce that. Since Linux pretty much always
allows attributes, we choose not to enforce ACE4_READ_ATTR.

Must have r mode or ACE4_LIST_DIR to get the names in a directory. If
the ACL attribute is requested, then must also have ACE4_READ_ACL.

Do not provide ACL for a file if file does not have READ_ACL permission.

Ported from 1.5 aa4aeb561d996dbe94471148d1dea326581ae7f5

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Properly permission check cache_inode_getattr

Intentionally. we never check ACE4_READ_ATTR. Per section 6.2.1.
Attribute 12: acl of RFC 3530 bis, a server may silently ignore an ACL
mask bit if it can not enforce that. Since Linux pretty much always
allows attributes, we choose not to enforce ACE4_READ_ATTR.

We do require ACE4_READ_ACL be allowed in order to fetch the ACL
attribute. Otherwise, we assume that the attributes are available
to the client.

Ported from 1.5 8723374acebf0ada866b49940d86c3a51e4a74d0

Note that with the code re-organization, we only bother to check permissions
for NFS v4 operations that call cache_entry_To_Fattr. nfs4_readdir_callback
already does this permission check for readdir. This change actually correctly
adds this permission check to PseudoFS readdir for junction entries which was
not properly handled in 1.5 code.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
NOT A PORT Fix return code issues in nfs_proto_tools.c including fix to nfs4_Fattr_cmp

Fix up some int/bool return codes.

nfs4_Fattr_cmp had a major issue, it tried to determine if attr were the
same by accumulating:

cmp += memcmp(something);

And then checking cmp == 0 at the end. Problem is that memcmp can return
-1, 0, or 1, so two differences, one that resulted in -1 and one that
resulted in 1 would negate each other and make it appear there were no
differences in attributes.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Properly permission check cache_inode_lookup

Correct permissions for lookup are x mode or ACE4_EXECUTE ACL.

Also check object type correctly.

Ported from 1.5 18652a5fc3676b75ae4db78155bf3f60a6dce09b

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>