]> Savannah Git Hosting - gnulib.git/commit
file-has-acl: improve recent NFSv4 support
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Dec 2022 23:18:29 +0000 (15:18 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 23 Dec 2022 23:24:55 +0000 (15:24 -0800)
commit35bd46f0c816948dc1a0430c8ba8b10a01167320
treefffb301e9137c8446b9a546ff233b7d83a9ee2bd
parenta3efddb96f5f121b8a5bb1310dc82407546fd255
file-has-acl: improve recent NFSv4 support

This fixes a link failure with emacsclient on GNU/Linux.  This
program wants file_has_acl but none of the other ACL primitives,
so it doesn’t link acl-internal.o; this way it doesn’t need to
link with -lacl.  While I was at it I reviewed the recent changes,
fixed some unlikely overflow bugs, and adjusted to GNU style.
* doc/acl-nfsv4.txt: Remove.  Its contents are now in a
comment in lib/file-has-acl.c.
* lib/acl-internal.c, lib/acl-internal.h: Move recent changes
relating to acl_nfs4_nontrivial to lib/file-has-acl.c, so that
there is no trouble linking programs that need only file_has_acl.
* lib/file-has-acl.c (acl_nfs4_nontrivial): Move here from
lib/acl-internal.c, so that we needn't link -lacl in
programs that want only file_has_acl, such as emacsclient.
Do not assume a char buffer is aligned for uint32_t.
Check more carefully for buffer read overrun.
Allow up to 6 ACEs, since other code does; but check
that they’re distinct.  Avoid integer overflow.
Use memcmp rather than strncmp to compare memory blocks.
(file_has_acl): Preserve initial errno instead of setting to 0.
Allocate a bit more room for trivial ACL buffer.
Use EINVAL for botchedk NFSv4 ACLs (which shouldn’t happen).
ChangeLog
doc/acl-nfsv4.txt [deleted file]
lib/acl-internal.c
lib/acl-internal.h
lib/file-has-acl.c