diff options
author | tmm <tmm@FreeBSD.org> | 2001-04-04 18:29:03 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2001-04-04 18:29:03 +0000 |
commit | 830fa77ac76c8c73e6130aa31a1dddc803104c77 (patch) | |
tree | 958f41d3d49c199413e068dea59bfe02ea387e49 | |
parent | 12d95b20ac39c425c40acc47ab5af04c362d11d8 (diff) | |
download | FreeBSD-src-830fa77ac76c8c73e6130aa31a1dddc803104c77.zip FreeBSD-src-830fa77ac76c8c73e6130aa31a1dddc803104c77.tar.gz |
Remove the libposix1e, since it has been repo copied to libc/posix1e and
integrated into libc.
Approved by: rwatson
Obtained from: TrustedBSD Project
65 files changed, 0 insertions, 7110 deletions
diff --git a/lib/libposix1e/Makefile b/lib/libposix1e/Makefile deleted file mode 100644 index 1e2871f..0000000 --- a/lib/libposix1e/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# $FreeBSD$ - -MAINTAINER= rwatson@FreeBSD.org -LIB= posix1e -SHLIB_MAJOR= 2 -SHLIB_MINOR= 0 -SRCS+= acl_calc_mask.c \ - acl_copy.c \ - acl_delete.c \ - acl_delete_entry.c \ - acl_entry.c \ - acl_free.c \ - acl_from_text.c \ - acl_get.c \ - acl_init.c \ - acl_perm.c \ - acl_set.c \ - acl_support.c \ - acl_to_text.c \ - acl_valid.c \ - cap_clear.c \ - cap_dup.c \ - cap_free.c \ - cap_get_fd.c \ - cap_get_file.c \ - cap_get_flag.c \ - cap_get_proc.c \ - cap_init.c \ - cap_set_fd.c \ - cap_set_file.c \ - cap_set_flag.c \ - cap_set_proc.c \ - cap_text.c - -MAN= acl.3 \ - acl_add_perm.3 \ - acl_calc_mask.3 \ - acl_clear_perms.3 \ - acl_copy_entry.3 \ - acl_delete.3 \ - acl_delete_entry.3 \ - acl_delete_perm.3 \ - acl_dup.3 \ - acl_free.3 \ - acl_from_text.3 \ - acl_get.3 \ - acl_get_permset.3 \ - acl_get_qualifier.3 \ - acl_get_tag_type.3 \ - acl_init.3 \ - acl_set.3 \ - acl_set_permset.3 \ - acl_set_qualifier.3 \ - acl_set_tag_type.3 \ - acl_to_text.3 \ - acl_valid.3 \ - cap.3 \ - cap_clear.3 \ - cap_dup.3 \ - cap_free.3 \ - cap_from_text.3 \ - cap_get_flag.3 \ - cap_get_proc.3 \ - cap_init.3 \ - cap_set_flag.3 \ - cap_set_proc.3 \ - cap_to_text.3 \ - posix1e.3 - -MLINKS+=acl_delete.3 acl_delete_def_file.3 \ - acl_delete.3 acl_delete_file_np.3 \ - acl_delete.3 acl_delete_fd_np.3 \ - acl_get.3 acl_get_file.3 \ - acl_get.3 acl_get_fd.3 \ - acl_get.3 acl_get_fd_np.3 \ - acl_set.3 acl_set_file.3 \ - acl_set.3 acl_set_fd.3 \ - acl_set.3 acl_set_fd_np.3 \ - acl_valid.3 acl_valid_file_np.3 \ - acl_valid.3 acl_valid_fd_np.3 - -.include <bsd.lib.mk> diff --git a/lib/libposix1e/acl.3 b/lib/libposix1e/acl.3 deleted file mode 100644 index a581479..0000000 --- a/lib/libposix1e/acl.3 +++ /dev/null @@ -1,168 +0,0 @@ -.\"- -.\" Copyright (c) 2000, 2001 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL 3 -.Os FreeBSD -.Sh NAME -.Nm acl -.Nd introduction to the POSIX.1e ACL security API -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Sh DESCRIPTION -.Fx -permits file systems to export Access Control Lists via the VFS, and -provides a library for userland access to and manipulation of these ACLs. -Not all file systems provide support for ACLs, and some may require that -ACL support be explicitely enabled by the administrator. -The library calls include routines to allocate, duplicate, retrieve, set, -and validate ACLs associated with file objects. -As well as the POSIX.1e routines, there are a number of non-portable -extensions defined that allow for alternative ACL semantics than the -POSIX.1e semantics, such as AFS, NTFS, Coda, and NWFS semantics. -Where routines are non-standard, they are suffixed with _np to indicate that -they are not portable. -.Pp -POSIX.1e describes a set of ACL manipulation routines to manage the -contents of ACLs, as well as their relationships with files; almost -all of these support routines are implemented in -.Fx . -.Pp -Available functions, sorted by behavior, include: -.Pp -.Fn acl_delete_def_file , -.Fn acl_delete_file_np , -.Fn acl_delete_fd_np -.Pp -These functions are described in -.Xr acl_delete 3 , -and may be used to delete ACLs from file system objects. -.Pp -.Fn acl_free -.Pp -This function is described in -.Xr acl_free 3 , -and may be used to free userland working ACL storage. -.Pp -.Fn acl_from_text -.Pp -This function is described in -.Xr acl_from_text 3 , -and may be used to convert a text-form ACL into working ACL state, if -the ACL has POSIX.1e semantics. -.Pp -.Fn acl_get_file , -.Fn acl_get_fd , -.Fn acl_get_fd_np -.Pp -These functions are described in -.Xr acl_get 3 , -and may be used to retrieve ACLs from file system objects. -.Pp -.Fn acl_init -.Pp -This function is described in -.Xr acl_init 3 , -and may be used to allocate a fresh (empty) ACL structure. -.Pp -.Fn acl_dup -.Pp -This function is described in -.Xr acl_dup 3 , -and may be used to duplicate an ACL structure. -.Pp -.Fn acl_set_file , -.Fn acl_set_fd , -.Fn acl_set_fd_np -.Pp -These functions are described in -.Xr acl_set 3 , -and may be used to assign an ACL to a file system object. -.Pp -.Fn acl_to_text -.Pp -This function is described in -.Xr acl_to_text 3 , -and may be used to generate a text-form of a POSIX.1e semantics ACL. -.Pp -.Fn acl_valid , -.Fn acl_valid_file_np , -.Fn acl_valid_fd_np -.Pp -Thee functions are described in -.Xr acl_valid 3 , -and may be used to validate an ACL as correct POSIX.1e-semantics, or -as appropriate for a particular file system object regardless of semantics. -.Pp -Documentation of the internal kernel interfaces backing these calls may -be found in -.Xr acl 9 . -The syscalls between the internal interfaces and the public library -routines may change over time, and as such are not documented. -They are not intended to be called directly without going through the -library. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh ENVIRONMENT -POSIX.1e assigns security labels to all objects, extending the security -functionality described in POSIX.1. -These additional labels provide fine-grained discretionary access control, -fine-grained capabilities, and labels necessary for mandatory access -control. -POSIX.2c describes a set of userland utilities for manipulating these -labels. -.\" .Sh FILES -.Sh SEE ALSO -.Xr acl_dup 3 , -.Xr acl_free 3 , -.Xr acl_from_text 3 , -.Xr acl_get 3 , -.Xr acl_set 3 , -.Xr acl_to_text 3 , -.Xr acl_valid 3 , -.Xr acl 9 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -Discussion of the draft continues on the cross-platform POSIX.1e -implementation mailing list. -To join this list, see the -.Fx -POSIX.1e implementation page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 ; -.Fx 5.0 -was the first version to include a complete ACL implementation based -on extended attributes. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/acl_add_perm.3 b/lib/libposix1e/acl_add_perm.3 deleted file mode 100644 index 88b22fb..0000000 --- a/lib/libposix1e/acl_add_perm.3 +++ /dev/null @@ -1,87 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_ADD_PERM 3 -.Os -.Sh NAME -.Nm acl_add_perm -.Nd add permissions to a permission set -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_add_perm "acl_permset_t permset_d" "acl_perm_t perm" -.Sh DESCRIPTION -.Fn acl_add_perm -is a POSIX.1e call that adds the permission contained in -.Fa perm -to the permission set -.Fa permset_d . -.Pp -Note: it is not considered an error to attempt to add permissions -that already exist in the permission set. -.Sh RETURN VALUES -.Rv -std acl_add_perm -.Sh ERRORS -The -.Fn acl_add_perm -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa permset_d -is not a valid descriptor for a permission set within an ACL entry. -Argument -.Fa perm -does not contain a valid -.Vt acl_perm_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_clear_perms 3 , -.Xr acl_delete_perms 3 , -.Xr acl_get_permset 3 , -.Xr acl_set_permset 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_add_perm -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_add_perm -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_calc_mask.3 b/lib/libposix1e/acl_calc_mask.3 deleted file mode 100644 index c84b8c7..0000000 --- a/lib/libposix1e/acl_calc_mask.3 +++ /dev/null @@ -1,96 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_CALC_MASK 3 -.Os -.Sh NAME -.Nm acl_calc_mask -.Nd calculate and set ACL mask permissions -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_calc_mask "acl_t *acl_p" -.Sh DESCRIPTION -.Fn acl_calc_mask -is a POSIX.1e call that calculates and set the permissions -associated with the -.Dv ACL_MASK -ACL entry of the ACL referred to by -.Fa acl_p . -.Pp -The value of new permissions are the union of the permissions -granted by the -.Dv ACL_GROUP , ACL_GROUP_OBJ , ACL_USER -tag types which -match processes in the file group class contained in the ACL -referred to by -.Fa acl_p . -.Pp -If the ACL referred to by -.Fa acl_p -already contains an -.Dv ACL_MASK -entry, its permissions shall be -overwritten; if it does not contain an -.Dv ACL_MASK -entry, one shall -be added. -.Sh RETURN VALUES -.Rv -std acl_calc_mask -.Sh ERRORS -The -.Fn acl_calc_mask -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa acl_p -does not point to a pointer to a valid ACL. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get_entry 3 , -.Xr acl_valid 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_calc_mask -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_calc_mask -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_calc_mask.c b/lib/libposix1e/acl_calc_mask.c deleted file mode 100644 index ebacb02..0000000 --- a/lib/libposix1e/acl_calc_mask.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> - -/* - * acl_calc_mask() calculates and set the permissions associated - * with the ACL_MASK ACL entry. If the ACL already contains an - * ACL_MASK entry, its permissions shall be overwritten; if not, - * one shall be added. - */ -int -acl_calc_mask(acl_t *acl_p) -{ - acl_t acl_new; - int group_obj, i, mask_mode, mask_num, other_obj, user_obj; - - /* check args */ - if (!acl_p || !*acl_p || ((*acl_p)->acl_cnt < 3) || - ((*acl_p)->acl_cnt > ACL_MAX_ENTRIES)) { - errno = EINVAL; - return -1; - } - - acl_new = acl_dup(*acl_p); - if (!acl_new) - return -1; - - user_obj = group_obj = other_obj = mask_mode = 0; - mask_num = -1; - - /* gather permissions and find a mask entry */ - for (i = 0; i < acl_new->acl_cnt; i++) { - switch(acl_new->acl_entry[i].ae_tag) { - case ACL_USER_OBJ: - user_obj++; - break; - case ACL_OTHER: - other_obj++; - break; - case ACL_GROUP_OBJ: - group_obj++; - /* FALLTHROUGH */ - case ACL_GROUP: - case ACL_USER: - mask_mode |= - acl_new->acl_entry[i].ae_perm & ACL_PERM_BITS; - break; - case ACL_MASK: - mask_num = i; - break; - default: - errno = EINVAL; - acl_free(acl_new); - return -1; - /* NOTREACHED */ - } - } - if ((user_obj != 1) || (group_obj != 1) || (other_obj != 1)) { - errno = EINVAL; - acl_free(acl_new); - return -1; - } - /* if a mask entry already exists, overwrite the perms */ - if (mask_num != -1) { - acl_new->acl_entry[mask_num].ae_perm = mask_mode; - } else { - /* if no mask exists, check acl_cnt... */ - if (acl_new->acl_cnt == ACL_MAX_ENTRIES) { - errno = EINVAL; - acl_free(acl_new); - return -1; - } - /* ...and add the mask entry */ - acl_new->acl_entry[acl_new->acl_cnt].ae_tag = ACL_MASK; - acl_new->acl_entry[acl_new->acl_cnt].ae_id = 0; - acl_new->acl_entry[acl_new->acl_cnt].ae_perm = mask_mode; - acl_new->acl_cnt++; - } - - if (acl_valid(acl_new) == -1) { - errno = EINVAL; - acl_free(acl_new); - return -1; - } - - **acl_p = *acl_new; - acl_free(acl_new); - - return 0; -} diff --git a/lib/libposix1e/acl_clear_perms.3 b/lib/libposix1e/acl_clear_perms.3 deleted file mode 100644 index 1e327c8..0000000 --- a/lib/libposix1e/acl_clear_perms.3 +++ /dev/null @@ -1,77 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_CLEAR_PERMS 3 -.Os -.Sh NAME -.Nm acl_clear_perms -.Nd clear permissions from a permission set -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_clear_perms "acl_permset_t permset_d" -.Sh DESCRIPTION -.Fn acl_clear_perms -is a POSIX.1e call that clears all permissions from permissions set -.Fa permset_d . -.Sh RETURN VALUES -.Rv -std acl_clear_perms -.Sh ERRORS -The -.Fn acl_clear_perms -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa permset_d -is not a valid descriptor for a permission set. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_perm 3 , -.Xr acl_delete_perm 3 , -.Xr acl_get_permset 3 , -.Xr acl_set_permset 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_clear_perms -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_clear_perms -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_copy.c b/lib/libposix1e/acl_copy.c deleted file mode 100644 index 86a24cc..0000000 --- a/lib/libposix1e/acl_copy.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> -#include <string.h> - -/* - * acl_copy_entry() - copy the contents of ACL entry src_d to - * ACL entry dest_d - */ -int -acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d) -{ - - if (!src_d || !dest_d || (src_d == dest_d)) { - errno = EINVAL; - return -1; - } - - dest_d->ae_tag = src_d->ae_tag; - dest_d->ae_id = src_d->ae_id; - dest_d->ae_perm = src_d->ae_perm; - - return 0; -} - -ssize_t -acl_copy_ext(void *buf_p, acl_t acl, ssize_t size) -{ - - errno = ENOSYS; - return -1; -} - -acl_t -acl_copy_int(const void *buf_p) -{ - - errno = ENOSYS; - return NULL; -} diff --git a/lib/libposix1e/acl_copy_entry.3 b/lib/libposix1e/acl_copy_entry.3 deleted file mode 100644 index ce8d60f..0000000 --- a/lib/libposix1e/acl_copy_entry.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_COPY_ENTRY 3 -.Os -.Sh NAME -.Nm acl_copy_entry -.Nd copy an ACL entry to another ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_copy_entry "acl_entry_t dest_d" "acl_entry_t src_d" -.Sh DESCRIPTION -.Fn acl_copy_entry -is a POSIX.1e call that copies the contents of ACL entry -.Fa src_d -to ACL entry -.Fa dest_d . -.Sh RETURN VALUES -.Rv -std acl_copy_entry -.Sh ERRORS -The -.Fn acl_copy_entry -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa src_d -or -.Fa dest_d -is not a valid descriptor for an ACL entry, or -arguments -.Fa src_d -and -.Fa dest_d -reference the same ACL entry. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get_entry 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_copy_entry -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_copy_entry -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_create_entry.3 b/lib/libposix1e/acl_create_entry.3 deleted file mode 100644 index 1b94312..0000000 --- a/lib/libposix1e/acl_create_entry.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 16, 2001 -.Dt ACL_CREATE_ENTRY 3 -.Os -.Sh NAME -.Nm acl_create_entry -.Nd create a new ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_create_entry "acl_t *acl_p" "acl_entry_t *entry_p" -.Sh DESCRIPTION -.Fn acl_create_entry -is a POSIX.1e call that creates a new ACL entry in the ACL -pointed to by -.Fa acl_p . -.Sh RETURN VALUES -.Rv -std acl_create_entry -.Sh ERRORS -The -.Fn acl_create_entry -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa acl_p -does not point to a pointer to a valid ACL. -.It Bq Er ENOMEM -The ACL working storage requires more memory than is -allowed by the hardware or system-imposed memory -management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_delete_entry 3 , -.Xr acl_get_entry 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_create_entry -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_create_entry -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_delete.3 b/lib/libposix1e/acl_delete.3 deleted file mode 100644 index 9ab46db..0000000 --- a/lib/libposix1e/acl_delete.3 +++ /dev/null @@ -1,125 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_DELETE 3 -.Os FreeBSD -.Sh NAME -.Nm acl_delete_def_file , -.Nm acl_delete_fd_np , -.Nm acl_delete_file_np -.Nd delete an ACL from a file -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_delete_def_file "const char *path_p" -.Ft int -.Fn acl_delete_file_np "const char *path_p" "acl_type_t type" -.Ft int -.Fn acl_delete_fd_np "int filedes" "acl_type_t type" -.Sh DESCRIPTION -The -.Fn acl_delete_def_file , -.Fn acl_delete_file_np , -and -.Fn acl_delete_fd_np -each allow the deletion of an ACL from a file. -.Fn acl_delete_def_file -is a POSIX.1e call that deletes the default ACL from a file (normally a -directory) by name; the other two calls are non-portable extensions that -allow deleting of arbitrary ACL types from a file/directory by either path -name, or by file descriptor. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -In the event of success, 0 is returned. In the event of failure, -1 is -returned, and -.Va errno -is set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, these functions shall return -1 -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EACCES -Search permission is denied for a component of the path prefix, or the -object exists and the process does not have appropriate access rights. -.It Bq Er EBADF -The -.Va fd -argument is not a valid file descriptor. -.It Bq Er EINVAL -The ACL type passed is invalid for this file object. -.It Bq Er ENAMETOOLONG -A component of a pathname exceeded 255 characters, or an -entire path name exceeded 1023 characters. -.It Bq Er ENOENT -The named object does not exist, or the -.Va path_p -argument points to an empty string. -.It Bq Er ENOMEM -Insufficient memory available to fulfill request. -.It Bq Er ENOTDIR -A component of the path prefix is not a directory. -.Pp -Argument -.Va path_p -must be a directory, and is not. -.It Bq Er EOPNOTSUPP -The file system does not support ACL deletion. -.It Bq Er EPERM -The process does not have appropriate privilege to perform the operation -to delete an ACL. -.It Bq Er EROFS -The file system is read-only. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get 3 , -.Xr acl_set 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_delete.c b/lib/libposix1e/acl_delete.c deleted file mode 100644 index 36d50af..0000000 --- a/lib/libposix1e/acl_delete.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_delete_def_file -- remove a default acl from a file - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <sys/errno.h> - -int -acl_delete_def_file(const char *path_p) -{ - - return (__acl_delete_file(path_p, ACL_TYPE_DEFAULT)); -} - - -int -acl_delete_file_np(const char *path_p, acl_type_t type) -{ - - return (__acl_delete_file(path_p, type)); -} - - -int -acl_delete_fd_np(int filedes, acl_type_t type) -{ - - return (__acl_delete_fd(filedes, type)); -} diff --git a/lib/libposix1e/acl_delete_entry.3 b/lib/libposix1e/acl_delete_entry.3 deleted file mode 100644 index 453f72d..0000000 --- a/lib/libposix1e/acl_delete_entry.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_DELETE_ENTRY 3 -.Os -.Sh NAME -.Nm acl_delete_entry -.Nd delete an ACL entry from an ACL -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_delete_entry "acl_t acl" "acl_entry_t entry_d" -.Sh DESCRIPTION -.Fn acl_delete_entry -is a POSIX.1e call that removes the ACL entry -.Fa entry_d -from ACL -.Fa acl . -.Sh RETURN VALUES -.Rv -std acl_delete_entry -.Sh ERRORS -The -.Fn acl_delete_entry -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa acl -does not point to a valid ACL. Argument -.Fa entry_d -is not a valid descriptor for an ACL entry in -.Fa acl . -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_copy_entry 3 , -.Xr acl_get_entry 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_delete_entry -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_delete_entry -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_delete_entry.c b/lib/libposix1e/acl_delete_entry.c deleted file mode 100644 index d1f25d2..0000000 --- a/lib/libposix1e/acl_delete_entry.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* acl_delete_entry() - delete an ACL entry from an ACL */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <errno.h> -#include <string.h> - -int -acl_delete_entry(acl_t acl, acl_entry_t entry_d) -{ - int i; - - if (!acl || !entry_d || (acl->acl_cnt < 1) || - (acl->acl_cnt > ACL_MAX_ENTRIES)) { - errno = EINVAL; - return -1; - } - for (i = 0; i < acl->acl_cnt; i++) { - /* if this is our entry... */ - if ((acl->acl_entry[i].ae_tag == entry_d->ae_tag) && - (acl->acl_entry[i].ae_id == entry_d->ae_id)) { - /* ...shift the remaining entries... */ - while (i < acl->acl_cnt - 1) - acl->acl_entry[i] = acl->acl_entry[++i]; - /* ...drop the count and zero the unused entry... */ - acl->acl_cnt--; - bzero(&acl->acl_entry[i], sizeof(struct acl_entry)); - return 0; - } - } - - - errno = EINVAL; - return -1; -} diff --git a/lib/libposix1e/acl_delete_perm.3 b/lib/libposix1e/acl_delete_perm.3 deleted file mode 100644 index 1fbb51e..0000000 --- a/lib/libposix1e/acl_delete_perm.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_DELETE_PERM 3 -.Os -.Sh NAME -.Nm acl_delete_perm -.Nd delete permissions from a permission set -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_delete_perm "acl_permset_t permset_d" "acl_perm_t perm" -.Sh DESCRIPTION -.Fn acl_delete_perm -is a POSIX.1e call that removes specific permissions from permissions set -.Fa perm . -.Sh RETURN VALUES -.Rv -std acl_delete_perm -.Sh ERRORS -The -.Fn acl_delete_perm -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa permset_d -is not a valid descriptor for a permission set. Argument -.Fa perm -does not contain a valid -.Vt acl_perm_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_perm 3 , -.Xr acl_clear_perms 3 , -.Xr acl_get_permset 3 , -.Xr acl_set_permset 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_delete_perm -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_delete_perm -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_dup.3 b/lib/libposix1e/acl_dup.3 deleted file mode 100644 index 8ed7915..0000000 --- a/lib/libposix1e/acl_dup.3 +++ /dev/null @@ -1,106 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_DUP 3 -.Os FreeBSD -.Sh NAME -.Nm acl_dup -.Nd duplicate an ACL -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft acl_t -.Fn acl_dup "acl_t acl" -.Sh DESCRIPTION -The -.Fn acl_dup -function returns a pointer to a copy of the ACL pointed to by the argument -.Va acl . -.Pp -This function may cause memory to be allocated. The caller should free any -releasable memory, when the new ACL is no longer required, by calling -.Xr acl_free 3 -with the -.Va (void*)acl_t -as an argument. -.Pp -Any existing ACL pointers that refer to the ACL referred to by -.Va acl -shall continue to refer to the ACL. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, this function shall return a pointer to the -duplicate ACL. Otherwise, a value of -.Va (acl_t)NULL -shall be returned, and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_init -function shall return a value of -.Va (acl_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Va acl -does not point to a valid ACL. -.It Bq Er ENOMEM -The -.Va acl_t -to be returned requires more memory than is allowed by the hardware or -system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_free 3 , -.Xr acl_get 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_entry.c b/lib/libposix1e/acl_entry.c deleted file mode 100644 index a8755e9..0000000 --- a/lib/libposix1e/acl_entry.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> -#include <stdlib.h> - -#define ACL_UNDEFINED_ID -1 -#define ACL_UNDEFINED_TAG -1 - -int -acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p) -{ - acl_t acl; - struct acl_entry newentry; - - if (!acl_p || !*acl_p || ((*acl_p)->acl_cnt >= ACL_MAX_ENTRIES) || - ((*acl_p)->acl_cnt < 0)) { - errno = EINVAL; - return -1; - } - - entry_p = malloc(sizeof(acl_entry_t)); - if (!entry_p) - return -1; - *entry_p = malloc(sizeof(struct acl_entry)); - if (!*entry_p) - return -1; - - acl = *acl_p; - - **entry_p = acl->acl_entry[acl->acl_cnt]; - - (**entry_p).ae_tag = ACL_UNDEFINED_TAG; - (**entry_p).ae_id = ACL_UNDEFINED_ID; - (**entry_p).ae_perm = ACL_PERM_NONE; - - acl->acl_entry[acl->acl_cnt] = newentry; - acl->acl_cnt++; - - **entry_p = newentry; - - /* XXX - ok? */ - free(*entry_p); - free(entry_p); - - return 0; -} - -int -acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p) -{ - - errno = ENOSYS; - return -1; -} diff --git a/lib/libposix1e/acl_free.3 b/lib/libposix1e/acl_free.3 deleted file mode 100644 index df6ac0e..0000000 --- a/lib/libposix1e/acl_free.3 +++ /dev/null @@ -1,90 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_FREE 3 -.Os FreeBSD -.Sh NAME -.Nm acl_free -.Nd free ACL working state -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_free "void *obj_p" -.Sh DESCRIPTION -The -.Fn acl_free -call allows the freeing of ACL working space, such as is allocated by -.Xr acl_dup 3 , -or -.Xr acl_from_text 3 . -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -In the event of success, 0 is returned. In the event of failure, -1 is -returned, and -.Va errno -is set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_free -function shall return -1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of the -.Va obj_p -argument is invalid. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_dup 3 , -.Xr acl_from_text 3 , -.Xr acl_get 3 , -.Xr acl_init 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_free.c b/lib/libposix1e/acl_free.c deleted file mode 100644 index ab73018..0000000 --- a/lib/libposix1e/acl_free.c +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_free -- free ACL objects from user memory - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <sys/errno.h> -#include <stdlib.h> - -int -acl_free(void *obj_p) -{ - - free(obj_p); - return (0); -} diff --git a/lib/libposix1e/acl_from_text.3 b/lib/libposix1e/acl_from_text.3 deleted file mode 100644 index 41f36b8..0000000 --- a/lib/libposix1e/acl_from_text.3 +++ /dev/null @@ -1,123 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_FROM_TEXT 3 -.Os FreeBSD -.Sh NAME -.Nm acl_from_text -.Nd create an ACL from text -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft acl_t -.Fn acl_from_text "const char *buf_p" -.Sh DESCRIPTION -The -.Fn acl_from_text -function converts the text form of an ACL referred to by -.Va buf_p -into the internal working structure for ACLs, appropriate for applying to -files or manipulating. -.Pp -This function may cause memory to be allocated. The caller should free any -releasable memory, when the new ACL is no longer required, by calling -.Xr acl_free 3 -with the -.Va (void *)acl_t -as an argument. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a pointer to the -internal representation of the ACL in working storage. Otherwise, a value -of -.Va (acl_t)NULL -shall be returned, and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_from_text -function shall return a value of -.Va (acl_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Va buf_p -cannot be translated into an ACL. -.It Bq Er ENOMEM -The ACL working storage requires more memory than is allowed by the -hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_free 3 , -.Xr acl_get 3 , -.Xr acl_to_text 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. -.Pp -.Fn acl_from_text -and -.Fn acl_to_text -rely on the -.Xr getpwent 3 -library calls to manage username and uid mapping, as well as the -.Xr getgrent 3 -library calls to manage groupname and gid mapping. These calls are not -thread safe, and so transitively, neither are -.Fn acl_from_text -and -.Fn acl_to_text . -These functions may also interfere with stateful -calls associated with the -.Fn getpwent -and -.Fn getgrent -calls. diff --git a/lib/libposix1e/acl_from_text.c b/lib/libposix1e/acl_from_text.c deleted file mode 100644 index a772024..0000000 --- a/lib/libposix1e/acl_from_text.c +++ /dev/null @@ -1,231 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_from_text: Convert a text-form ACL from a string to an acl_t. - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <sys/errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "acl_support.h" - -static char * -string_skip_whitespace(char *string) -{ - - while (*string && ((*string == ' ') || (*string == '\t'))) { - string++; - } - return (string); -} - -static void -string_trim_trailing_whitespace(char *string) -{ - char *end; - - if (*string == '\0') - return; - - end = string + strlen(string) - 1; - - while (end != string) { - if ((*end == ' ') || (*end == '\t')) { - *end = '\0'; - end--; - } else { - return; - } - } - - return; -} - -acl_tag_t -acl_string_to_tag(char *tag, char *qualifier) -{ - - if (*qualifier == '\0') { - if ((!strcmp(tag, "user")) || (!strcmp(tag, "u"))) { - return (ACL_USER_OBJ); - } else - if ((!strcmp(tag, "group")) || (!strcmp(tag, "g"))) { - return (ACL_GROUP_OBJ); - } else - if ((!strcmp(tag, "mask")) || (!strcmp(tag, "m"))) { - return (ACL_MASK); - } else - if ((!strcmp(tag, "other")) || (!strcmp(tag, "o"))) { - return (ACL_OTHER); - } else - return(-1); - } else { - if ((!strcmp(tag, "user")) || (!strcmp(tag, "u"))) { - return(ACL_USER); - } else - if ((!strcmp(tag, "group")) || (!strcmp(tag, "g"))) { - return(ACL_GROUP); - } else - return(-1); - } -} - -/* - * acl_from_text -- Convert a string into an ACL. - * Postpone most validity checking until the end and call acl_valid() to do - * that. - */ -acl_t -acl_from_text(const char *buf_p) -{ - acl_tag_t t; - acl_perm_t p; - acl_t acl; - uid_t id; - char *mybuf_p, *line, *cur, *notcomment, *comment, *entry; - char *tag, *qualifier, *permission; - int error; - - /* Local copy we can mess up. */ - mybuf_p = strdup(buf_p); - if (!mybuf_p) - return(NULL); - - acl = acl_init(3); - if (!acl) { - free(mybuf_p); - return(NULL); - } - - /* Outer loop: delimit at \n boundaries. */ - cur = mybuf_p; - while ((line = strsep(&cur, "\n"))) { - /* Now split the line on the first # to strip out comments. */ - comment = line; - notcomment = strsep(&comment, "#"); - - /* Inner loop: delimit at ',' boundaries. */ - while ((entry = strsep(¬comment, ","))) { - /* Now split into three ':' delimited fields. */ - tag = strsep(&entry, ":"); - if (!tag) { - errno = EINVAL; - goto error_label; - } - tag = string_skip_whitespace(tag); - if ((*tag == '\0') && (!entry)) { - /* - * Is an entirely comment line, skip to next - * comma. - */ - continue; - } - string_trim_trailing_whitespace(tag); - - qualifier = strsep(&entry, ":"); - if (!qualifier) { - errno = EINVAL; - goto error_label; - } - qualifier = string_skip_whitespace(qualifier); - string_trim_trailing_whitespace(qualifier); - - permission = strsep(&entry, ":"); - if ((!permission) || (entry)) { - errno = EINVAL; - goto error_label; - } - permission = string_skip_whitespace(permission); - string_trim_trailing_whitespace(permission); - - t = acl_string_to_tag(tag, qualifier); - if (t == -1) { - errno = EINVAL; - goto error_label; - } - - error = _posix1e_acl_string_to_perm(permission, &p); - if (error == -1) { - errno = EINVAL; - goto error_label; - } - - switch(t) { - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_MASK: - case ACL_OTHER: - if (*qualifier != '\0') { - errno = EINVAL; - goto error_label; - } - id = 0; - break; - - case ACL_USER: - case ACL_GROUP: - error = _posix1e_acl_name_to_id(t, qualifier, - &id); - if (error == -1) - goto error_label; - break; - - default: - errno = EINVAL; - goto error_label; - } - - error = _posix1e_acl_add_entry(acl, t, id, p); - if (error == -1) - goto error_label; - } - } - -#if 0 - /* XXX Should we only return ACLs valid according to acl_valid? */ - /* Verify validity of the ACL we read in. */ - if (acl_valid(acl) == -1) { - errno = EINVAL; - goto error_label; - } -#endif - - return(acl); - -error_label: - acl_free(acl); - free(mybuf_p); - return(NULL); -} - - - diff --git a/lib/libposix1e/acl_get.3 b/lib/libposix1e/acl_get.3 deleted file mode 100644 index ed017d7..0000000 --- a/lib/libposix1e/acl_get.3 +++ /dev/null @@ -1,139 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_GET 3 -.Os FreeBSD -.Sh NAME -.Nm acl_get_fd , -.Nm acl_get_fd_np , -.Nm acl_get_file -.Nd get an ACL for a file -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft acl_t -.Fn acl_get_file "const char *path_p" "acl_type_t type" -.Ft acl_t -.Fn acl_get_fd "int fd" -.Ft acl_t -.Fn acl_get_fd_np "int fd" "acl_type_t type" -.Sh DESCRIPTION -The -.Fn acl_get_file , -.Fn acl_get_fd , -and -.Fn acl_get_fd_np -each allow the retrieval of an ACL from a file. -.Fn acl_get_file -is a POSIX.1e call that allows the retrieval of a -specified type of ACL from a file by name; -.Fn acl_get_fd -is a POSIX.1e call that allows the retrieval of an ACL of type -ACL_TYPE_ACCESS -from a file descriptor. -.Fn acl_get_fd_np -is a non-portable form of -.Fn acl_get_fd -that allows the retrieval of any type of ACL from a file descriptor. -.Pp -This function may cause memory to be allocated. The caller should free -any releasable memory, when the new ACL is no longer required, by calling -.Xr acl_free 3 -with the -.Va (void *)acl_t -as an argument. -.Pp -The ACL in the working storage is an independent copy of the ACL associated -with the object referred to by -.Va fd . -The ACL in the working storage shall not participate in any access control -decisions. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a pointer to the ACL -that was retrieved. Otherwise, a value of -.Va (acl_t)NULL -shall be returned, and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_get_fd -function shall return a value of -.Va (acl_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EACCES -Search permission is denied for a component of the path prefix, or the -object exists and the process does not have appropriate access rights. -.It Bq Er EBADF -The -.Va fd -argument is not a valid file descriptor. -.It Bq Er EINVAL -The ACL type passed is invalid for this file object. -.It Bq Er ENAMETOOLONG -A component of a pathname exceeded 255 characters, or an -entire path name exceeded 1023 characters. -.It Bq Er ENOENT -The named object does not exist, or the -.Va path_p -argument points to an empty string. -.It Bq Er ENOMEM -Insufficient memory available to fulfill request. -.It Bq Er EOPNOTSUPP -The file system does not support ACL retrieval. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_free 3 , -.Xr acl_get 3 , -.Xr acl_set 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_get.c b/lib/libposix1e/acl_get.c deleted file mode 100644 index 00a1928..0000000 --- a/lib/libposix1e/acl_get.c +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_get_file - syscall wrapper for retrieving ACL by filename - * acl_get_fd - syscall wrapper for retrieving access ACL by fd - * acl_get_fd_np - syscall wrapper for retrieving ACL by fd (non-POSIX) - * acl_get_permset() returns the permission set in the ACL entry - * acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry - * acl_get_tag_type() returns the tag type for the ACL entry entry_d - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -acl_t -acl_get_file(const char *path_p, acl_type_t type) -{ - struct acl *aclp; - int error; - - aclp = acl_init(ACL_MAX_ENTRIES); - if (!aclp) { - return (NULL); - } - - error = __acl_get_file(path_p, type, aclp); - if (error) { - acl_free(aclp); - return (NULL); - } - - return (aclp); -} - -acl_t -acl_get_fd(int fd) -{ - struct acl *aclp; - int error; - - aclp = acl_init(ACL_MAX_ENTRIES); - if (!aclp) { - return (NULL); - } - - error = __acl_get_fd(fd, ACL_TYPE_ACCESS, aclp); - if (error) { - acl_free(aclp); - return (NULL); - } - - return (aclp); -} - -acl_t -acl_get_fd_np(int fd, acl_type_t type) -{ - struct acl *aclp; - int error; - - aclp = acl_init(ACL_MAX_ENTRIES); - if (!aclp) { - return (NULL); - } - - error = __acl_get_fd(fd, type, aclp); - if (error) { - acl_free(aclp); - return (NULL); - } - - return (aclp); -} - -int -acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p) -{ - - if (!entry_d || !permset_p) { - errno = EINVAL; - return -1; - } - - *permset_p = &entry_d->ae_perm; - - return 0; -} - -void * -acl_get_qualifier(acl_entry_t entry_d) -{ - uid_t *retval; - - if (!entry_d) { - errno = EINVAL; - return NULL; - } - - switch(entry_d->ae_tag) { - case ACL_USER: - case ACL_GROUP: - retval = malloc(sizeof(uid_t)); - if (retval) { - *retval = entry_d->ae_id; - return retval; - } - } - - errno = EINVAL; - return NULL; -} - -int -acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p) -{ - - if (!entry_d || !tag_type_p) { - errno = EINVAL; - return -1; - } - - *tag_type_p = entry_d->ae_tag; - - return 0; -} diff --git a/lib/libposix1e/acl_get_permset.3 b/lib/libposix1e/acl_get_permset.3 deleted file mode 100644 index b607257..0000000 --- a/lib/libposix1e/acl_get_permset.3 +++ /dev/null @@ -1,81 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_GET_PERMSET 3 -.Os -.Sh NAME -.Nm acl_get_permset -.Nd retrieve permission set from an ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_get_permset "acl_entry_t entry_d" "acl_permset_t *permset_p" -.Sh DESCRIPTION -.Fn acl_get_permset -is a POSIX.1e call that returns via -.Fa permset_p -a descriptor to the permission set in the ACL entry -.Fa entry_d . -Subsequent operations using the returned permission set operate -on the permission set within the ACL entry. -.Sh RETURN VALUES -.Rv -std acl_get_permset -.Sh ERRORS -The -.Fn acl_get_permset -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -is not a valid descriptor for an ACL entry. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_perm 3 , -.Xr acl_clear_perms 3 , -.Xr acl_delete_perm 3 , -.Xr acl_set_permset 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_get_permset -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_get_permset -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_get_qualifier.3 b/lib/libposix1e/acl_get_qualifier.3 deleted file mode 100644 index 1a73e0e..0000000 --- a/lib/libposix1e/acl_get_qualifier.3 +++ /dev/null @@ -1,136 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 13, 2001 -.Dt ACL_GET_QUALIFIER 3 -.Os -.Sh NAME -.Nm acl_get_qualifier -.Nd retrieve the qualifier from an ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft void * -.Fn acl_get_qualifier "acl_entry_t entry_d" -.Sh DESCRIPTION -.Fn acl_get_qualifier -is a POSIX.1e call that retrieves the qualifier of the tag for -the ACL entry indicated by the argument -.Fa entry_d -into working storage and returns a pointer to that storage. -.Pp -If the value of the tag type in the ACL entry referred to by -.Fa entry_d -is -.Dv ACL_USER , -then the value returned by -.Fn acl_get_qualifier -will be a pointer to type -.Vt uid_t . -.Pp -If the value of the tag type in -the ACL entry referred to by -.Fa entry_d -is -.Dv ACL_GROUP , -then the value returned by -.Fn acl_get_qualifier -will be a pointer to type -.Vt gid_t . -.Pp -If the value of the tag type in the ACL enty referred to by -.Fa entry_d -is -.Dv ACL_UNDEFINED_TAG , ACL_USER_OBJ , ACL_GROUP_OBJ , -.Dv ACL_OTHER , ACL_MASK , -or an implementation-defined value for which a qualifier -is not supported, then -.Fn acl_get_qualifier -will return a value of -.Vt ( void * ) Ns Dv NULL -and the function will fail. -.Pp -This function may cause memory to be allocated. The caller should -free any releasable memory, when the new qualifier is no longer -required, by calling -.Fn acl_free -with -.Vt void * -as the argument. -.Sh RETURN VALUES -The -.Fn acl_get_qualifier -function returns a pointer to the allocated storage if successful; -otherwise a -.Dv NULL -pointer is returned and the global variable -.Va errno -is set to indicate the error. -.Sh ERRORS -The -.Fn acl_get_qualifier -fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -does not point to a valid descriptor for an ACL entry. The -value of the tag type in the ACL entry referenced by argument -.Fa entry_d -is not -.Dv ACL_USER -or -.Dv ACL_GROUP . -.It Bq Er ENOMEM -The value to be returned requires more memory than is allowed -by the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_create_entry 3 , -.Xr acl_free 3 , -.Xr acl_get_entry 3 , -.Xr acl_get_tag_type 3 , -.Xr acl_set_qualifier 3 , -.Xr acl_set_tag_type 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_get_qualifier -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_get_qualifier -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_get_tag_type.3 b/lib/libposix1e/acl_get_tag_type.3 deleted file mode 100644 index 8294e1a..0000000 --- a/lib/libposix1e/acl_get_tag_type.3 +++ /dev/null @@ -1,83 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_GET_TAG_TYPE 3 -.Os -.Sh NAME -.Nm acl_get_tag_type -.Nd calculate and set ACL mask permissions -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_get_tag_type "acl_entry_t entry_d" "acl_tag_t *tag_type_p" -.Sh DESCRIPTION -.Fn acl_get_tag_type -is a POSIX.1e call that returs the tag type for the ACL entry -.Fa entry_d . -Upon successful completion, the location referred to by the argument -.Fa tag_type_p -will be set to the tag type of the ACL entry -.Fa entry_d . -.Sh RETURN VALUES -.Rv -std acl_get_tag_type -.Sh ERRORS -The -.Fn acl_get_tag_type -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -is not a valid descriptor for an ACL entry; -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_create_entry 3 , -.Xr acl_get_entry 3 , -.Xr acl_get_qualifier 3 , -.Xr acl_init 3 , -.Xr acl_set_qualifier 3 , -.Xr acl_set_tag_type 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_get_tag_type -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_get_tag_type -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_init.3 b/lib/libposix1e/acl_init.3 deleted file mode 100644 index f6c75fe..0000000 --- a/lib/libposix1e/acl_init.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_INIT 3 -.Os FreeBSD -.Sh NAME -.Nm acl_init -.Nd initialize ACL working storage -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft acl_t -.Fn acl_init "int count" -.Sh DESCRIPTION -The -.Fn acl_init -function allocates and initializes the working storage for an ACL of at -least -.Va count -ACL entries. A pointer to the working storage is returned. The working -storage allocated to contain the ACL is freed by a call to -.Xr acl_free 3 . -When the area is first allocated, it shall contain an an ACL that contains -no ACL entries. -.Pp -This function may cause memory to be allocated. The caller should free any -releasable memory, when the new ACL is no longer required, by calling -.Xr acl_free 3 -with the -.Va (void*)acl_t -as an argument. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, this function shall return a pointer to the -working storage. Otherwise, a value of -.Va (acl_t)NULL -shall be returned, and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_init -function shall return a value of -.Va (acl_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of count is less than zero. -.It Bq Er ENOMEM -The -.Va acl_t -to be returned requires more memory than is allowed by the hardware or -system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_free 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_init.c b/lib/libposix1e/acl_init.c deleted file mode 100644 index 1963ed0..0000000 --- a/lib/libposix1e/acl_init.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_init -- return a fresh acl structure - * acl_dup -- duplicate an acl and return the new copy - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -acl_t -acl_init(int count) -{ - struct acl *acl; - - if (count > ACL_MAX_ENTRIES) { - errno = ENOMEM; - return (NULL); - } - - acl = (struct acl *) malloc(sizeof(struct acl)); - if (acl != NULL) - bzero(acl, sizeof(struct acl)); - - return (acl); -} - -acl_t -acl_dup(acl_t acl) -{ - struct acl *acl_new; - - acl_new = acl_init(ACL_MAX_ENTRIES); - if (!acl_new) - return(NULL); - - *acl_new = *acl; - - return(acl_new); -} diff --git a/lib/libposix1e/acl_perm.c b/lib/libposix1e/acl_perm.c deleted file mode 100644 index 12ab17a..0000000 --- a/lib/libposix1e/acl_perm.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> -#include <string.h> - -/* - * acl_add_perm() adds the permission contained in perm to the - * permission set permset_d - */ -int -acl_add_perm(acl_permset_t permset_d, acl_perm_t perm) -{ - - if (!permset_d || (perm & !(ACL_PERM_BITS))) { - errno = EINVAL; - return -1; - } - - *permset_d |= perm; - - return 0; -} - -/* - * acl_clear_perms() clears all permisions from the permission - * set permset_d - */ -int -acl_clear_perms(acl_permset_t permset_d) -{ - - if (!permset_d) { - errno = EINVAL; - return -1; - } - - *permset_d = 0; - - return 0; -} - -/* - * acl_delete_perm() removes the permission in perm from the - * permission set permset_d - */ -int -acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm) -{ - - if (!permset_d) { - errno = EINVAL; - return -1; - } - - *permset_d &= ~(perm & ACL_PERM_BITS); - - return 0; -} diff --git a/lib/libposix1e/acl_set.3 b/lib/libposix1e/acl_set.3 deleted file mode 100644 index 60459bf..0000000 --- a/lib/libposix1e/acl_set.3 +++ /dev/null @@ -1,132 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_SET 3 -.Os FreeBSD -.Sh NAME -.Nm acl_set_fd , -.Nm acl_set_fd_np , -.Nm acl_set_file -.Nd get an ACL for a file -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_set_file "const char *path_p" "acl_type_t type" "acl_t acl" -.Ft int -.Fn acl_set_fd "int fd" "acl_t acl" -.Ft int -.Fn acl_set_fd_np "int fd" "acl_t acl" "acl_type_t type" -.Sh DESCRIPTION -The -.Fn acl_set_file , -.Fn acl_set_fd , -and -.Fn acl_set_fd_np -each associate an ACL with an object referred to by -.Va fd -or -.Va path_p . -All except -.Fn acl_set_fd_np -are POSIX.1e calls-- -.Fn acl_set_fd -allows only the setting of ACLs of type ACL_TYPE_ACCESS -where as -.Fn acl_set_fd_np -allows the setting of ACLs of any type. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, these functions shall return --1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EACCES -Search permission is denied for a component of the path prefix, or the -object exists and the process does not have appropriate access rights. -.It Bq Er EBADF -The -.Va fd -argument is not a valid file descriptor. -.It Bq Er EINVAL -Argument -.Va acl -does not point to a valid ACL for this object, or the ACL type -specified in -.Va type -is invalid for this object, or both. -.It Bq Er ENAMETOOLONG -A component of a pathname exceeded 255 characters, or an -entire path name exceeded 1023 characters. -.It Bq Er ENOENT -The named object does not exist, or the -.Va path_p -argument points to an empty string. -.It Bq Er ENOMEM -Insufficient memory available to fulfill request. -.It Bq Er ENOSPC -The directory or file system that would contain the new ACL cannot be -extended, or the file system is out of file allocation resources. -.It Bq Er EOPNOTSUPP -The file system does not support ACL retrieval. -.It Bq Er EROFS -This function requires modification of a file system which is currently -read-only. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_delete 3 , -.Xr acl_get 3 , -.Xr acl_valid 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_set.c b/lib/libposix1e/acl_set.c deleted file mode 100644 index 58be508..0000000 --- a/lib/libposix1e/acl_set.c +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_set_file -- set a file/directory ACL by name - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -#include "acl_support.h" - -/* - * For POSIX.1e-semantic ACLs, do a presort so the kernel doesn't have to - * (the POSIX.1e semantic code will reject unsorted ACL submission). If it's - * not a semantic that the library knows about, just submit it flat and - * assume the caller knows what they're up to. - */ -int -acl_set_file(const char *path_p, acl_type_t type, acl_t acl) -{ - int error; - - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } - - return (__acl_set_file(path_p, type, acl)); -} - -int -acl_set_fd(int fd, acl_t acl) -{ - int error; - - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return(-1); - } - - return (__acl_set_fd(fd, ACL_TYPE_ACCESS, acl)); -} - -int -acl_set_fd_np(int fd, acl_t acl, acl_type_t type) -{ - int error; - - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } - - return (__acl_set_fd(fd, type, acl)); -} - -/* - * acl_set_permset() sets the permissions of ACL entry entry_d - * with the permissions in permset_d - */ -int -acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d) -{ - - if (!entry_d) { - errno = EINVAL; - return -1; - } - - entry_d->ae_perm = *permset_d; - - return 0; -} - -/* - * acl_set_qualifier() sets the qualifier (ae_id) of the tag for - * ACL entry entry_d to the value referred to by tag_qualifier_p - */ -int -acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p) -{ - if (!entry_d || !tag_qualifier_p) { - errno = EINVAL; - return -1; - } - - switch(entry_d->ae_tag) { - case ACL_USER: - case ACL_GROUP: - entry_d->ae_id = (uid_t)tag_qualifier_p; - break; - default: - errno = EINVAL; - return -1; - } - - return 0; -} - -/* - * acl_set_tag_type() sets the tag type for ACL entry entry_d to the - * value of tag_type - */ -int -acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type) -{ - - if (!entry_d) { - errno = EINVAL; - return -1; - } - - switch(tag_type) { - case ACL_USER_OBJ: - case ACL_USER: - case ACL_GROUP_OBJ: - case ACL_GROUP: - case ACL_MASK: - case ACL_OTHER: - entry_d->ae_tag = tag_type; - return 0; - } - - errno = EINVAL; - return -1; -} diff --git a/lib/libposix1e/acl_set_permset.3 b/lib/libposix1e/acl_set_permset.3 deleted file mode 100644 index db63cd6..0000000 --- a/lib/libposix1e/acl_set_permset.3 +++ /dev/null @@ -1,79 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_SET_PERMSET 3 -.Os -.Sh NAME -.Nm acl_set_permset -.Nd set the permissions of an ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_set_permset "acl_entry_t entry_d" "acl_permset_t permset_d" -.Sh DESCRIPTION -.Fn acl_set_permset -is a POSIX.1e call that sets the permissions of ACL entry -.Fa entry_d -with the permissions contained in -.Fa permset_d . -.Sh RETURN VALUES -.Rv -std acl_set_permset -.Sh ERRORS -The -.Fn acl_set_permset -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -is not a valid descriptor for an ACL entry. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_perm 3 , -.Xr acl_clear_perms 3 , -.Xr acl_delete_perm 3 , -.Xr acl_get_permset 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_set_permset -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_set_permset -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_set_qualifier.3 b/lib/libposix1e/acl_set_qualifier.3 deleted file mode 100644 index 6df659e..0000000 --- a/lib/libposix1e/acl_set_qualifier.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_SET_QUALIFIER 3 -.Os -.Sh NAME -.Nm acl_set_qualifier -.Nd set ACL tag qualifier -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_set_qualifier "acl_entry_t entry_d" "const void *tag_qualifier_p" -.Sh DESCRIPTION -.Fn acl_set_qualifier -is a POSIX.1e call that sets the qualifier of the tag for the ACl entry -.Fa entry_d -to the value referred to by -.Fa tag_qualifier_p . -.Sh RETURN VALUES -.Rv -std acl_set_qualifier -.Sh ERRORS -The -.Fn acl_set_qualifier -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -is not a valid descriptor for an ACL entry. The tag type of the -ACL entry -.Fa entry_d -is not -.Dv ACL_USER -or -.Dv ACL_GROUP . -The value pointed to by -.Fa tag_qualifier_p -is not valid. -.It Bq Er ENOMEM -The value to be returned requires more memory than is allowed -by the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get_qualifier 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_get_qualifier -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_get_qualifier -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_set_tag_type.3 b/lib/libposix1e/acl_set_tag_type.3 deleted file mode 100644 index 21035ff..0000000 --- a/lib/libposix1e/acl_set_tag_type.3 +++ /dev/null @@ -1,78 +0,0 @@ -.\"- -.\" Copyright (c) 2001 Chris D. Faulhaber -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_SET_TAG_TYPE 3 -.Os -.Sh NAME -.Nm acl_set_tag_type -.Nd set the tag type of an ACL entry -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_set_tag_type "acl_entry_t entry_d" "acl_tag_t tag_type" -.Sh DESCRIPTION -.Fn acl_set_tag_type -is a POSIX.1e call that sets the ACL tag type of ACL entry -.Fa entry_d -to the value of -.Fa tag_type . -.Sh RETURN VALUES -.Rv -std acl_set_tag_type -.Sh ERRORS -The -.Fn acl_set_tag_type -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa entry_d -is not a valid descriptor for an ACL entry. Argument -.Fa tag_type -is not a valid ACL tag type. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get_tag_type 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_set_tag_type -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_set_tag_type -function was written by -.An Chris D. Faulhaber Aq jedgar@fxp.org . diff --git a/lib/libposix1e/acl_size.c b/lib/libposix1e/acl_size.c deleted file mode 100644 index 156b774..0000000 --- a/lib/libposix1e/acl_size.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2001 Chris D. Faulhaber - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/acl.h> - -#include <errno.h> - -ssize_t -acl_size(acl_t acl) -{ - - errno = ENOSYS; - return -1; -} diff --git a/lib/libposix1e/acl_support.c b/lib/libposix1e/acl_support.c deleted file mode 100644 index 6a9a141..0000000 --- a/lib/libposix1e/acl_support.c +++ /dev/null @@ -1,423 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * Support functionality for the POSIX.1e ACL interface - * These calls are intended only to be called within the library. - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <errno.h> -#include <grp.h> -#include <pwd.h> -#include <stdio.h> -#include <stdlib.h> - -#include "acl_support.h" - -#define ACL_STRING_PERM_WRITE 'w' -#define ACL_STRING_PERM_READ 'r' -#define ACL_STRING_PERM_EXEC 'x' -#define ACL_STRING_PERM_NONE '-' - -/* - * _posix1e_acl_entry_compare -- compare two acl_entry structures to - * determine the order they should appear in. Used by _posix1e_acl_sort to - * sort ACL entries into the kernel-desired order -- i.e., the order useful - * for evaluation and O(n) validity checking. Beter to have an O(nlogn) sort - * in userland and an O(n) in kernel than to have both in kernel. - */ -typedef int (*compare)(const void *, const void *); -static int -_posix1e_acl_entry_compare(struct acl_entry *a, struct acl_entry *b) -{ - /* - * First, sort between tags -- conveniently defined in the correct - * order for verification. - */ - if (a->ae_tag < b->ae_tag) - return (-1); - if (a->ae_tag > b->ae_tag) - return (1); - - /* - * Next compare uids/gids on appropriate types. - */ - - if (a->ae_tag == ACL_USER || a->ae_tag == ACL_GROUP) { - if (a->ae_id < b->ae_id) - return (-1); - if (a->ae_id > b->ae_id) - return (1); - - /* shouldn't be equal, fall through to the invalid case */ - } - - /* - * Don't know how to sort multiple entries of the rest--either it's - * a bad entry, or there shouldn't be more than one. Ignore and the - * validity checker can get it later. - */ - return (0); -} - -/* - * _posix1e_acl_sort -- sort ACL entries in POSIX.1e-formatted ACLs - * Give the opportunity to fail, althouh we don't currently have a way - * to fail. - */ -int -_posix1e_acl_sort(acl_t acl) -{ - - qsort(&acl->acl_entry[0], acl->acl_cnt, sizeof(struct acl_entry), - (compare) _posix1e_acl_entry_compare); - - return (0); -} - -/* - * acl_posix1e -- in what situations should we acl_sort before submission? - * We apply posix1e ACL semantics for any ACL of type ACL_TYPE_ACCESS or - * ACL_TYPE_DEFAULT - */ -int -_posix1e_acl(acl_t acl, acl_type_t type) -{ - - return ((type == ACL_TYPE_ACCESS) || (type == ACL_TYPE_DEFAULT)); -} - -/* - * _posix1e_acl_check -- given an ACL, check its validity. This is mirrored - * from code in sys/kern/kern_acl.c, and if changes are made in one, they - * should be made in the other also. This copy of acl_check is made - * available * in userland for the benefit of processes wanting to check ACLs - * for validity before submitting them to the kernel, or for performing - * in userland file system checking. Needless to say, the kernel makes - * the real checks on calls to get/setacl. - * - * See the comments in kernel for explanation -- just briefly, it assumes - * an already sorted ACL, and checks based on that assumption. The - * POSIX.1e interface, acl_valid(), will perform the sort before calling - * this. Returns 0 on success, EINVAL on failure. - */ -int -_posix1e_acl_check(struct acl *acl) -{ - struct acl_entry *entry; /* current entry */ - uid_t obj_uid=-1, obj_gid=-1, highest_uid=0, highest_gid=0; - int stage = ACL_USER_OBJ; - int i = 0; - int count_user_obj=0, count_user=0, count_group_obj=0, - count_group=0, count_mask=0, count_other=0; - - /* printf("_posix1e_acl_check: checking acl with %d entries\n", - acl->acl_cnt); */ - while (i < acl->acl_cnt) { - entry = &acl->acl_entry[i]; - - if ((entry->ae_perm | ACL_PERM_BITS) != ACL_PERM_BITS) - return (EINVAL); - - switch(entry->ae_tag) { - case ACL_USER_OBJ: - /* printf("_posix1e_acl_check: %d: ACL_USER_OBJ\n", - i); */ - if (stage > ACL_USER_OBJ) - return (EINVAL); - stage = ACL_USER; - count_user_obj++; - obj_uid = entry->ae_id; - break; - - case ACL_USER: - /* printf("_posix1e_acl_check: %d: ACL_USER\n", i); */ - if (stage > ACL_USER) - return (EINVAL); - stage = ACL_USER; - if (entry->ae_id == obj_uid) - return (EINVAL); - if (count_user && (entry->ae_id <= highest_uid)) - return (EINVAL); - highest_uid = entry->ae_id; - count_user++; - break; - - case ACL_GROUP_OBJ: - /* printf("_posix1e_acl_check: %d: ACL_GROUP_OBJ\n", - i); */ - if (stage > ACL_GROUP_OBJ) - return (EINVAL); - stage = ACL_GROUP; - count_group_obj++; - obj_gid = entry->ae_id; - break; - - case ACL_GROUP: - /* printf("_posix1e_acl_check: %d: ACL_GROUP\n", i); */ - if (stage > ACL_GROUP) - return (EINVAL); - stage = ACL_GROUP; - if (entry->ae_id == obj_gid) - return (EINVAL); - if (count_group && (entry->ae_id <= highest_gid)) - return (EINVAL); - highest_gid = entry->ae_id; - count_group++; - break; - - case ACL_MASK: - /* printf("_posix1e_acl_check: %d: ACL_MASK\n", i); */ - if (stage > ACL_MASK) - return (EINVAL); - stage = ACL_MASK; - count_mask++; - break; - - case ACL_OTHER: - /* printf("_posix1e_acl_check: %d: ACL_OTHER\n", i); */ - if (stage > ACL_OTHER) - return (EINVAL); - stage = ACL_OTHER; - count_other++; - break; - - default: - /* printf("_posix1e_acl_check: %d: INVALID\n", i); */ - return (EINVAL); - } - i++; - } - - if (count_user_obj != 1) - return (EINVAL); - - if (count_group_obj != 1) - return (EINVAL); - - if (count_mask != 0 && count_mask != 1) - return (EINVAL); - - if (count_other != 1) - return (EINVAL); - - return (0); -} - - -/* - * Given a uid/gid, return a username/groupname for the text form of an ACL - * XXX NOT THREAD SAFE, RELIES ON GETPWUID, GETGRGID - * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE - * MAY HAVE SIDE-EFFECTS - */ -int -_posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf) -{ - struct group *g; - struct passwd *p; - int i; - - switch(tag) { - case ACL_USER: - p = getpwuid(id); - if (!p) - i = snprintf(buf, buf_len, "%d", id); - else - i = snprintf(buf, buf_len, "%s", p->pw_name); - - if (i >= buf_len) { - errno = ENOMEM; - return (-1); - } - return (0); - - case ACL_GROUP: - g = getgrgid(id); - if (!g) - i = snprintf(buf, buf_len, "%d", id); - else - i = snprintf(buf, buf_len, "%s", g->gr_name); - - if (i >= buf_len) { - errno = ENOMEM; - return (-1); - } - return (0); - - default: - return (EINVAL); - } -} - - -/* - * Given a username/groupname from a text form of an ACL, return the uid/gid - * XXX NOT THREAD SAFE, RELIES ON GETPWNAM, GETGRNAM - * XXX USES *PW* AND *GR* WHICH ARE STATEFUL AND THEREFORE THIS ROUTINE - * MAY HAVE SIDE-EFFECTS - * - * XXX currently doesn't deal correctly with a numeric uid being passed - * instead of a username. What is correct behavior here? Check chown. - */ -int -_posix1e_acl_name_to_id(acl_tag_t tag, char *name, uid_t *id) -{ - struct group *g; - struct passwd *p; - unsigned long l; - char *endp; - - switch(tag) { - case ACL_USER: - p = getpwnam(name); - if (p == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(uid_t)l) { - errno = EINVAL; - return (-1); - } - *id = (uid_t)l; - return (0); - } - *id = p->pw_uid; - return (0); - - case ACL_GROUP: - g = getgrnam(name); - if (g == NULL) { - l = strtoul(name, &endp, 0); - if (*endp != '\0' || l != (unsigned long)(gid_t)l) { - errno = EINVAL; - return (-1); - } - *id = (gid_t)l; - return (0); - } - *id = g->gr_gid; - return (0); - - default: - return (EINVAL); - } -} - - -/* - * Given a right-shifted permission (i.e., direct ACL_PERM_* mask), fill - * in a string describing the permissions. - */ -int -_posix1e_acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, char *buf) -{ - - if (buf_len < _POSIX1E_ACL_STRING_PERM_MAXSIZE + 1) { - errno = ENOMEM; - return (-1); - } - - if ((perm | ACL_PERM_BITS) != ACL_PERM_BITS) { - errno = EINVAL; - return (-1); - } - - buf[3] = 0; /* null terminate */ - - if (perm & ACL_PERM_READ) - buf[0] = ACL_STRING_PERM_READ; - else - buf[0] = ACL_STRING_PERM_NONE; - - if (perm & ACL_PERM_WRITE) - buf[1] = ACL_STRING_PERM_WRITE; - else - buf[1] = ACL_STRING_PERM_NONE; - - if (perm & ACL_PERM_EXEC) - buf[2] = ACL_STRING_PERM_EXEC; - else - buf[2] = ACL_STRING_PERM_NONE; - - return (0); -} - -/* - * given a string, return a permission describing it - */ -int -_posix1e_acl_string_to_perm(char *string, acl_perm_t *perm) -{ - acl_perm_t myperm = ACL_PERM_NONE; - char *ch; - - ch = string; - while (*ch) { - switch(*ch) { - case ACL_STRING_PERM_READ: - myperm |= ACL_PERM_READ; - break; - case ACL_STRING_PERM_WRITE: - myperm |= ACL_PERM_WRITE; - break; - case ACL_STRING_PERM_EXEC: - myperm |= ACL_PERM_EXEC; - break; - case ACL_STRING_PERM_NONE: - break; - default: - return (EINVAL); - } - ch++; - } - - *perm = myperm; - return (0); -} - -/* - * Add an ACL entry without doing much checking, et al - */ -int -_posix1e_acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, acl_perm_t perm) -{ - struct acl_entry *e; - - if (acl->acl_cnt >= ACL_MAX_ENTRIES) { - errno = ENOMEM; - return (-1); - } - - e = &(acl->acl_entry[acl->acl_cnt]); - e->ae_perm = perm; - e->ae_tag = tag; - e->ae_id = id; - acl->acl_cnt++; - - return (0); -} diff --git a/lib/libposix1e/acl_support.h b/lib/libposix1e/acl_support.h deleted file mode 100644 index a907e52..0000000 --- a/lib/libposix1e/acl_support.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * Support functionality for the POSIX.1e ACL interface - * These calls are intended only to be called within the library. - */ -#ifndef _ACL_SUPPORT_H -#define _ACL_SUPPORT_H - -#define _POSIX1E_ACL_STRING_PERM_MAXSIZE 3 /* read, write, exec */ - -int _posix1e_acl_check(struct acl *acl); -int _posix1e_acl_sort(acl_t acl); -int _posix1e_acl(acl_t acl, acl_type_t type); -int _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, - char *buf); -int _posix1e_acl_name_to_id(acl_tag_t tag, char *name, uid_t *id); -int _posix1e_acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, - char *buf); -int _posix1e_acl_string_to_perm(char *string, acl_perm_t *perm); -int _posix1e_acl_add_entry(acl_t acl, acl_tag_t tag, uid_t id, - acl_perm_t perm); - -#endif diff --git a/lib/libposix1e/acl_to_text.3 b/lib/libposix1e/acl_to_text.3 deleted file mode 100644 index e49fdfa..0000000 --- a/lib/libposix1e/acl_to_text.3 +++ /dev/null @@ -1,133 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_TO_TEXT 3 -.Os FreeBSD -.Sh NAME -.Nm acl_to_text -.Nd convert an ACL to Text -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft char * -.Fn acl_to_text "acl_t acl" "ssize_t *len_p" -.Sh DESCRIPTION -The -.Fn acl_to_text -function translates the ACL pointed to by argument -.Va acl -into a NULL terminated character string. If the pointer -.Va len_p -is not NULL, then the function shall return the length of the string (not -including the NULL terminator) in the location pointed to by -.Va len_p . -The format of the text string returned by -.Fn acl_to_text -shall be the POSIX.1e long ACL form. -.Pp -This function allocates any memory necessary to contain the string and -returns a pointer to the string. The caller should free any releasable -memory, when the new string is no longer required, by calling -.Xr acl_free 3 -with the -.Va (void*)char -as an argument. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a pointer to the -long text form of an ACL. Otherwise, a value of -.Va (char*)NULL -shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn acl_to_text -function shall return a value of -.Va (acl_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Va acl -does not point to a valid ACL. -.Pp -The ACL denoted by -.Va acl -contains one or more improperly formed ACL entries, or for some other -reason cannot be translated into a text form of an ACL. -.It Bq Er ENOMEM -The character string to be returned requires more memory than is allowed -by the hardware or software-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_free 3 , -.Xr acl_from_text 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. -.Pp -.Fn acl_from_text -and -.Fn acl_to_text -rely on the -.Xr getpwent 3 -library calls to manage username and uid mapping, as well as the -.Xr getgrent 3 -library calls to manage groupname and gid mapping. These calls are not -thread safe, and so transitively, neither are -.Fn acl_from_text -and -.Fn acl_to_text . -These functions may also interfere with stateful -calls associated with the -.Fn getpwent -and -.Fn getgrent -calls. diff --git a/lib/libposix1e/acl_to_text.c b/lib/libposix1e/acl_to_text.c deleted file mode 100644 index 70f8b07..0000000 --- a/lib/libposix1e/acl_to_text.c +++ /dev/null @@ -1,225 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 20001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_to_text - return a text string with a text representation of the acl - * in it. - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <sys/errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <utmp.h> - -#include "acl_support.h" - -/* - * acl_to_text - generate a text form of an acl - * spec says nothing about output ordering, so leave in acl order - * - * This function will not produce nice results if it is called with - * a non-POSIX.1e semantics ACL. - */ -char * -acl_to_text(acl_t acl, ssize_t *len_p) -{ - char *buf, *tmpbuf; - char name_buf[UT_NAMESIZE+1]; - char perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1], - effective_perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1]; - int i, error, len; - uid_t ae_id; - acl_tag_t ae_tag; - acl_perm_t ae_perm, effective_perm, mask_perm; - - buf = strdup(""); - if (!buf) - return(NULL); - - mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ - for (i = 0; i < acl->acl_cnt; i++) - if (acl->acl_entry[i].ae_tag == ACL_MASK) - mask_perm = acl->acl_entry[i].ae_perm; - - for (i = 0; i < acl->acl_cnt; i++) { - ae_tag = acl->acl_entry[i].ae_tag; - ae_id = acl->acl_entry[i].ae_id; - ae_perm = acl->acl_entry[i].ae_perm; - - switch(ae_tag) { - case ACL_USER_OBJ: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - len = asprintf(&tmpbuf, "%suser::%s\n", buf, - perm_buf); - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - case ACL_USER: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - - error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf); - if (error) - goto error_label; - - effective_perm = ae_perm & mask_perm; - if (effective_perm != ae_perm) { - error = _posix1e_acl_perm_to_string( - effective_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, - effective_perm_buf); - if (error) - goto error_label; - len = asprintf(&tmpbuf, "%suser:%s:%s\t\t# " - "effective: %s\n", - buf, name_buf, perm_buf, - effective_perm_buf); - } else { - len = asprintf(&tmpbuf, "%suser:%s:%s\n", buf, - name_buf, perm_buf); - } - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - case ACL_GROUP_OBJ: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - - effective_perm = ae_perm & mask_perm; - if (effective_perm != ae_perm) { - error = _posix1e_acl_perm_to_string( - effective_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, - effective_perm_buf); - if (error) - goto error_label; - len = asprintf(&tmpbuf, "%sgroup::%s\t\t# " - "effective: %s\n", - buf, perm_buf, effective_perm_buf); - } else { - len = asprintf(&tmpbuf, "%sgroup::%s\n", buf, - perm_buf); - } - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - case ACL_GROUP: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - - error = _posix1e_acl_id_to_name(ae_tag, ae_id, - UT_NAMESIZE+1, name_buf); - if (error) - goto error_label; - - effective_perm = ae_perm & mask_perm; - if (effective_perm != ae_perm) { - error = _posix1e_acl_perm_to_string( - effective_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, - effective_perm_buf); - if (error) - goto error_label; - len = asprintf(&tmpbuf, "%sgroup::%s\t\t# " - "effective: %s\n", - buf, perm_buf, effective_perm_buf); - } else { - len = asprintf(&tmpbuf, "%sgroup:%s:%s\n", buf, - name_buf, perm_buf); - } - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - case ACL_MASK: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - - len = asprintf(&tmpbuf, "%smask::%s\n", buf, - perm_buf); - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - case ACL_OTHER: - error = _posix1e_acl_perm_to_string(ae_perm, - _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); - if (error) - goto error_label; - - len = asprintf(&tmpbuf, "%sother::%s\n", buf, - perm_buf); - if (len == -1) - goto error_label; - free(buf); - buf = tmpbuf; - break; - - default: - errno = EINVAL; - goto error_label; - } - } - - if (len_p) { - *len_p = strlen(buf); - } - return (buf); - -error_label: - /* jump to here sets errno already, we just clean up */ - if (buf) free(buf); - return (NULL); -} diff --git a/lib/libposix1e/acl_valid.3 b/lib/libposix1e/acl_valid.3 deleted file mode 100644 index aeae264..0000000 --- a/lib/libposix1e/acl_valid.3 +++ /dev/null @@ -1,147 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 28, 2000 -.Dt ACL_VALID 3 -.Os FreeBSD -.Sh NAME -.Nm acl_valid , -.Nm acl_valid_fd_np , -.Nm acl_valid_file_np -.Nd validate an ACL -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.Ft int -.Fn acl_valid "acl_t acl" -.Ft int -.Fn acl_valid_fd_np "int fd" "acl_type_t type" "acl_t acl" -.Ft int -.Fn acl_valid_file_np "const char *path_p" "acl_type_t type" "acl_t acl" -.Sh DESCRIPTION -These functions check that the ACL referred to by the argument -.Va acl -is valid. The POSIX.1e routine, -.Fn acl_valid , -checks this validity only with POSIX.1e ACL semantics, and irrespective -of the context in which the ACL is to be used. The non-portable forms, -.Fn acl_valid_fd_np -and -.Fn acl_valid_file_np , -allow an ACL to be checked in the context of a specific acl type, -.Va type , -and file system object. In environments where additional ACL types are -supported than just POSIX.1e, this makes more sense. -.Pp -For POSIX.1e semantics, the checks include: -.Bd -literal -offset indent -The three required entries (ACL_USER_OBJ, ACL_GROUP_OBJ, -and ACL_OTHER) shall exist exactly once in the ACL. If -the ACL contains any ACL_USER, ACL_GROUP, or any other -implementation-defined entries in the file group class -then one ACL_MASK entry shall also be required. The ACL -shall contain at most on ACL_MASK entry. -.Pp -The qualifier field shall be unique among all entries of -the same POSIX.1e ACL facility defined tag type. The -tag type field shall contain valid values including any -implementation-defined values. Validation of the values -of the qualifier field is implementation-defined. -.Ed -.Pp -The POSIX.1e -.Fn acl_valid -function may reorder the ACL for the purposes of verification; the -non-portable validation functions will not. -.Sh IMPLEMENTATION NOTES -.Fx Ns 's -support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, these functions shall return --1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EACCES -Search permission is denied for a component of the path prefix, or the -object exists and the process does not have appropriate access rights. -.It Bq Er EBADF -The -.Va fd -argument is not a valid file descriptor. -.It Bq Er EINVAL -Argument -.Va acl -does not point to a valid ACL. -.Pp -One or more of the required ACL entries is not present in -.Va acl . -.Pp -The ACL contains entries that are not unique. -.Pp -The file system rejects the ACL based on fs-specific semantics issues. -.It Bq Er ENAMETOOLONG -A component of a pathname exceeded 255 characters, or an -entire path name exceeded 1023 characters. -.It Bq Er ENOENT -The named object does not exist, or the -.Va path_p -argument points to an empty string. -.It Bq Er ENOMEM -Insufficient memory available to fulfill request. -.It Bq Er EOPNOTSUPP -The file system does not support ACL retrieval. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_get 3 , -.Xr acl_init 3 , -.Xr acl_set 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -These features are not yet fully implemented. diff --git a/lib/libposix1e/acl_valid.c b/lib/libposix1e/acl_valid.c deleted file mode 100644 index 8c7ca67..0000000 --- a/lib/libposix1e/acl_valid.c +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * Copyright (c) 1999, 2000, 20001 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * acl_valid -- POSIX.1e ACL check routine - */ - -#include <sys/types.h> -#include <sys/acl.h> -#include <sys/errno.h> - -#include "acl_support.h" - -/* - * acl_valid: accepts an ACL, returns 0 on valid ACL, -1 for invalid, - * and errno set to EINVAL. - * - * Implemented by calling the acl_check routine in acl_support, which - * requires ordering. We call acl_support's _posix1e_acl_sort to make this - * true. POSIX.1e allows acl_valid() to reorder the ACL as it sees fit. - * - * This call is deprecated, as it doesn't ask whether the ACL is valid - * for a particular target. However, this call is standardized, unlike - * the other two forms. - */ -int -acl_valid(acl_t acl) -{ - int error; - - _posix1e_acl_sort(acl); - error = _posix1e_acl_check(acl); - if (error) { - errno = error; - return (-1); - } else { - return (0); - } -} - - -int -acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl) -{ - int error; - - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } - - return (__acl_aclcheck_file(pathp, type, acl)); -} - - -int -acl_valid_fd_np(int fd, acl_type_t type, acl_t acl) -{ - int error; - - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } - - return (__acl_aclcheck_fd(fd, type, acl)); -} diff --git a/lib/libposix1e/cap.3 b/lib/libposix1e/cap.3 deleted file mode 100644 index 36752a1..0000000 --- a/lib/libposix1e/cap.3 +++ /dev/null @@ -1,340 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP 3 -.Os FreeBSD -.Sh NAME -.Nm cap -.Nd introduction to the POSIX.1e Capability security API -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Sh DESCRIPTION -The POSIX.1e Capability interface allows processes to manipulate their -capability set, subject to capability manipulation restrictions imposed -by the kernel. Using the capability API, a process may request a copy -of its capability state, modify the copy of the state, and resubmit the -state for use, if permitted. -.Pp -A variety of functions are provided for manipulating and managing -process capability state and working store state: -.Bl -tag -width cap_from_textXX -.It Fn cap_init -This function is described in -.Xr cap_init 3 , -and may be used to allocate a fresh capability structure with no capability -flags set. -.It Fn cap_clear -This function is described in -.Xr cap_clear 3 , -and clears all capability flags in a capability structure. -.It Fn cap_dup -This function is described in -.Xr cap_dup 3 , -and may be used to duplicate a capability structure. -.It Fn cap_free -This function is described in -.Xr cap_free 3 , -and may be used to free a capability structure. -.It Fn cap_from_text -This function is described in -.Xr cap_from_text 3 , -and may be used to convert a text-form capability to its internal -representation. -.It Fn cap_get_flag -This function, described in -.Xr cap_get_flag 3 , -allows retrieval of a capability flag value from capability state in -working store. -.It Fn cap_get_proc -This function, described in -.Xr cap_get_proc 3 , -allows retrieval of capability state for the current process. -.It Fn cap_set_flag -This function, described in -.Xr cap_set_flag 3 , -allows setting of capability flag values in a capability structure held -in the working store. -.It Fn cap_set_proc -This function, described in -.Xr cap_set_proc 3 , -allows setting of the current process capability state. -.It Fn cap_to_text -This function, described in -.Xr cap_to_text 3 , -converts a capability from its internal representation to one that is -(more) readable by humans. -.El -.Pp -A number of capabilities exist, each mapping to the ability to violate -a particular aspect of the system policy. -Each capability in a capability set has three flags, indicating the -status of the capability with respect to the file or process it is -associated with. -.Bl -tag -width CAP_INHERITABLEXX -.It Dv CAP_EFFECTIVE -If true, the capability will be used as necessary during accesses by -the process. -.It Dv CAP_INHERITABLE -If true, the capability will be passed through -.Xr execve 2 -invocations as appropriate. -.It Dv CAP_PERMITTED -If true, the capability is permitted for the process. -.El -.Pp -Capability inheritence occurs when processes invoke the -.Xr exec 3 -call, resulting in internal invocation of the -.Xr execve 2 -system call. -At that time, a processes capabilities are re-evaluated using a set of -fixed algorithms. -These algorithms take into account the starting capabilities of the process -and the capabilities of the file being executed. -.Pp -pI` = pI -.Pp -pP` = (fP & X) | (fI & pI) -.Pp -pE` = (fE & pP`) -.Pp -p[IPE] represent the starting processes inheritted, permitted, and -effective sets. -p'[IPE] represent the new inheritted, permitted, and effective sets. -f[IPE] represent the file's inheritted, permitted, and effective sets. -X represents a global bounding set, currently un-implemented. -.Pp -The following capabilities are defined and implemented in -.Fx 5.0 : -.Pp -.Bl -tag -width CAP_MAC_RELABEL_SUBJ -.It Dv CAP_CHOWN -This capability overrides the restriction that a process cannot change the -user ID of a file it owns, and the restriction that the group ID supplied in -the -.Xr chown 2 -function shall be equal to either the group ID or one of the supplementary -group IDs of the calling process. -.It Dv CAP_DAC_EXECUTE -This capability overrides file mode execute access restrictions when accessing -an object, and, if -.Xr posix1e 3 -ACLs are available, this capability overrides the ACL execute access -restrictions when accessing an object. -.It Dv CAP_DAC_WRITE -This capability overrides file mode write access restrictions when access an -object, and, if -.Xr posix1e 3 -ACLs are available, this capability also overrides the ACL write access -restrictions when accessing an object. -.It Dv CAP_DAC_READ_SEARCH -This capability overrides file mode read and search access restrictions -when accessing an object, and, if -.Xr posix1e 3 -ACLs are available, this capability overrides the ACL read and search access -restrictions when accessing an object. -.It Dv CAP_FOWNER -This capability overrides the requirements that the user ID associated -with a process be equal to the file owner ID, execpt in the cases where the -CAP_FSETID capability is applicable. -In general, this capability, when effective, permits a process to perform -all the functions that any file owner would have for their files. -.It Dv CAP_FSETID -This capability overrides the following restrictions: that the effective -user ID of the calling process shall match the file owner when setting the -set-user-ID (S_ISUID) and set-group-ID (S_ISGID) bits on the file; that -the effective group ID or one of the supplementary group IDs of the calling -process shall match the group ID of the file when setting the set-group-ID -bit of the file; and that the set-user-ID and set-group-ID bits of the file -mode shall be cleared upon successful return from -.Xr chown 2 . -.It Dv CAP_KILL -Thie capability shall override the restriction that the real or effective -user ID of a process sending a signal must match the real of effective user -ID of the receiving process. -.It Dv CAP_LINK_DIR -This capability is not available on the the FreeBSD platform. -On other platforms, this capabiity overrides the restriction that a process -cannot create or delete a hard link to a directory. -.It Dv CAP_SETFCAP -This capability overrides the restriction that a process cannot -set the file capability state of a file. -.It Dv CAP_SETGID -This capability overrides the restriction in the -.Xr setgid 2 -function that a process cannot change its real group ID or change its -effective group ID to a value other than its real group ID. -.It Dv CAP_SETUID -This capability overrides the restriction in the -.Xr setuid 2 -function that a process cannot change its real user ID or change its -effective user ID to a value other than the current real user ID. -.It Dv CAP_MAC_DOWNGRADE -This capability override the restriction that no process may downgrade -the MAC label of a file. -.It Dv CAP_MAC_READ -This capability overrides mandatory read access restrictions when accessing -objects. -.It Dv CAP_MAC_RELABEL_SUBJ -This capability overrides the restriction that a process may not modify -its own MAC label. -.It Dv CAP_MAC_UPGRADE -This capability overrides the restriction that no process may upgrade the -MAC label of a file. -.It Dv CAP_MAC_WRITE -This capability overrides the mandatory write access restrictions when -accessing objects. -.It Dv CAP_AUDIT_CONTROL -This capability overrides the restriction that a process cannot modify -audit control parameters. -.It Dv CAP_AUDIT_WRITE -This capability overrides the restriction that a process cannot write data -into the system audit trail. -.It Dv CAP_SETPCAP -This capability overrides the restriction that a process cannot expand its -capability set when invoking -.Xr cap_set_proc 3 . -.It Dv CAP_SYS_SETFFLAG -This capability overrides the restriction that a process cannot manipulate -the system file flags on a file system object. -For portability, equivilent to -.Dv CAP_LINUX_IMMUTABLE . -.It Dv CAP_NET_BIND_SERVICE -This capability overrides network namespace restrictions on process's -using the -.Xr bind 2 -system call. -For example, this capability, when effective, can be used by a process to -bind a port number below 1024 in the IPv4 or IPv6 port spaces. -.It Dv CAP_NET_BROADCAST -.It Dv CAP_NET_ADMIN -.It Dv CAP_NET_RAW -This capability overrides the restriction that a process cannot create a -raw socket. -.It Dv CAP_IPC_LOCK -.It Dv CAP_IPC_OWNER -.It Dv CAP_SYS_MODULE -This capability overrides the restriction that a process cannot load or -unload kernel modules. -.It Dv CAP_SYS_RAWIO -.It Dv CAP_SYS_CHROOT -This capability overrides the restriction that a process cannot invoke the -.Xr chroot 2 -or -.Xr jail 2 -system calls. -.It Dv CAP_SYS_PTRACE -This capability overrides the restriction that a process can only invoke -the -.Xr ptrace 2 -system call to debug another process if the target process has identical -real and effective user IDs. -.It Dv CAP_SYS_PACCT -This capability overrides the restriction that a process cannot enable, -configure, or disable system process accounting. -.It Dv CAP_SYS_ADMIN -.It Dv CAP_SYS_BOOT -This capability overrides the restriction that a process cannot invoke -the -.Xr boot 2 -system call. -.It Dv CAP_SYS_NICE -This capability overrides the restrictions that a process cannot use the -.Xr setpriority 2 -system call to decrease the priority to below that of itself, or modify the -priority of another process. -.It Dv CAP_SYS_RESOURCE -This capability overrides restrictions on how a process may modify its -soft and hard resource limits. -.It Dv CAP_SYS_TIME -This capability overrides the restriction that a process may not modify the -system date and time. -.It Dv CAP_SYS_TTY_CONFIG -.It Dv CAP_MKNOD -This capability overrides the restriction that a process may not create -device nodes. -.El -.Pp -Documentation of the internal kernel interfaces backing these calls may -be found in -.Xr cap 9 . -The system calls between the internal interfaces and the public library -routines may change over time, and as such are not documented. They are -not intended to be called directly without going through the library. -.Sh IMPLEMENTATION NOTES -Support for POSIX.1e interfaces and features in -.Fx -is still under development at this time. -.Pp -POSIX.1e assigns security labels to all objects, extending the security -functionality described in POSIX.1. These additional labels provide -fine-grained discretionary access control, fine-grained capabilities, -and labels necessary for mandatory access control. POSIX.2c describes -a set of userland utilities for manipulating these labels. These userland -utilities are not bundled with -.Fx 5.0 -so as to discourage their -use in the short term. -.\" .Sh FILES -.Sh SEE ALSO -.Xr cap_clear 3 , -.Xr cap_dup 3 , -.Xr cap_free 3 , -.Xr cap_get_flag 3 , -.Xr cap_get_proc 3 , -.Xr cap_init 3 , -.Xr cap_set_flag 3 , -.Xr cap_set_proc 3 , -.Xr cap 9 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.An Ilmar S Habibulin -.Sh BUGS -While -.Xr posix1e 3 -is fully implemented, supporting kernel code is not yet available in the -base distribution. -It is slated for inclusion prior to -.Fx 5.0 . diff --git a/lib/libposix1e/cap_clear.3 b/lib/libposix1e/cap_clear.3 deleted file mode 100644 index 8f5b548..0000000 --- a/lib/libposix1e/cap_clear.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_CLEAR 3 -.Os FreeBSD -.Sh NAME -.Nm cap_clear -.Nd Initialize a Capability State in Working Store -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft int -.Fn cap_clear "cap_t cap_p" -.Sh DESCRIPTION -The function -.Fn cap_clear -shall initialize the capability state in working storage identified by -.Ar cap_p -so that all capability flags for all capabilities defined in the -implementation shall be cleared. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_clear -function shall return -1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of the -.Va cap_p -argument does not refer to a capability state in the working storage. -Search permission is denied for a component of the path prefix, or the -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_init 3 , -.Xr cap_set_flag 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_clear.c b/lib/libposix1e/cap_clear.c deleted file mode 100644 index eb6b39a..0000000 --- a/lib/libposix1e/cap_clear.c +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - -#include <string.h> - -int -cap_clear(cap_t cap_p) -{ - - bzero(cap_p, sizeof(*cap_p)); - return (0); -} diff --git a/lib/libposix1e/cap_dup.3 b/lib/libposix1e/cap_dup.3 deleted file mode 100644 index 2e874a5..0000000 --- a/lib/libposix1e/cap_dup.3 +++ /dev/null @@ -1,105 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_DUP 3 -.Os FreeBSD -.Sh NAME -.Nm cap_dup -.Nd Duplicate a Capability State in Working Storage -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft cap_t -.Fn cap_dup "cap_t cap_p" -.Sh DESCRIPTION -The -.Fn cap_dup -function returns a duplicate capability state in working storage given the -source object -.Ar cap_p , -allocating any memory necessary, and returning a pointer to the newly -created capability state. -Once duplicated, no operations on the either capability state shall affect -the other in any way. -.Pp -This function may cause memory to be allocated. -The caller should free any releasable memory, when the capability state in -working storage is no longer required, by calling -.Fn cap_free -with the cap_t as an argument. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the -.Fn cap_dup -function returns a pointer to the newly created capability state in working -storage. -Otherwise, a value of -.Va (cap_t)NULL -shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_dup -function shall return -.Va (cap_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of the -.Va cap_p -argument does not refer to a capability state in the working storage. -.It Bq Er ENOMEM -The capability state to be returned requires more memory than is allowed by -the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_free 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_dup.c b/lib/libposix1e/cap_dup.c deleted file mode 100644 index 7aacc81..0000000 --- a/lib/libposix1e/cap_dup.c +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - -#include <string.h> - -cap_t -cap_dup(cap_t cap_p) -{ - cap_t newcap; - - if (!(newcap = cap_init())) - return(NULL); - - bcopy(cap_p, newcap, sizeof(*cap_p)); - - return (newcap); -} diff --git a/lib/libposix1e/cap_free.3 b/lib/libposix1e/cap_free.3 deleted file mode 100644 index d83f180..0000000 --- a/lib/libposix1e/cap_free.3 +++ /dev/null @@ -1,99 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_FREE 3 -.Os FreeBSD -.Sh NAME -.Nm cap_free -.Nd "Release Memory Allocated to a Capability State in Working Storage" -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft int -.Fn cap_free "void *obj_d" -.Sh DESCRIPTION -The function -.Fn cap_free -shall free any releasable memory currently allocated to the capability -state in working storage identified by -.Va obj_d . -The -.Va obj_d -argument may identify either a cap_t entity, or a char * entity allocated -by the -.Fn cap_to_text -function. -.Pp -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Va errno -set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_free -function shall return -1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of the -.Va cap_p -argument does not refer to a capability state in the working storage. -Search permission is denied for a component of the path prefix, or the -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_dup 3 , -.Xr cap_from_text 3 , -.Xr cap_get_fd 3 , -.Xr cap_get_file 3 , -.Xr cap_get_proc 3 , -.Xr cap_init 3 , -.Xr cap_to_text 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_free.c b/lib/libposix1e/cap_free.c deleted file mode 100644 index 3c77992..0000000 --- a/lib/libposix1e/cap_free.c +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - -#include <stdlib.h> - -int -cap_free(void *obj_d) -{ - - free(obj_d); - return (0); -} diff --git a/lib/libposix1e/cap_from_text.3 b/lib/libposix1e/cap_from_text.3 deleted file mode 100644 index 345d558..0000000 --- a/lib/libposix1e/cap_from_text.3 +++ /dev/null @@ -1,107 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd September 18, 2000 -.Dt CAP_FROM_TEXT 3 -.Os FreeBSD -.Sh NAME -.Nm cap_from_text -.Nd Convert Text to a Capability State in Working Store -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft cap_t -.Fn cap_from_text "const char *buf_p" -.Sh DESCRIPTION -This function allocates and initializes a capability state in working -storage. -It then sets the contents of this newly created capability state to the -state represented by the human-readable, null terminated character string -pointed to by -.Va buf_p . -.Pp -This function may cause memory to be allocated. -The caller should free any releasable memory, when the capability state in -working storage is no longer required, by calling -.Xr cap_free 3 -with the -.Va (void *)cap_t -as an argument. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function returns a pointer to the -internal representation of the capability in working storage. -Otherwise, a value of -.Va (cap_t)NULL -is returned, and -.Va errno -is set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_from_text -function shall return a value of -.Va (cap_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The -.Va buf_p -argument does not refer to a character string, the string pointed to by -.Va buf_p -is not parseable by the function, the text string contains a -capability name or a flag character that the implementation does not -recognize as valid. -.It Bq Er ENOMEM -The capability state to be returned requires more memory than is allowed -by the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_free 3 , -.Xr cap_init 3 , -.Xr cap_set_flag 3 , -.Xr cap_to_text 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_get_fd.c b/lib/libposix1e/cap_get_fd.c deleted file mode 100644 index 5b0197a..0000000 --- a/lib/libposix1e/cap_get_fd.c +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -#include <stdlib.h> - -cap_t -cap_get_fd(int fd) -{ - struct cap *cap; - int error; - - cap = cap_init(); - if (!cap) - return (NULL); - - error = __cap_get_fd(fd, cap); - if (error) { - errno = error; - cap_free(cap); - return (NULL); - } - - return (cap); -} diff --git a/lib/libposix1e/cap_get_file.c b/lib/libposix1e/cap_get_file.c deleted file mode 100644 index a74bc41..0000000 --- a/lib/libposix1e/cap_get_file.c +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -#include <stdlib.h> - -cap_t -cap_get_file(const char *path_p) -{ - struct cap *cap; - int error; - - cap = cap_init(); - if (!cap) - return (NULL); - - error = __cap_get_file(path_p, cap); - if (error) { - errno = error; - cap_free(cap); - return (NULL); - } - - return (cap); -} diff --git a/lib/libposix1e/cap_get_flag.3 b/lib/libposix1e/cap_get_flag.3 deleted file mode 100644 index 9e39e80..0000000 --- a/lib/libposix1e/cap_get_flag.3 +++ /dev/null @@ -1,94 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_GET_FLAG 3 -.Os FreeBSD -.Sh NAME -.Nm cap_get_flag -.Nd Get the Value of a Capability Flag -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft int -.Fn cap_get_flag "cap_t cap_p" "cap_value_t cap" "cap_flag_t flag" "cap_flag_value_t *value_p" -.Sh DESCRIPTION -The function -.Fn cap_get_flag -shall obtain the current value of the capability flag -.Ar flag -of the capability -.Ar cap -from the capability state in working storage identified by -.Ar cap_p -and place it into the location pointed to by -.Ar value_p . -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Va errno -set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_get_flag -function shall return -1 and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -At least one of the values of the -.Ar cap_p , -.Ar cap , -.Ar flag -and -.Ar value_p -arguments does not refer to the corresponding entity. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_set_flag 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_get_flag.c b/lib/libposix1e/cap_get_flag.c deleted file mode 100644 index 37595ee..0000000 --- a/lib/libposix1e/cap_get_flag.c +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -int -cap_get_flag(cap_t cap_p, cap_value_t cap, cap_flag_t flag, - cap_flag_value_t *value_p) -{ - u_int64_t mask; - - - switch(flag) { - case CAP_EFFECTIVE: - mask = cap_p->c_effective; - break; - case CAP_INHERITABLE: - mask = cap_p->c_inheritable; - break; - case CAP_PERMITTED: - mask = cap_p->c_permitted; - break; - default: - return (EINVAL); - } - - if (IS_CAP_SET(mask, cap)) - *value_p = CAP_SET; - else - *value_p = CAP_CLEAR; - - return (0); -} diff --git a/lib/libposix1e/cap_get_proc.3 b/lib/libposix1e/cap_get_proc.3 deleted file mode 100644 index 5032a67..0000000 --- a/lib/libposix1e/cap_get_proc.3 +++ /dev/null @@ -1,101 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_GET_PROC 3 -.Os FreeBSD -.Sh NAME -.Nm cap_get_proc -.Nd Obtain the Current Process Capability State -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft cap_t -.Fn cap_get_proc "void" -.Sh DESCRIPTION -The function -.Fn cap_get_proc -shall allocate a capability state in working storage, set its state to that -of the calling process, and return a pointer to the newly created -capability state. -.Pp -This function may cause memory to be allocated. -The caller should free any releasable memory, when the capability state in -the working storage is no longer required, by calling -.Fn cap_free -with the cap_t as an argument. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, this function shall return a cap_t value. -Otherwise, a value of -.Dv NULL -shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_get_proc -function shall return -.Dv NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er ENOMEM -The capability state to be returned requires more memory than is allowed -by the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_free 3 , -.Xr cap_init 3 , -.Xr cap_get_flag 3 , -.Xr cap_set_proc 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -While libposix1e is fully implemented, supporting kernel code is not -yet available in the base distribution. -It is slated for inclusion prior to 5.0-RELEASE. diff --git a/lib/libposix1e/cap_get_proc.c b/lib/libposix1e/cap_get_proc.c deleted file mode 100644 index d2bf96b..0000000 --- a/lib/libposix1e/cap_get_proc.c +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -#include <stdlib.h> - -cap_t -cap_get_proc(void) -{ - struct cap *cap; - int error; - - cap = cap_init(); - if (!cap) - return (NULL); - - error = __cap_get_proc(cap); - if (error) { - errno = error; - cap_free(cap); - return (NULL); - } - - return (cap); -} diff --git a/lib/libposix1e/cap_init.3 b/lib/libposix1e/cap_init.3 deleted file mode 100644 index 3e47c9f..0000000 --- a/lib/libposix1e/cap_init.3 +++ /dev/null @@ -1,97 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_INIT 3 -.Os FreeBSD -.Sh NAME -.Nm cap_init -.Nd Allocate and Initialize a Capability State in Working Storage -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft cap_t -.Fn cap_init "void" -.Sh DESCRIPTION -The function -.Fn cap_init -shall create a capability state in working storage and return a pointer to -the capability state. -The initial value of all flags for all capabilities defined by the -implementation shall be cleared. -.Pp -This function may cause memory to be allocated. -The caller should free any releasable memory, when the capability state in -working storage is no longer required, by calling -.Fn cap_free -with the cap_t as an argument. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the -.Fn cap_init -function returns a non-NULL cap_t value. -Otherwise, a value of -.Va (cap_t)NULL -shall be returned and -.Va errno -shall be set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_dup -function shall return -.Va (cap_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er ENOMEM -The capability state to be returned requires more memory than is allowed by -the hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_free 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_init.c b/lib/libposix1e/cap_init.c deleted file mode 100644 index 377c524..0000000 --- a/lib/libposix1e/cap_init.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -#include <stdlib.h> - -cap_t -cap_init(void) -{ - struct cap *cap; - - cap = malloc(sizeof(struct cap)); - if (!cap) { - errno = ENOMEM; - return (NULL); - } - cap_clear(cap); - - return (cap); -} diff --git a/lib/libposix1e/cap_set_fd.c b/lib/libposix1e/cap_set_fd.c deleted file mode 100644 index 70b7160..0000000 --- a/lib/libposix1e/cap_set_fd.c +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - -int -cap_set_fd(int fd, cap_t cap_p) -{ - - return (__cap_set_fd(fd, cap_p)); -} diff --git a/lib/libposix1e/cap_set_file.c b/lib/libposix1e/cap_set_file.c deleted file mode 100644 index 4aa202f..0000000 --- a/lib/libposix1e/cap_set_file.c +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - - -int -cap_set_file(const char *path_p, cap_t cap_p) -{ - - return (__cap_set_file(path_p, cap_p)); -} diff --git a/lib/libposix1e/cap_set_flag.3 b/lib/libposix1e/cap_set_flag.3 deleted file mode 100644 index bbfe063..0000000 --- a/lib/libposix1e/cap_set_flag.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_SET_FLAG 3 -.Os FreeBSD -.Sh NAME -.Nm cap_set_flag -.Nd Set the Value of a Capability Flag -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft int -.Fn cap_set_flag "cap_t cap_p" "cap_flag_t flag" "int ncap" "cap_value_t caps[]" "cap_flag_value_t value" -.Sh DESCRIPTION -This function shall set the flag -.Ar flag -of each capability in the array -.Ar caps -in the capability state in working storage identified by -.Ar cap_p -to -.Ar value . -The argument -.Ar ncap -is used to specify the number of capabilities in the array -.Ar caps . -Implementations may place restrictions on the setting of the flags in a capability state. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, this function shall return a value of zero. -Otherwise, a value of -1 shall be returned, and -.Ar errno -shall be set to indicate the error. -The capability state identified by -.Ar cap_p -shall not be affected if the return value is -1. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_set_flag -function shall return -1 and set -.Ar errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -At least one of the values of -.Ar cap_p , -.Ar ncap , -.Ar flag -and -.Ar value , -or at least one of the first -.Ar ncap -elements in -.Ar caps , -does not refer to the corresponding entity. -.Pp -The resulting capability state identified by -.Ar cap_p -violates one or more implementation restrictions. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_get_flag 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson diff --git a/lib/libposix1e/cap_set_flag.c b/lib/libposix1e/cap_set_flag.c deleted file mode 100644 index bf150e9..0000000 --- a/lib/libposix1e/cap_set_flag.c +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -int -cap_set_flag(cap_t cap_p, cap_flag_t flag, int ncap, cap_value_t caps[], - cap_flag_value_t value) -{ - u_int64_t *mask; - int i; - - switch(flag) { - case CAP_EFFECTIVE: - mask = &cap_p->c_effective; - break; - case CAP_INHERITABLE: - mask = &cap_p->c_inheritable; - break; - case CAP_PERMITTED: - mask = &cap_p->c_permitted; - break; - default: - return (EINVAL); - } - - if (value != CAP_SET && value != CAP_CLEAR) - return (EINVAL); - - for (i = 0; i < ncap; i++) - if (value == CAP_SET) - SET_CAPABILITY(*mask, caps[i]); - else - UNSET_CAPABILITY(*mask, caps[i]); - - return (0); -} diff --git a/lib/libposix1e/cap_set_proc.3 b/lib/libposix1e/cap_set_proc.3 deleted file mode 100644 index bd7ac91..0000000 --- a/lib/libposix1e/cap_set_proc.3 +++ /dev/null @@ -1,108 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.\" TrustedBSD Project - support for POSIX.1e process capabilities -.\" -.Dd April 1, 2000 -.Dt CAP_SET_PROC 3 -.Os FreeBSD -.Sh NAME -.Nm cap_set_proc -.Nd Set the Process Capability State -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft int -.Fn cap_set_proc "cap_t cap_p" -.Sh DESCRIPTION -The function -.Fn cap_set_proc -shall set the values for all capability flags for all capabilities defined -in the implementation with the capability state identified by -.Ar cap_p . -The new capability state of the process shall be completely determined by -the contents of -.Ar cap_p -upon successful return from this function. -If any flag in -.Ar cap_p -is set for any capability not currently permitted for the calling process, -the function shall fail, and the capability state of the process shall -remain unchanged. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, this function shall return a value of zero. -Otherwise, a value of -1 shall be returned and -.Ar errno -shall be set to indicate the error. -Neither the state represented in the object identified by -.Ar cap_p -nor the capability state of the calling process shall be affected if the -return value is -1. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_set_proc -function shall return -1 and set -.Ar errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -The value of the -.Ar cap_p -argument does not refer to a capability state in working storage. -.It Bq Er EPERM -The caller attempted to set a capability flag of a capability that was not -permitted to the invoking process. -.It Bq Er ENOMEM -This function requires more memory than is allowed by the hardware or -system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_get_proc 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -Support for POSIX.1e Capabilities was developed as part of the TrustedBSD -Project. -POSIX.1e Capability support was introduced in -.Fx 5.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -While libposix1e is fully implemented, supporting kernel code is not -yet available in the base distribution. -It is slated for inclusion prior to 5.0-RELEASE. diff --git a/lib/libposix1e/cap_set_proc.c b/lib/libposix1e/cap_set_proc.c deleted file mode 100644 index 14fb44b..0000000 --- a/lib/libposix1e/cap_set_proc.c +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> - -#include <sys/errno.h> - -int -cap_set_proc(cap_t cap_p) -{ - - return (__cap_set_proc(cap_p)); -} diff --git a/lib/libposix1e/cap_text.c b/lib/libposix1e/cap_text.c deleted file mode 100644 index 367ff20..0000000 --- a/lib/libposix1e/cap_text.c +++ /dev/null @@ -1,571 +0,0 @@ -/*- - * Copyright (c) 2000 Robert N. M. Watson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -/* - * TrustedBSD Project - support for POSIX.1e process capabilities - */ - -#include <sys/types.h> -#include <sys/capability.h> -#include <sys/errno.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -static const size_t CAP_MAX_BUF_LEN = 1024; -static const size_t CAP_MAX_SMALL_BUF_LEN = 64; - -static const char *CAP_FLAGS[8] = { - "", /* 000 */ - "e", /* 001 */ - "i", /* 010 */ - "ei", /* 011 */ - "p", /* 100 */ - "ep", /* 101 */ - "ip", /* 110 */ - "eip", /* 111 */ -}; - -static const char *CAP_SEP = ": \t"; -static const char *CAP_OPERATION = "=-+"; - -struct cap_info { - char *ci_name; - cap_value_t ci_cap; -}; - -static const struct cap_info cap_info_array[] = { -{"CAP_CHOWN", CAP_CHOWN}, -{"CAP_DAC_EXECUTE", CAP_DAC_EXECUTE}, -{"CAP_DAC_WRITE", CAP_DAC_WRITE}, -{"CAP_DAC_READ_SEARCH", CAP_DAC_READ_SEARCH}, -{"CAP_FOWNER", CAP_FOWNER}, -{"CAP_FSETID", CAP_FSETID}, -{"CAP_KILL", CAP_KILL}, -{"CAP_LINK_DIR", CAP_LINK_DIR}, -{"CAP_SETFCAP", CAP_SETFCAP}, -{"CAP_SETGID", CAP_SETGID}, -{"CAP_SETUID", CAP_SETUID}, -{"CAP_MAC_DOWNGRADE", CAP_MAC_DOWNGRADE}, -{"CAP_MAC_READ", CAP_MAC_READ}, -{"CAP_MAC_RELABEL_SUBJ", CAP_MAC_RELABEL_SUBJ}, -{"CAP_MAC_UPGRADE", CAP_MAC_UPGRADE}, -{"CAP_MAC_WRITE", CAP_MAC_WRITE}, -{"CAP_INF_NOFLOAT_OBJ", CAP_INF_NOFLOAT_OBJ}, -{"CAP_INF_NOFLOAT_SUBJ", CAP_INF_NOFLOAT_SUBJ}, -{"CAP_INF_RELABEL_OBJ", CAP_INF_RELABEL_OBJ}, -{"CAP_INF_RELABEL_SUBJ", CAP_INF_RELABEL_SUBJ}, -{"CAP_AUDIT_CONTROL", CAP_AUDIT_CONTROL}, -{"CAP_AUDIT_WRITE", CAP_AUDIT_WRITE}, -{"CAP_SETPCAP", CAP_SETPCAP}, -{"CAP_SYS_SETFFLAG", CAP_SYS_SETFFLAG}, -{"CAP_LINUX_IMMUTABLE", CAP_SYS_SETFFLAG}, -{"CAP_NET_BIND_SERVICE", CAP_NET_BIND_SERVICE}, -{"CAP_NET_BROADCAST", CAP_NET_BROADCAST}, -{"CAP_NET_ADMIN", CAP_NET_ADMIN}, -{"CAP_NET_RAW", CAP_NET_RAW}, -{"CAP_IPC_LOCK", CAP_IPC_LOCK}, -{"CAP_IPC_OWNER", CAP_IPC_OWNER}, -{"CAP_SYS_MODULE", CAP_SYS_MODULE}, -{"CAP_SYS_RAWIO", CAP_SYS_RAWIO}, -{"CAP_SYS_CHROOT", CAP_SYS_CHROOT}, -{"CAP_SYS_PTRACE", CAP_SYS_PTRACE}, -{"CAP_SYS_PACCT", CAP_SYS_PACCT}, -{"CAP_SYS_ADMIN", CAP_SYS_ADMIN}, -{"CAP_SYS_BOOT", CAP_SYS_BOOT}, -{"CAP_SYS_NICE", CAP_SYS_NICE}, -{"CAP_SYS_RESOURCE", CAP_SYS_RESOURCE}, -{"CAP_SYS_TIME", CAP_SYS_TIME}, -{"CAP_SYS_TTY_CONFIG", CAP_SYS_TTY_CONFIG}, -{"CAP_MKNOD", CAP_MKNOD}, -{"", CAP_ALL_OFF}, -{"all", CAP_ALL_ON}, -}; - -static const int cap_info_array_len = sizeof(cap_info_array) / - sizeof(cap_info_array[0]); - -static const cap_value_t cap_list[] = { -CAP_CHOWN, -CAP_DAC_EXECUTE, -CAP_DAC_WRITE, -CAP_DAC_READ_SEARCH, -CAP_FOWNER, -CAP_FSETID, -CAP_KILL, -CAP_LINK_DIR, -CAP_SETFCAP, -CAP_SETGID, -CAP_SETUID, -CAP_MAC_DOWNGRADE, -CAP_MAC_READ, -CAP_MAC_RELABEL_SUBJ, -CAP_MAC_UPGRADE, -CAP_MAC_WRITE, -CAP_INF_NOFLOAT_OBJ, -CAP_INF_NOFLOAT_SUBJ, -CAP_INF_RELABEL_OBJ, -CAP_INF_RELABEL_SUBJ, -CAP_AUDIT_CONTROL, -CAP_AUDIT_WRITE, -CAP_SETPCAP, -CAP_SYS_SETFFLAG, -CAP_NET_BIND_SERVICE, -CAP_NET_BROADCAST, -CAP_NET_ADMIN, -CAP_NET_RAW, -CAP_IPC_LOCK, -CAP_IPC_OWNER, -CAP_SYS_MODULE, -CAP_SYS_RAWIO, -CAP_SYS_CHROOT, -CAP_SYS_PTRACE, -CAP_SYS_PACCT, -CAP_SYS_ADMIN, -CAP_SYS_BOOT, -CAP_SYS_NICE, -CAP_SYS_RESOURCE, -CAP_SYS_TIME, -CAP_SYS_TTY_CONFIG, -CAP_MKNOD, -}; - -static const int cap_list_len = sizeof(cap_list) / sizeof(cap_list[0]); - -static void -cap_set(cap_t cap_p, cap_flag_t flags, cap_flag_value_t fvalue, - cap_value_t cap_value) -{ - - if (flags & CAP_EFFECTIVE) { - if (fvalue == CAP_SET) - cap_p->c_effective |= cap_value; - else - cap_p->c_effective &= ~cap_value; - } - if (flags & CAP_INHERITABLE) { - if (fvalue == CAP_SET) - cap_p->c_inheritable |= cap_value; - else - cap_p->c_inheritable &= ~cap_value; - } - if (flags & CAP_PERMITTED) { - if (fvalue == CAP_SET) - cap_p->c_permitted |= cap_value; - else - cap_p->c_permitted &= ~cap_value; - } -} - -static int -cap_is_set(cap_t cap_p, cap_flag_t cap_flag, cap_value_t cap_value) -{ - int seen = 0; - - if (cap_flag & CAP_EFFECTIVE) - seen |= (cap_p->c_effective & cap_value); - if (cap_flag & CAP_INHERITABLE) - seen |= (cap_p->c_inheritable & cap_value); - if (cap_flag & CAP_PERMITTED) - seen |= (cap_p->c_permitted & cap_value); - - return (seen); -} - -static cap_flag_value_t -cap_value_to_flags(cap_t cap_p, cap_value_t cap_value) -{ - cap_flag_t flags = 0; - - if (cap_p->c_effective & cap_value) - flags |= CAP_EFFECTIVE; - if (cap_p->c_inheritable & cap_value) - flags |= CAP_INHERITABLE; - if (cap_p->c_permitted & cap_value) - flags |= CAP_PERMITTED; - - return (flags); -} - -static const char * -cap_flags_to_string(cap_flag_t flags) -{ - - return (CAP_FLAGS[flags]); -} - -static int -cap_string_to_flags(const char *string, cap_flag_t *flags) -{ - const char *c = string; - - *flags = 0; - while (*c != '\0') { - switch (*c) { - case 'e': - *flags |= CAP_EFFECTIVE; - break; - case 'i': - *flags |= CAP_INHERITABLE; - break; - case 'p': - *flags |= CAP_PERMITTED; - break; - default: - return (EINVAL); - } - c++; - } - - return (0); -} - -static const char * -cap_to_string(cap_value_t cap) -{ - int i; - - for (i = 0; i < cap_info_array_len; i++) { - if (cap_info_array[i].ci_cap == cap) - return (cap_info_array[i].ci_name); - } - - return (NULL); -} - -static int -cap_from_string(const char *string, cap_value_t *cap) -{ - int i; - - for (i = 0; i < cap_info_array_len; i++) { - if (!strcasecmp(cap_info_array[i].ci_name, string)) { - *cap = cap_info_array[i].ci_cap; - return (0); - } - } - - return (EINVAL); -} - -char * -cap_to_text(cap_t cap_p, ssize_t *len_p) -{ - cap_value_t cap_value; - cap_flag_t cap_flag, most_flag; - const char *flag_s, *value_s, *prefix_s; - char *buf, minibuf[CAP_MAX_SMALL_BUF_LEN], operation; - - int num_effective, num_inheritable, num_permitted; - int most_effective, most_inheritable, most_permitted; - int count, any_so_far; - - buf = (char *)malloc(CAP_MAX_BUF_LEN); - if (buf == NULL) { - errno = ENOMEM; - return (NULL); - } - buf[0] = '\0'; - - /* - * For the sake of prettiness, first walk each flag to see if it's - * set for cap_list_len/2 or more. If so, list it as a plus, and - * do the remainder as negative, as needed. This will tend to - * collapse a lot of the common all= cases. - */ - num_effective = num_inheritable = num_permitted = 0; - for (count = 0; count < cap_list_len; count++) { - cap_value = cap_list[count]; - if (cap_is_set(cap_p, CAP_EFFECTIVE, cap_value)) - num_effective++; - if (cap_is_set(cap_p, CAP_INHERITABLE, cap_value)) - num_inheritable++; - if (cap_is_set(cap_p, CAP_PERMITTED, cap_value)) - num_permitted++; - } - - most_effective = (num_effective > cap_list_len / 2); - most_inheritable = (num_inheritable > cap_list_len / 2); - most_permitted = (num_permitted > cap_list_len / 2); - - most_flag = 0; - if (most_effective) - most_flag |= CAP_EFFECTIVE; - if (most_inheritable) - most_flag |= CAP_INHERITABLE; - if (most_permitted) - most_flag |= CAP_PERMITTED; - - any_so_far = 0; - if (most_flag != 0) { - if ((strlcat(buf, "all=", CAP_MAX_BUF_LEN) >= - CAP_MAX_BUF_LEN) || - (strlcat(buf, CAP_FLAGS[most_flag], - CAP_MAX_BUF_LEN) >= CAP_MAX_BUF_LEN)) { - free(buf); - errno = ENOMEM; - return (NULL); - } - any_so_far = 1; - } - - /* - * For each capability value, determine how that value relates - * to the most common case, and (depending on CAP_PRINT_RELATIVE) - * either print out the value's flag set relative to the most - * common, or its absolute flag set. - */ - for (count = 0; count < cap_list_len; count++) { - cap_value = cap_list[count]; - cap_flag = cap_value_to_flags(cap_p, cap_value); - /* - * Determine which, if any, flags need to be printed - * for this capability. First, if the flags on the - * capability are equal to the "most" flags, just skip - * it. - */ - if (cap_flag == most_flag) - continue; - -#if CAP_PRINT_RELATIVE - /* - * If the flags are a strict superset of the "most" - * flags, print it as a "+" case. If they're a - * strict subset, print as a "-" case. Otherwise, - * specify as an "=" case. - */ - if ((cap_flag | most_flag) == cap_flag) { - /* Strict superset, use "+". */ - operation = '+'; - cap_flag = cap_flag & ~most_flag; - flag_s = cap_flags_to_string(cap_flag); - } else if ((cap_flag | most_flag) == most_flag) { - /* Strict subset, use "-". */ - operation = '-'; - cap_flag = most_flag & ~cap_flag; - flag_s = cap_flags_to_string(cap_flag); - } else { -#endif - /* Mixed, use an "=" case */ - operation = '='; - flag_s = cap_flags_to_string(cap_flag); -#if CAP_PRINT_RELATIVE - } -#endif - /* - * Now assemble clause, and append to the string being - * built. - */ - if (any_so_far) - prefix_s = ":"; - else - prefix_s = ""; - value_s = cap_to_string(cap_value); - if ((snprintf(minibuf, sizeof(minibuf), "%s%s%c%s", prefix_s, - value_s, operation, flag_s) >= sizeof(minibuf)) || - (strlcat(buf, minibuf, CAP_MAX_BUF_LEN) >= - CAP_MAX_BUF_LEN)) { - free(buf); - errno = ENOMEM; - return (NULL); - } - } - - if (len_p) - *len_p = strlen(buf); - return (buf); -} - -cap_t -cap_from_text(const char *buf_p) -{ - cap_value_t cap_value_v, cap_value_set_v; - cap_flag_t cap_action_v; - cap_t cap; - char *mybuf, *cur; - char *clause_s, *cap_value_s, *cap_value_list_s; - char *cap_action_list_s, *cap_action_s; - char *next_operation_p, operation, next_operation; - - cap = cap_init(); - if (cap == NULL) - return ((cap_t)NULL); - - mybuf = strdup(buf_p); - if (mybuf == NULL) { - errno = ENOMEM; - goto err1; - } - - /* - * clase [SEP clause [SEP clause ...]] - * Split into "clauses", which are separated by a : or whitespace. - * - * clause = [caplist]actionlist - * caplist = capabilityname[,capabilityname[, ...]] - * actionlist = op[flags][op[flags]] - * Split clauses into a (possibly null) capability name list, and a - * set of one or more {op,flags} pairs. - * - * Each assignment is then applied to a running "state" to - * produce an end-result in the internal representation. - * Parsing failure at any time releases resources and results - * in EINVAL. - */ - cur = mybuf; - while ((clause_s = strsep(&cur, CAP_SEP)) != NULL) { - /* - * Identify and NULL the first operation so that we - * can parse the capability name list, but save - * for later when we iterate over the operation list. - */ - cap_action_list_s = clause_s; - next_operation_p = strpbrk(cap_action_list_s, CAP_OPERATION); - if (next_operation_p == NULL) - goto err2; - operation = *next_operation_p; - cap_value_list_s = strsep(&cap_action_list_s, CAP_OPERATION); - if (cap_value_list_s == NULL || cap_action_list_s == NULL) - goto err2; - /* - * cap_value_list_s now points at the NULL-terminated list - * of capability values, if any. - * cap_action_list_s now points to the NULL-terminated list - * of actions. - * - * First, parse the value list to generate a value set - * refering to the combined contents of the value list. - */ - cap_value_set_v = 0; - while ((cap_value_s = strsep(&cap_value_list_s, ",")) != NULL) { - /* - * Convert value string into internal representation. - * Reject if not a valid capability identifier. - */ - if (cap_from_string(cap_value_s, &cap_value_v)) - goto err2; - cap_value_set_v |= cap_value_v; - } - - /* - * While the current operation is non-0, parse its flags, - * apply the actions, and then repeat. The first set - * is assured above when the capability list is split off. - */ - while (operation != 0) { - /* - * Identify and save the next operation, then NULL - * it to find the end of the current flags. - */ - next_operation_p = strpbrk(cap_action_list_s, - CAP_OPERATION); - if (next_operation_p) - next_operation = *next_operation_p; - else - next_operation = 0; - cap_action_s = strsep(&cap_action_list_s, - CAP_OPERATION); - /* - * Convert string form of flags to internal - * representation, reject if not possible. - */ - if (cap_string_to_flags(cap_action_s, &cap_action_v)) - goto err2; - - /* - * Now, based on operation apply actionlist flags - * to the capability value set built earlier from - * the capability list. - */ - switch (operation) { - case '=': - /* - * Remove current flags for the value set, - * replace with new flags. - * - * Spec requires that an "=" operation with - * no value set be treated as an "=" operation - * with a value set equivilent to "all". - */ - if (cap_value_set_v == CAP_ALL_OFF) { - cap_set(cap, CAP_EFFECTIVE| - CAP_INHERITABLE|CAP_PERMITTED, - CAP_CLEAR, CAP_ALL_ON); - cap_set(cap, cap_action_v, CAP_SET, - CAP_ALL_ON); - } else { - cap_set(cap, CAP_EFFECTIVE| - CAP_INHERITABLE|CAP_PERMITTED, - CAP_CLEAR, cap_value_set_v); - cap_set(cap, cap_action_v, CAP_SET, - cap_value_set_v); - } - break; - case '+': - /* - * Add current flags to value set. - * - * Spec requires that a "+" operation with - * no value set be rejected. - */ - if (cap_value_set_v == CAP_ALL_OFF) - goto err2; - cap_set(cap, cap_action_v, CAP_SET, - cap_value_set_v); - break; - case '-': - /* - * Subtract current flags from value set. - * - * Spec requires that a "-" operation with - * no value set be treated as a "-" operation - * with a value set equivilent to "all". - */ - if (cap_value_set_v == CAP_ALL_OFF) - cap_set(cap, cap_action_v, CAP_CLEAR, - CAP_ALL_ON); - else - cap_set(cap, cap_action_v, CAP_CLEAR, - cap_value_set_v); - break; - default: - goto err2; - } - operation = next_operation; - } - } - - return (cap); - err2: - errno = EINVAL; - free(mybuf); - err1: - cap_free(cap); - return ((cap_t)NULL); -} - diff --git a/lib/libposix1e/cap_to_text.3 b/lib/libposix1e/cap_to_text.3 deleted file mode 100644 index 779fb0b..0000000 --- a/lib/libposix1e/cap_to_text.3 +++ /dev/null @@ -1,123 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd September 18, 2000 -.Dt CAP_TO_TEXT 3 -.Os FreeBSD -.Sh NAME -.Nm cap_to_text -.Nd Convert a Capability State in Working Storage to Text -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/capability.h> -.Ft char * -.Fn cap_to_text "cap_t cap_p" "ssize_t *len_p" -.Sh DESCRIPTION -The -.Fn cap_to_text -function converts the capability state in working storage identified by -.Va cap_p -into a null terminated human-readable string. -This function allocates any memory necessary to contain the string, and -returns a pointer to the string. -If the pointer -.Va len_p -if not -.Va (size_t)NULL , -the function shall also return the full length of the string (not including -null terminator) in the location pointed to by -.Va len_p . -The capability state in working storage idenfied by -.Va cap_p -shall be completely represented in the returned string. -.Pp -This function may cause memory to be allocated. -The caller should free any releasable memory, when the capability state -in working memory is no longer required, by calling -.Xr cap_free 3 -with the -.Va cap_t -as an argument. -.Sh IMPLEMENTATION NOTES -FreeBSD's support for POSIX.1e interfaces and features is still under -development at this time. -.Sh RETURN VALUES -Upon successful completion, the function shall return a pointer to the -text form of the capability state. -Otherwise, a value of -.Va (char *)NULL -shall be returned, and -.Va errno -set to indicate the error. -.Sh ERRORS -If any of the following conditions occur, the -.Fn cap_to_text -function shall return a value of -.Va (cap_t)NULL -and set -.Va errno -to the corresponding value: -.Bl -tag -width Er -.It Bq Er EINVAL -Either the -.Va cap_p -argument does not refer to a capability state in working storage -or the -.Va len_p -argument is invalid, or both. -.It Bq Er ENOMEM -The string to be returned requires more memory than is allowed by the -hardware or system-imposed memory management constraints. -.El -.Sh SEE ALSO -.Xr cap 3 , -.Xr cap_free 3 , -.Xr cap_from_text 3 , -.Xr cap_get_flag 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson -.Sh BUGS -.Fn cap_to_text -uses a bounded size (1024 byte) buffer in which to assemble the resulting -text string. -If the string requires more space than that buffer provides, -.Er ENOMEM -will be returned. diff --git a/lib/libposix1e/posix1e.3 b/lib/libposix1e/posix1e.3 deleted file mode 100644 index 6c64b2a..0000000 --- a/lib/libposix1e/posix1e.3 +++ /dev/null @@ -1,114 +0,0 @@ -.\"- -.\" Copyright (c) 2000 Robert N. M. Watson -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd January 17, 2000 -.Dt POSIX1E 3 -.Os FreeBSD -.Sh NAME -.Nm posix1e -.Nd introduction to the POSIX.1e security API -.Sh LIBRARY -.Lb libposix1e -.Sh SYNOPSIS -.Fd #include <sys/types.h> -.Fd #include <sys/acl.h> -.\" .Fd #include <sys/audit.h> -.Fd #include <sys/capability.h> -.\" .Fd #include <sys/mac.h> -.Sh DESCRIPTION -The IEEE POSIX.1e specification never left draft form, but the interfaces -it describes are now widely used despite inherent limitations. Currently, -only a few of the interfaces and features are implemented in -.Fx , -although efforts are underway to complete the integration at this time. -.Pp -POSIX.1e describes five security extensions to the base POSIX.1 API: -Access Control Lists (ACLs), Auditing, Capabilities, Mandatory Access -Control, and Information Flow Labels. Of these, the ACL interfaces are -currently included with -.Fx , -Auditing, Capabilities, and Mandatory -Access Control are in the wings, and Information Flow Labels are not on -the calendar. -.Pp -POSIX.1e defines both syntax and semantics for these features, but fairly -substantial changes are required to implement these features in the -operating system. As shipped, -.Fx 4.0 -permits file systems to export -Access Control Lists via the VFS, and provides a library for userland -access to and manipulation of these ACLs, but support for ACLs is not -provided by any file systems shipped in the base operating system. -Available API calls relating to ACLs are described in detail in -.Xr acl 3 . -.Pp -.Fx -currently provides documentation and APIs for fine-grained capability -support, but implementation is currently not included in the base -system. Documentation of these API calls is provided in -.Xr cap 3 . -.Pp -Additional patches supporting POSIX.1e features are provided by the -TrustedBSD project: -.Pp -http://www.trustedbsd.org -.Sh IMPLEMENTATION NOTES -Support for POSIX.1e interfaces and features is still under -development at this time. -.Sh ENVIRONMENT -POSIX.1e assigns security labels to all objects, extending the security -functionality described in POSIX.1. These additional labels provide -fine-grained discretionary access control, fine-grained capabilities, -and labels necessary for mandatory access control. POSIX.2c describes -a set of userland utilities for manipulating these labels. These userland -utilities are not bundled with -.Fx 4.0 -so as to discourage their -use in the short term. -.Sh FILES -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl 9 , -.Xr cap 3 , -.Xr cap 9 , -.Xr extattr 9 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. Discussion -of the draft continues on the cross-platform POSIX.1e implementation -mailing list. To join this list, see the -.Fx -POSIX.1e implementation -page for more information. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 , -and development continues. -.Sh AUTHORS -.An Robert N M Watson , -.An Ilmar S Habibulin -.Sh BUGS -These features are not yet fully implemented. |