Commit Graph

313 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
cdec385674 Move the code around so that libc behaviour does not depend on a variable
that was supposed to be kernel-only.  There should be no functional changes.
2011-03-22 17:44:07 +00:00
Edward Tomasz Napierala
e43af6d3b6 Make acl_strip_np(3) use new trivial ACL format for NFSv4 ACls (three
entries instead of six).  This makes "setfacl -b" do the right thing
for ACLs on ZFS.  UFS recognizes both kinds of trivial ACLs; no change
there.

MFC after:	2 months
2011-03-04 17:23:10 +00:00
Edward Tomasz Napierala
2506c55201 Bump manual page date. 2010-12-13 19:03:10 +00:00
Edward Tomasz Napierala
eda09cb3ff After PSARC/2010/029, "canonical six" no longer exists. 2010-12-13 19:01:23 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Edward Tomasz Napierala
4089cc8aa1 First step at adopting FreeBSD to support PSARC/2010/029. This makes
acl_is_trivial_np(3) properly recognize the new trivial ACLs.  From
the user point of view, that means "ls -l" no longer shows plus signs
for all the files when running ZFS v28.
2010-09-20 17:10:06 +00:00
Edward Tomasz Napierala
781413510d Arrgh, tested wrong source tree _again_. Fix previous commit. Also,
this and previous one are MFC candidate.

MFC after:	1 month
2010-09-09 20:37:19 +00:00
Edward Tomasz Napierala
7eaa29b5d8 Add minor optimization. It's less strict than its kernel counterpart
due to upcoming ACL changes required by the new ZFS.
2010-09-09 20:07:40 +00:00
Joel Dahl
edfa427cf1 Spelling fixes. 2010-08-02 16:01:45 +00:00
Edward Tomasz Napierala
f59646c2af Fix acl_from_text(3) - and, therefore, setfacl(1) - for user and group
names names starting with a digit.

MFC after:	1 month
2010-07-06 17:20:08 +00:00
Edward Tomasz Napierala
ec1f83f78e Remove comment which didn't match reality for a long time.
Reviewed by:	rwatson
2010-07-05 19:01:10 +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
eec80038e3 Don't use pointer to 64 bit value (id_t) to point to 32 bit value (uid_t).
Found with:	Coverity Prevent
CID:		7466, 7467
MFC after:	2 weeks
2010-06-05 07:40:32 +00:00
Edward Tomasz Napierala
a3a11ad455 Don't forget to free the string in error case.
Found with:	Coverity Prevent
CID:		6585
2010-06-03 14:51:29 +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
Edward Tomasz Napierala
7945d60d1e Fix usage of uninitialized variable.
Found with:	Coverity Prevent
CID:		7517
MFC after:	2 weeks
2010-06-03 14:27:18 +00:00
Edward Tomasz Napierala
18c12a53a1 The 'acl_cnt' field is unsigned; no point in checking if it's >= 0.
Found with:	Coverity Prevent
CID:		6192
2010-06-03 14:16:58 +00:00
Edward Tomasz Napierala
d243a85e99 The 'acl_cnt' field is unsigned; no point in checking if it's >= 0.
Found with:	Coverity Prevent
CID:		6193
2010-06-03 14:15:08 +00:00
Edward Tomasz Napierala
9fcd375657 Make acl_get_perm_np(3) work with NFSv4 ACLs.
Reviewed by:	kientzle@
MFC after:	1 week
2010-05-23 08:12:36 +00:00
Edward Tomasz Napierala
1ccc2ae37f Make branding less intrusive - in acl_set(3), in case ACL brand
is ACL_BRAND_UNKNOWN, do what the programmer says instead of failing.

MFC after:	1 week
2010-05-13 16:44:27 +00:00
Edward Tomasz Napierala
6a3cf4c80b Make it possible to actually use NFSv4 permission bits with acl_set_perm(3)
and acl_delete_perm(3).  It went undetected, because neither setfacl(1)
nor Samba use this routines.  D'oh.

