Commit Graph

23 Commits

Author SHA1 Message Date
Gleb Popov
937f807a36 libc/posix1e: Add acl_cmp_np() function.
Reviewed by: kib, debdrup, gbe
Approved by: kib
Differential Revision: https://reviews.freebsd.org/D28255
2021-08-27 11:52:08 +03:00
Pedro F. Giffuni
d915a14ef0 libc: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-25 17:12:48 +00:00
Pedro F. Giffuni
32223c1b7d libc: spelling fixes.
Mostly on comments.
2016-04-30 01:24:24 +00:00
Tim Kientzle
2ca090b308 Separate _posix1e_acl_id_to_name() into a separate file, to
break an unnecessary dependency on getpwuid() and getgrgid().

MFC after: 1 month
2010-06-14 02:26:13 +00:00
Edward Tomasz Napierala
d72fb30a43 _posix1e_acl_sort() never returns anything other than 0; change its
return type to void and update callers.  This simplifies code and
fixes one place where the returned value was not actually checked.

Found with:	Coverity Prevent
CID:		4791
2010-06-03 14:29:17 +00:00
Tim Kientzle
e0fdd85ff7 Style: Remove trailing whitespace. 2009-08-29 03:17:24 +00:00
Edward Tomasz Napierala
aa015c8e4a Add NFSv4 ACL support to libc.
This adds the following functions to the acl(3) API: acl_add_flag_np,
acl_clear_flags_np, acl_create_entry_np, acl_delete_entry_np,
acl_delete_flag_np, acl_get_extended_np, acl_get_flag_np, acl_get_flagset_np,
acl_set_extended_np, acl_set_flagset_np, acl_to_text_np, acl_is_trivial_np,
acl_strip_np, acl_get_brand_np.  Most of them are similar to what Darwin
does.  There are no backward-incompatible changes.

Approved by:    rwatson@
2009-06-25 12:46:59 +00:00
Edward Tomasz Napierala
ae1add4e55 Make 'struct acl' larger, as required to support NFSv4 ACLs. Provide
compatibility interfaces in both kernel and libc.

Reviewed by:	rwatson
2009-05-22 15:56:43 +00:00
Robert Watson
0d01d41007 The libc acl_valid(3) function validates the contents of a POSIX.1e ACL.
This change removes the requirement that an ACL contain no ACL_USER
entries with a uid the same as those of a file, or ACL_GROUP entries
with a gid the same as those of a file.  This requirement is not in the
specification, and not enforced by the kernel's ACL implementation.

Reported by:	Iustin Pop <iusty at k1024 dot org>
MFC after:	1 week
2008-07-13 16:37:51 +00:00
Tim Kientzle
4813511138 Move _posix1e_acl_name_to_id out of acl_support.c and into
acl_from_text.c.  Since acl_from_text.c is the only place it
is used, we can now make this internal utility function "static."

As a bonus, acl_set_fd() no longer pulls in getpwuid() for no reason.

MFC after: 7 days
2007-02-26 02:07:02 +00:00
Robert Watson
14a276b3fe When printing ACLs, truncate user and group names if they're too long,
rather than generating an error.  This is consistent with other tools
printing user and group names, and means you can read the ACL using
our tools rather than being up a creek.

PR:		56991
Submitted by:	Michael Bretterklieber <mbretter@a-quadrat.at>
2003-11-03 21:00:16 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
Chris D. Faulhaber
a82f127b41 o style(9) and consistency fix:
- if (!var) -> if (var == NULL)
o spelling fix (althouh -> although)

Reviewed by:	rwatson
Obtained from:	TrustedBSD Project
2002-02-21 23:18:04 +00:00
Brian Somers
3c321a686f Handle snprintf() returning -1
MFC after:	2 weeks
2001-08-20 12:41:36 +00:00
Chris D. Faulhaber
0f6263079e o Separate acl_t into internal and external representations as
required by POSIX.1e.  This maintains the current 'struct acl'
  in the kernel while providing the generic external acl_t
  interface required to complete the ACL editing library.
o Add the acl_get_entry() function.
o Convert the existing ACL utilities, getfacl and setfacl, to
  fully make use of the ACL editing library.

Obtained from:	TrustedBSD Project
2001-04-24 22:45:41 +00:00
Chris D. Faulhaber
fb1af1f2bf Correct the following defines to match the POSIX.1e spec:
ACL_PERM_EXEC  -> ACL_EXECUTE
  ACL_PERM_READ  -> ACL_READ
  ACL_PERM_WRITE -> ACL_WRITE

Obtained from:	TrustedBSD
2001-04-11 02:19:01 +00:00
Thomas Moestl
7bd44e9223 Prepare for the inclusion of libposix1e into libc: retire the old
Makefile, add Makefile.inc needed for libc build; add
#include "namespace.h"/#include "un-namespace.h" pairs around the
includes of sys/acl.h and sys/capability.h, and an additional underscore
in front of the functions that will be overridden in libc_r.

Approved by:	rwatson
Obtained from:	TrustedBSD Project
2001-04-04 18:00:52 +00:00
Robert Watson
2de14c39b5 o Update copyright dates.
o Rename internal library functions so that they are prefixed with
  _posix1e or _POSIX1E, removing them from the application namespace (and
  potential conflict with other ACL functions elsewhere in the system).

Obtained from:	TrustedBSD Project
2001-03-13 02:31:32 +00:00
Robert Watson
5aa25ec606 o Make acl_from_text() support uid's and gid's as well as usernames
and groupnames, by adding appropriate support to acl_name_to_id()
  in acl_support.c

Submitted by:	green
2001-01-08 01:28:53 +00:00
Chris D. Faulhaber
4786e00b40 Correct check of getgrnam output
Approved by:	rwatson
2001-01-07 21:41:05 +00:00
Robert Watson
8f45e8c076 Minor fixes to library interface to improve POSIX.1e compliance. This
adds _np to a couple of function prototypes that provided more broad/useful
interfaces than POSIX.1e interfaces included.

Also, move from using a heuristic to identify POSIX.1e-semantic ACLs to
using different ACL types for non-POSIX.1e ACLs.  This should clean up the
existing fuzzy logic that determined when acl_sort() should be applied
before kernel submission.
2000-01-26 04:19:38 +00:00
Robert Watson
d335231606 Fix bde'isms in acl/extattr syscall interface, renaming syscalls to
prettier (?) names, adding some const's around here, et al.

This is commit 4 out of 3, updating the userland library to reflect kernel
interface changes.

Reviewed by:	bde
2000-01-19 06:13:59 +00:00
Robert Watson
515d7c92d3 libposix1e provides userland library calls for the POSIX.1e security
interface.  This commit introduces the library, as well as a modest
subset of the ACL calls, with some modifications to support multiple
ACL semantics.

Reviewed by:	eivind
2000-01-15 19:44:27 +00:00