ACL_VALID(3)

πŸ“¦
version 2.4.0 Β· 2 versions
  • 2.4.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– ACL_VALID(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual (section 3, the library calls girlies 🫢) and we're talking about acl_valid β€” yes it's literally in the Linux ACL world and it's lowkey one of the most useful little functions you'll ever meet. sit down, get comfy, let's get into it ✨


🌸 NAME 🌸

acl_valid β€” validate an ACL

like. it checks if your ACL is valid. that's the whole job. iconic behavior honestly πŸ’…


πŸ“š LIBRARY πŸ“š

Linux Access Control Lists library (libacl, -lacl).

so when you compile, you're linking -lacl and you're pulling from libacl. don't forget it or the linker will be SO dramatic about it 😭


✨ SYNOPSIS ✨

#include <sys/types.h>
#include <sys/acl.h>

int
acl_valid(acl_t acl);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the acl_valid() function checks the ACL that the argument acl points to, and it's asking one question: is this thing valid? is it giving what it's supposed to give? πŸ‘‘

here's the tea on what "valid" actually means, because there are RULES:

  • The three required entries ACL_USER_OBJ, ACL_GROUP_OBJ, and ACL_OTHER must exist exactly once in the ACL. not zero times, not two times. exactly once. periodt.
  • If the ACL contains any ACL_USER or ACL_GROUP entries, then an ACL_MASK entry is also required. no mask, no party 🚫
  • The ACL may contain at most one ACL_MASK entry.

and there's more, because of course there is:

  • The user identifiers must be unique among all entries of type ACL_USER.
  • The group identifiers must be unique among all entries of type ACL_GROUP.

no duplicates allowed, bestie. this function will absolutely clock you πŸ™ˆ


πŸŽ€ RETURN VALUE πŸŽ€

The acl_valid() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

so: 0 = slay, -1 = check errno immediately, do not pass go πŸ’€


πŸ”₯ ERRORS πŸ”₯

If any of the following conditions occur, the acl_valid() function returns -1 and sets errno to the corresponding value:

  • [EINVAL] β€” The argument acl is not a valid pointer to an ACL.

The argument acl does not point to a valid ACL.

One or more of the required ACL entries is not present in acl.

The ACL contains entries that are not unique.

ngl EINVAL is doing a LOT of heavy lifting here, it's basically the catch-all bestie of error codes 🫢

🌈 STANDARDS 🌈

IEEE Std 1003.1e draft 17 (β€œPOSIX.1e”, abandoned)

not me telling you it's abandoned β€” yeah, the standard got ghosted, but the code is still out here living its best life πŸ’œ

πŸ‘€ SEE ALSO πŸ‘€

acl_check(3), acl_set_file(3), acl(5)

go read the girlies too, they're all connected, iykyk ✨


πŸ’œ AUTHOR πŸ’œ

Derived from the FreeBSD manual pages written by Robert N M Watson <rwatson@FreeBSD.org>, and adapted for Linux by Andreas Gruenbacher <andreas.gruenbacher@gmail.com>.

shoutout to them fr fr, they carried this whole page 🫢


and that's the whole vibe check, bestie!! this page came from the Linux ACL crew and it's dated March 23, 2002 β€” yeah it's been around a minute, but it's still valid (see what i did there πŸ’…). go validate some ACLs, stay unique, and never forget your ACL_MASK πŸŽ€βœ¨

πŸ“¦ where this page comes from