MFC after:	1 week
2010-05-13 16:42:01 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Edward Tomasz Napierala
48463a6747 Make acl_to_text_np(3) not crash on long group or user names in NFSv4 ACLs.
PR:		amd64/145091
MFC after:	2 weeks
2010-03-28 17:29:15 +00:00
Joel Dahl
a303eae7c8 Switch to our preferred license text.
Approved by:	jedgar
2010-03-07 07:59:05 +00:00
Joel Dahl
a4481a8745 Use our standard license text. No more voices in the authors head. :-)
Approved by:	trasz
2010-03-04 19:38:24 +00:00
Tom Rhodes
e5bc56aeae s/APIS/APIs - not part of the original submission. 2010-02-11 19:20:06 +00:00
Tom Rhodes
0fe71aba5c Correct two typoes.
Submitted by:	Matthew Seaman <m.seaman@infracaninophile.co.uk>
2010-02-11 14:45:00 +00:00
Ed Schouten
442aea92f6 Don't forget to clean up the file copied from the kernel sources.
MFC after:	1 week
2010-01-02 20:27:14 +00:00
Markus Brueffer
78da985f4e Use a local copy of entry_d for finding matches. Otherwise, if entry_d pointed
to an entry of 'acl', all ACL entries starting with entry_d would be deleted.

Reviewed by:	trasz
Approved by:	emax (mentor)
MFC after:	3 days
2009-12-25 18:05:06 +00:00
Ed Schouten
dc29acd1a9 Don't let the C library depend on <utmp.h>.
The maximum length of a username has nothing to do with the size of the
username in the utmp files. Use MAXLOGNAME, which is defined as 17
(UT_USERSIZE + 1).
2009-12-05 19:04:21 +00:00
Christian Brueffer
4f6d5fda02 Fix a memory leak in acl_from_text() in case the conversion succeeded.
Submitted by:	Jim Wilcoxson <prirun@gmail.com>
MFC after:	1 week
2009-11-16 09:28:22 +00:00
Edward Tomasz Napierala
59831d7595 Fix regression introduced with NFSv4 ACL support - make acl_to_text(3)
and acl_calc_mask(3) return error instead of crashing when acl passed
to them is NULL.

Submitted by:	markus
Reviewed by:	rwatson
MFC after:	3 days
2009-09-01 18:30:17 +00:00
Tim Kientzle
e0fdd85ff7 Style: Remove trailing whitespace. 2009-08-29 03:17:24 +00:00
Robert Watson
3a67af38ba Update posix1e-related man pages, especially as relates to MAC, to more
accurately reflect the last ten years of work.

Approved by:	re (kib)
2009-08-12 10:46:48 +00:00
Edward Tomasz Napierala
ec71a417a8 Add missing MLINKS for acl_{get,set}_link_fd(3).
Approved by:	re (kib)
2009-07-14 19:37:53 +00:00
Edward Tomasz Napierala
c3380d406a Fix acl_set_fd(3) and acl_get_fd(3) for cases where the kernel doesn't know
anything about _PC_ACL_NFS4.
2009-06-25 20:57:53 +00:00
Edward Tomasz Napierala
b372d0d8bc Manual page tweaks. 2009-06-25 16:34:29 +00:00
Edward Tomasz Napierala
85e71e24c5 Fix c194955 - somehow I managed all the new files, tripling their
contents.
2009-06-25 13:08:02 +00:00
Edward Tomasz Napierala
ca48e73a18 Bump manual page timestamps. 2009-06-25 12:53:50 +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
60a8b6022d Fix off by one error in acl_create_entry(3).
Reviewed by:	rwatson@
MFC after:	2 weeks
2009-05-28 07:20:52 +00:00
Edward Tomasz Napierala
b7014134a7 Change license to more bori^Wadul^Wcanonical.
Submitted by:	rwatson@
2009-05-26 11:42:06 +00:00
Edward Tomasz Napierala
f24f1c51d3 Improve API documentation.
Reviewed by:	rwatson (earlier version)
2009-05-23 13:51:05 +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
Christian Brueffer
a9ffff74c5 Since audit(4) isn't based on posix1e, remove the commented out audit.h header,
xref libbsm(3).

Submitted by:	rwatson
MFC after:	3 days
2009-05-19 22:28:33 +00:00
Edward Tomasz Napierala
5d8532a1b1 Fix typo. 2009-04-26 10:12:20 +00:00
Warner Losh
68b2399298 Replace the non-standard disclaimer with the standard one from /COPYRIGHT
Approved by:	jedgar@
2008-11-04 00:20: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
Robert Watson
cee815cf77 Add __FBSDID() tags.
MFC after:	3 days
2008-03-07 15:25:56 +00:00
Daniel Eischen
2665faf497 Some libc symbol map cleanups.
net: endhostdnsent is named _endhostdnsent and is
  private to netdb family of functions.

  posix1e: acl_size.c has been never compiled in,
  so there's no "acl_size".

  rpc: "getnetid" is a static function.

  stdtime: "gtime" is #ifdef'ed out in the source.

  some symbols are specific only to some architectures,
  e.g., ___tls_get_addr is only defined on i386.

  __htonl, __htons, __ntohl and __ntohs are no longer
  functions, they are now (internal) defines in
  <machine/endian.h>.

Submitted by:	ru
2007-05-31 13:01:34 +00:00
Daniel Eischen
5f864214bb Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +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
Ruslan Ermilov
ad136d1e29 Revise markup in recently added manpages. 2006-09-30 10:34:13 +00:00
Robert Watson
1e5294bc0a Following repo-copy of mac_is_present_np.3 to mac_is_present.3, remove
old file, update references, etc.  The C function is already named
mac_is_present().

Obtained from:	TrustedBSD Project
2006-07-07 14:02:17 +00:00
Daniel Eischen
6fad3aaf15 Add each directory's symbol map file to SYM_MAPS. 2006-03-13 01:15:01 +00:00
Daniel Eischen
cce72e8860 Add symbol maps and initial symbol version definitions to libc.
Reviewed by:	davidxu
2006-03-13 00:53:21 +00:00
Ruslan Ermilov
8ae7a845d5 There's no longer^Wyet <sys/capability.h>. 2005-11-23 16:24:39 +00:00
Ruslan Ermilov
110e1704d3 -mdoc sweep. 2005-11-17 13:00:00 +00:00
Stefan Farfeleder
613100918d Include a couple of headers to ensure consistency between the prototype and
the function definition.
2005-09-12 19:52:42 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Xin LI
1c70a91b10 Minor grammar fix
Submitted by:	Wojciech A. Koszek [dunstan at freebsd czest pl]
Approved by:	re (hrs)
2005-07-03 12:35:11 +00:00
Warner Losh
46813f9674 Missed rwatson's redundancy 2005-06-03 15:50:55 +00:00
Robert Watson
5be3971166 Minor white space tweak.
MFC after:	3 days
2005-01-23 15:28:02 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
f4bff75eb3 Fixed markup bug. 2005-01-15 12:21:03 +00:00
Ruslan Ermilov
2d82ac3110 Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
Christian S.J. Peron
ca8d7823c6 -Add a note that currently two syntax styles for label element declaration
is supported.
-Document the new more preferred syntax
-Add examples for the new syntax
-Add a note that the old syntax will be deprecated in the future.

Reviewed by:	rwatson
2004-11-18 15:24:47 +00:00
Ruslan Ermilov
51f98e585b Fix the NAME section making whatis(1) happy in particular. 2004-07-05 17:12:53 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Ruslan Ermilov
33992dc0ed Markup, grammar, and spelling fixes. 2004-06-30 20:09:10 +00:00
Robert Watson
804613dc06 Add reference to mac_get_link() in man page, which was omitted when
mac_get_link() and mac_set_link() were added.
2004-06-17 16:08:36 +00:00
Jacques Vidrine
ff5fe653fa Adjust for brain outage that affected the previous commit.
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-01-06 20:29:40 +00:00
Jacques Vidrine
2a8d656d26 Avoid undefined behavior:
foo[i] = bar[++i];  /* Which operator [] will be evaluated first? */
2004-01-06 18:43:31 +00:00
Jacques Vidrine
84d9142f58 Remove unused variables and function declarations. Add missing headers. 2004-01-06 18:26:15 +00:00
Robert Watson
a2f046e874 Staticize label_default_head to prevent it from leaking out of mac.c.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-17 19:48:35 +00:00
Robert Watson
237a5de859 Update mac_set.3 to account for new behavior of mac_set_fd() in the
context of sockets, and document EINVAL as a possible failure mode
based on the object selected, not just the label provided.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 20:21:21 +00:00
Robert Watson
920325ee1d Implement mac_get_peer(3) using getsockopt() with SOL_SOCKET and
SO_PEERLABEL.  This provides an interface to query the label of a
socket peer without embedding implementation details of mac_t in
the application.  Previously, sizeof(*mac_t) had to be specified
by an application when performing getsockopt().

Document mac_get_peer(3), and expand documentation of the other
mac_get(3) functions.  Note that it's possible to get EINVAL back
from mac_get_fd(3) when pointing it at an inappropriate object.

NOTE: mac_get_fd() and mac_set_fd() support for sockets will
follow shortly, so the documentation is slightly ahead of the
code.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 20:18:24 +00:00
Robert Watson
5859b37843 Memory allocated by mac_to_text() must be freed using free(3) not
mac_free(3), which is used only for variables of type mac_t in
the FreeBSD implementation.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-16 04:32:46 +00:00
Robert Watson
143460168a Remove debugging printf that crept into the last commit. 2003-11-15 04:05:49 +00:00
Robert Watson
6e07ce26f9 /etc/mac.conf is implicitly read and parsed when the MAC configuration
is accessed for the first time as a result of an application looking
up label configuration information.  Previously, the check and read
were kicked off by mac_prepare_(typename)() functions; since
mac_prepare_type() may now be directly employed by a user process,
push the check and initialization into that function.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-11-15 03:34:58 +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
Ruslan Ermilov
a1de21c12e mdoc(7): Fix common mistakes made in the SEE ALSO section. 2003-09-12 21:54:11 +00:00
Robert Watson
7ea02dcd89 Return (-1) not (ENOENT) for mac_prepare_type(), and set errno to
ENOENT instead.

Reported by:	"Kenneth D. Merry" <ken@kdm.org>
Submitted by:	Bryan Liesner <bleez@comcast.net>
2003-08-30 14:51:01 +00:00
Robert Watson
09a7f4484d Add HISTORY sections to the remaining MAC library man pages.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 18:01:03 +00:00
Robert Watson
bec8c3f9c3 Update the mac_prepare(3) man page to reflect changes to the
mac_prepare() APIs.

Add a HISTORY section.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:58:38 +00:00
Robert Watson
930d4ffa56 Make the elements argument to mac_prepare() be const.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:49:59 +00:00
Robert Watson
738824ad6c As new objects begin to support new labels, start to generalize
the default label support in /etc/mac.conf.  Rather than maintain
each default label type in an explicit global variable in mac.c,
keep a list of defaults loaded from the configuration file.
Generalize the parsing so that we support both the older:

        default_file_labels foo
        default_ifnet_labels foo
        default_process_labels foo

And also a new:

        default_labels file foo
        default_labels ifnet foo
        default_labels process foo

We now accept arbitrary object classes in the first argument.  If
the same object is specified more than once, we discard the
earlier definition in favor of the later one.

Add a new API, mac_prepare_type(), which accepts a mac_t to
prepare, as well as an object name in the second argument, which
will pull a default label set for the object out of the
configuration loaded by mac_init_internal().  This permits the libc
to adapt to new objects known about by applications but not by libc
at compile-time.

Also liberalize the error handling a bit: if we're using implicit
initialization (i.e., the application didn't explicitly initialize
the MAC code), ignore syntax errors and only use valid lines.  In
the future, we may want to add explicit warnings and do this a
bit more consistently.

While here, add support for a MAC_CONFFILE environmental variable,
which may be used to specify an alternative mac.conf configuration
file if the application isn't running with modified privilege
(issetugid()).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:36:23 +00:00
Robert Watson
82fefada64 Print group name in getfacl output when calculating an effective
permission set based on a more restrictive mask.

Submitted by:	Glen Gibb <grg@ridley.unimelb.edu.au>
2003-07-24 23:33:25 +00:00
Ruslan Ermilov
734ac3b543 mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-24 19:53:08 +00:00
Ruslan Ermilov
3a5146d9e2 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
Robert Watson
2715ba4892 Add some strategic whitespace. 2003-04-26 03:32:18 +00:00
Robert Watson
8aa884cb01 Add FILES section to mac.3 and mac.conf.5. Properly Xref mac.conf.5
from mac.3; likewise, mac.conf.5 from mac_prepare.3.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 04:43:56 +00:00
Robert Watson
781a15a533 Add a man page for the mac.conf MAC library configuration file.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 03:18:44 +00:00
Robert Watson
23408b001b Add the mac_prepare{,_*}() functions to the high-level function list
in the mac.3 library man page.  They were already cross-referenced
at the end of the man page, just not explicitly listed here.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-20 02:56:16 +00:00
Robert Watson
ecf889825d Clarify the relationship between the MAC library APIs and POSIX.1e:
they resemble one another, but POSIX.1e interfaces were not sufficiently
expressive to do what we needed.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-16 20:40:34 +00:00
Jacques Vidrine
2bbd7cf820 Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.
2003-02-27 13:40:01 +00:00
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Ruslan Ermilov
0213c21b44 mdoc(7) police: kill self-xref. 2003-02-23 01:45:25 +00:00
Ruslan Ermilov
66d8bae40a Punctuation. 2003-02-23 01:44:59 +00:00