Add the following ACL editing functions:
acl_add_perm, acl_clear_perms, acl_copy_entry, acl_create_entry, acl_delete_perm, acl_get_permset, acl_get_qualifier, acl_get_tag_type, acl_set_permset, acl_set_qualifier, acl_set_tag_type This brings us within 4 functions of a full ACL editing library. Reviewed by: rwatson
This commit is contained in:
parent
2219fbbd37
commit
4bf60dfaf8
@ -5,12 +5,15 @@ 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 \
|
||||
@ -29,17 +32,26 @@ SRCS+= acl_calc_mask.c \
|
||||
cap_set_proc.c \
|
||||
cap_text.c
|
||||
|
||||
|
||||
MAN3= 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 \
|
||||
|
97
lib/libc/posix1e/acl_add_perm.3
Normal file
97
lib/libc/posix1e/acl_add_perm.3
Normal file
@ -0,0 +1,97 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar perm
|
||||
to the permission set
|
||||
.Ar 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
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_add_perm
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar permset_d
|
||||
is not a valid descriptor for a permission set within an ACL entry.
|
||||
Argument
|
||||
.Ar perm
|
||||
does not contain a valid
|
||||
.Ar 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 .
|
87
lib/libc/posix1e/acl_clear_perms.3
Normal file
87
lib/libc/posix1e/acl_clear_perms.3
Normal file
@ -0,0 +1,87 @@
|
||||
.\"-
|
||||
.\" 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_PERM 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
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_clear_perms
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
69
lib/libc/posix1e/acl_copy.c
Normal file
69
lib/libc/posix1e/acl_copy.c
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
93
lib/libc/posix1e/acl_copy_entry.3
Normal file
93
lib/libc/posix1e/acl_copy_entry.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar src_d
|
||||
to ACL entry
|
||||
.Ar dest_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_copy_entry
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar src_d
|
||||
or
|
||||
.Ar dest_d
|
||||
is not a valid descriptor for an ACL entry, or
|
||||
arguments
|
||||
.Ar src_d
|
||||
and
|
||||
.Ar 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 .
|
90
lib/libc/posix1e/acl_create_entry.3
Normal file
90
lib/libc/posix1e/acl_create_entry.3
Normal file
@ -0,0 +1,90 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar acl_p.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If one of the following conditions occur, the
|
||||
.Fn acl_create_entry
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
93
lib/libc/posix1e/acl_delete_perm.3
Normal file
93
lib/libc/posix1e/acl_delete_perm.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If one of the following conditions occur, the
|
||||
.Fn acl_delete_perm
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar permset_d
|
||||
is not a valid descriptor for a permission set. Argument
|
||||
.Ar perm
|
||||
does not contain a valid
|
||||
.Ar acl_perm_t
|
||||
value.
|
||||
.It Bq Er ENOSYS
|
||||
This function is not supported by the implementation.
|
||||
.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 .
|
83
lib/libc/posix1e/acl_entry.c
Normal file
83
lib/libc/posix1e/acl_entry.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@ -29,12 +29,17 @@
|
||||
* 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 <sys/errno.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
acl_t
|
||||
acl_get_file(const char *path_p, acl_type_t type)
|
||||
@ -95,3 +100,55 @@ acl_get_fd_np(int fd, acl_type_t type)
|
||||
|
||||
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;
|
||||
}
|
||||
|
92
lib/libc/posix1e/acl_get_permset.3
Normal file
92
lib/libc/posix1e/acl_get_permset.3
Normal file
@ -0,0 +1,92 @@
|
||||
.\"-
|
||||
.\" 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 permset 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
|
||||
.Ar permset_p
|
||||
a descriptor to the permission set in the ACL entry
|
||||
.Ar entry_d .
|
||||
Subsequent operations using the returned permission set operate
|
||||
on the permission set within the ACL entry.
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_get_permset
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
124
lib/libc/posix1e/acl_get_qualifier.3
Normal file
124
lib/libc/posix1e/acl_get_qualifier.3
Normal file
@ -0,0 +1,124 @@
|
||||
.\"-
|
||||
.\" 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 int
|
||||
.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
|
||||
.Ar 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
|
||||
.Ar entry_d
|
||||
is ACL_USER, then the value returned by
|
||||
.Fn acl_get_qualifier
|
||||
will be a pointer to type uid_t.
|
||||
.Pp
|
||||
If the value of the tag type in
|
||||
the ACL entry referred to by
|
||||
.Ar entry_d
|
||||
is ACL_GROUP, then the value returned by
|
||||
.Fn acl_get_qualifier
|
||||
will be a pointer to type gid_t.
|
||||
.Pp
|
||||
If the value of the tag type in the ACL enty referred to by
|
||||
.Ar entry_d
|
||||
is ACL_UNDEFINED_TAG, ACL_USER_OBJ, ACL_GROUP_OBJ, ACL_OTHER,
|
||||
ACL_MASK, or an implementation-defined value for which a qualifier
|
||||
is not supported, then
|
||||
.Fn acl_get_qualifier
|
||||
will return a valid of (void *)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 void* as the argument.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_qualifier
|
||||
function will return a value of
|
||||
.Va (void *)NULL
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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
|
||||
.Ar entry_d
|
||||
is not ACL_USER or 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 .
|
93
lib/libc/posix1e/acl_get_tag_type.3
Normal file
93
lib/libc/posix1e/acl_get_tag_type.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d .
|
||||
Upon successful completion, the location referred to by the argument
|
||||
.Ar tag_type_p
|
||||
will be set to the tag type of the ACL entry
|
||||
.Ar entry_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_tag_type
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
87
lib/libc/posix1e/acl_perm.c
Normal file
87
lib/libc/posix1e/acl_perm.c
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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_perm() clears all permisions from the permission
|
||||
* set permset_d
|
||||
*/
|
||||
int
|
||||
acl_clear_perm(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;
|
||||
}
|
@ -31,7 +31,10 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/acl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "acl_support.h"
|
||||
|
||||
@ -86,3 +89,74 @@ acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
|
||||
|
||||
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;
|
||||
}
|
||||
|
92
lib/libc/posix1e/acl_set_permset.3
Normal file
92
lib/libc/posix1e/acl_set_permset.3
Normal file
@ -0,0 +1,92 @@
|
||||
.\"-
|
||||
.\" 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 permset 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
|
||||
.Ar permset_p
|
||||
a descriptor to the permission set in the ACL entry
|
||||
.Ar entry_d .
|
||||
Subsequent operations using the returned permission set operate
|
||||
on the permission set within the ACL entry.
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_get_permset
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
94
lib/libc/posix1e/acl_set_qualifier.3
Normal file
94
lib/libc/posix1e/acl_set_qualifier.3
Normal file
@ -0,0 +1,94 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d
|
||||
to the value referred to by
|
||||
.Ar tag_qualifier_p .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_set_qualifier
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar entry_d
|
||||
is not a valid descriptor for an ACL entry. The tag type of the
|
||||
ACL entry
|
||||
.Ar entry_d
|
||||
is not ACL_USER or ACL_GROUP. The value pointed to by
|
||||
.Ar 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 .
|
88
lib/libc/posix1e/acl_set_tag_type.3
Normal file
88
lib/libc/posix1e/acl_set_tag_type.3
Normal file
@ -0,0 +1,88 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d .
|
||||
Upon successful completion, the location referred to by the argument
|
||||
.Ar tag_type_p
|
||||
shall be set to the tag type of the ACL entry
|
||||
.Ar entry_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_tag_type
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar entry_d
|
||||
is not a valid descriptor for an ACL entry;
|
||||
.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_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 .
|
40
lib/libc/posix1e/acl_size.c
Normal file
40
lib/libc/posix1e/acl_size.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@ -5,12 +5,15 @@ 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 \
|
||||
@ -29,17 +32,26 @@ SRCS+= acl_calc_mask.c \
|
||||
cap_set_proc.c \
|
||||
cap_text.c
|
||||
|
||||
|
||||
MAN3= 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 \
|
||||
|
97
lib/libposix1e/acl_add_perm.3
Normal file
97
lib/libposix1e/acl_add_perm.3
Normal file
@ -0,0 +1,97 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar perm
|
||||
to the permission set
|
||||
.Ar 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
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_add_perm
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar permset_d
|
||||
is not a valid descriptor for a permission set within an ACL entry.
|
||||
Argument
|
||||
.Ar perm
|
||||
does not contain a valid
|
||||
.Ar 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 .
|
87
lib/libposix1e/acl_clear_perms.3
Normal file
87
lib/libposix1e/acl_clear_perms.3
Normal file
@ -0,0 +1,87 @@
|
||||
.\"-
|
||||
.\" 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_PERM 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
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_clear_perms
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
69
lib/libposix1e/acl_copy.c
Normal file
69
lib/libposix1e/acl_copy.c
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
93
lib/libposix1e/acl_copy_entry.3
Normal file
93
lib/libposix1e/acl_copy_entry.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar src_d
|
||||
to ACL entry
|
||||
.Ar dest_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_copy_entry
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar src_d
|
||||
or
|
||||
.Ar dest_d
|
||||
is not a valid descriptor for an ACL entry, or
|
||||
arguments
|
||||
.Ar src_d
|
||||
and
|
||||
.Ar 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 .
|
90
lib/libposix1e/acl_create_entry.3
Normal file
90
lib/libposix1e/acl_create_entry.3
Normal file
@ -0,0 +1,90 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar acl_p.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If one of the following conditions occur, the
|
||||
.Fn acl_create_entry
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
93
lib/libposix1e/acl_delete_perm.3
Normal file
93
lib/libposix1e/acl_delete_perm.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If one of the following conditions occur, the
|
||||
.Fn acl_delete_perm
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar permset_d
|
||||
is not a valid descriptor for a permission set. Argument
|
||||
.Ar perm
|
||||
does not contain a valid
|
||||
.Ar acl_perm_t
|
||||
value.
|
||||
.It Bq Er ENOSYS
|
||||
This function is not supported by the implementation.
|
||||
.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 .
|
83
lib/libposix1e/acl_entry.c
Normal file
83
lib/libposix1e/acl_entry.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@ -29,12 +29,17 @@
|
||||
* 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 <sys/errno.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
acl_t
|
||||
acl_get_file(const char *path_p, acl_type_t type)
|
||||
@ -95,3 +100,55 @@ acl_get_fd_np(int fd, acl_type_t type)
|
||||
|
||||
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;
|
||||
}
|
||||
|
92
lib/libposix1e/acl_get_permset.3
Normal file
92
lib/libposix1e/acl_get_permset.3
Normal file
@ -0,0 +1,92 @@
|
||||
.\"-
|
||||
.\" 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 permset 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
|
||||
.Ar permset_p
|
||||
a descriptor to the permission set in the ACL entry
|
||||
.Ar entry_d .
|
||||
Subsequent operations using the returned permission set operate
|
||||
on the permission set within the ACL entry.
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_get_permset
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
124
lib/libposix1e/acl_get_qualifier.3
Normal file
124
lib/libposix1e/acl_get_qualifier.3
Normal file
@ -0,0 +1,124 @@
|
||||
.\"-
|
||||
.\" 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 int
|
||||
.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
|
||||
.Ar 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
|
||||
.Ar entry_d
|
||||
is ACL_USER, then the value returned by
|
||||
.Fn acl_get_qualifier
|
||||
will be a pointer to type uid_t.
|
||||
.Pp
|
||||
If the value of the tag type in
|
||||
the ACL entry referred to by
|
||||
.Ar entry_d
|
||||
is ACL_GROUP, then the value returned by
|
||||
.Fn acl_get_qualifier
|
||||
will be a pointer to type gid_t.
|
||||
.Pp
|
||||
If the value of the tag type in the ACL enty referred to by
|
||||
.Ar entry_d
|
||||
is ACL_UNDEFINED_TAG, ACL_USER_OBJ, ACL_GROUP_OBJ, ACL_OTHER,
|
||||
ACL_MASK, or an implementation-defined value for which a qualifier
|
||||
is not supported, then
|
||||
.Fn acl_get_qualifier
|
||||
will return a valid of (void *)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 void* as the argument.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_qualifier
|
||||
function will return a value of
|
||||
.Va (void *)NULL
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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
|
||||
.Ar entry_d
|
||||
is not ACL_USER or 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 .
|
93
lib/libposix1e/acl_get_tag_type.3
Normal file
93
lib/libposix1e/acl_get_tag_type.3
Normal file
@ -0,0 +1,93 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d .
|
||||
Upon successful completion, the location referred to by the argument
|
||||
.Ar tag_type_p
|
||||
will be set to the tag type of the ACL entry
|
||||
.Ar entry_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_tag_type
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
87
lib/libposix1e/acl_perm.c
Normal file
87
lib/libposix1e/acl_perm.c
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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_perm() clears all permisions from the permission
|
||||
* set permset_d
|
||||
*/
|
||||
int
|
||||
acl_clear_perm(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;
|
||||
}
|
@ -31,7 +31,10 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/acl.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "acl_support.h"
|
||||
|
||||
@ -86,3 +89,74 @@ acl_set_fd_np(int fd, acl_t acl, acl_type_t type)
|
||||
|
||||
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;
|
||||
}
|
||||
|
92
lib/libposix1e/acl_set_permset.3
Normal file
92
lib/libposix1e/acl_set_permset.3
Normal file
@ -0,0 +1,92 @@
|
||||
.\"-
|
||||
.\" 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 permset 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
|
||||
.Ar permset_p
|
||||
a descriptor to the permission set in the ACL entry
|
||||
.Ar entry_d .
|
||||
Subsequent operations using the returned permission set operate
|
||||
on the permission set within the ACL entry.
|
||||
.Ar perm .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If the following condition occurs, the
|
||||
.Fn acl_get_permset
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar 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 .
|
94
lib/libposix1e/acl_set_qualifier.3
Normal file
94
lib/libposix1e/acl_set_qualifier.3
Normal file
@ -0,0 +1,94 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d
|
||||
to the value referred to by
|
||||
.Ar tag_qualifier_p .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_set_qualifier
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar entry_d
|
||||
is not a valid descriptor for an ACL entry. The tag type of the
|
||||
ACL entry
|
||||
.Ar entry_d
|
||||
is not ACL_USER or ACL_GROUP. The value pointed to by
|
||||
.Ar 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 .
|
88
lib/libposix1e/acl_set_tag_type.3
Normal file
88
lib/libposix1e/acl_set_tag_type.3
Normal file
@ -0,0 +1,88 @@
|
||||
.\"-
|
||||
.\" 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
|
||||
.Ar entry_d .
|
||||
Upon successful completion, the location referred to by the argument
|
||||
.Ar tag_type_p
|
||||
shall be set to the tag type of the ACL entry
|
||||
.Ar entry_d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the function will return a value of
|
||||
.Va 0 .
|
||||
Otherwise, a value of
|
||||
.Va -1
|
||||
will be returned, and
|
||||
.Va errno
|
||||
will be set to indicate the error.
|
||||
.Sh ERRORS
|
||||
If any of the following conditions occur, the
|
||||
.Fn acl_get_tag_type
|
||||
function will return a value of
|
||||
.Va -1
|
||||
and set
|
||||
.Va errno
|
||||
to the corresponding value:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EINVAL
|
||||
Argument
|
||||
.Ar entry_d
|
||||
is not a valid descriptor for an ACL entry;
|
||||
.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_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 .
|
40
lib/libposix1e/acl_size.c
Normal file
40
lib/libposix1e/acl_size.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
@ -47,6 +47,7 @@
|
||||
typedef int acl_type_t;
|
||||
typedef int acl_tag_t;
|
||||
typedef mode_t acl_perm_t;
|
||||
typedef mode_t *acl_permset_t;
|
||||
|
||||
struct acl_entry {
|
||||
acl_tag_t ae_tag;
|
||||
@ -133,21 +134,36 @@ __END_DECLS
|
||||
* ACL type for different file systems (i.e., AFS).
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
int acl_add_perm(acl_permset_t _permset_d, acl_perm_t _perm);
|
||||
int acl_calc_mask(acl_t *acl_p);
|
||||
int acl_clear_perms(acl_permset_t _permset_d);
|
||||
int acl_copy_entry(acl_entry_t _dest_d, acl_entry_t _src_d);
|
||||
ssize_t acl_copy_ext(void *_buf_p, acl_t _acl, ssize_t _size);
|
||||
acl_t acl_copy_int(const void *_buf_p);
|
||||
int acl_create_entry(acl_t *_acl_p, acl_entry_t *_entry_p);
|
||||
int acl_delete_fd_np(int _filedes, acl_type_t _type);
|
||||
int acl_delete_entry(acl_t acl, acl_entry_t entry_d);
|
||||
int acl_delete_file_np(const char *_path_p, acl_type_t _type);
|
||||
int acl_delete_def_file(const char *_path_p);
|
||||
int acl_delete_perm(acl_permset_t _permset_d, acl_perm_t _perm);
|
||||
acl_t acl_dup(acl_t _acl);
|
||||
int acl_free(void *_obj_p);
|
||||
acl_t acl_from_text(const char *_buf_p);
|
||||
int acl_get_entry(acl_t _acl, int _entry_id, acl_entry_t *_entry_p);
|
||||
acl_t acl_get_fd(int _fd);
|
||||
acl_t acl_get_fd_np(int fd, acl_type_t _type);
|
||||
acl_t acl_get_file(const char *_path_p, acl_type_t _type);
|
||||
void *acl_get_qualifier(acl_entry_t _entry_d);
|
||||
int acl_get_permset(acl_entry_t _entry_d, acl_permset_t *_permset_p);
|
||||
int acl_get_tag_type(acl_entry_t _entry_d, acl_tag_t *_tag_type_p);
|
||||
acl_t acl_init(int _count);
|
||||
int acl_set_fd(int _fd, acl_t _acl);
|
||||
int acl_set_fd_np(int _fd, acl_t _acl, acl_type_t _type);
|
||||
int acl_set_file(const char *_path_p, acl_type_t _type, acl_t _acl);
|
||||
int acl_set_permset(acl_entry_t _entry_d, acl_permset_t _permset_d);
|
||||
int acl_set_qualifier(acl_entry_t _entry_d, const void *_tag_qualifier_p);
|
||||
int acl_set_tag_type(acl_entry_t _entry_d, acl_tag_t _tag_type);
|
||||
ssize_t acl_size(acl_t _acl);
|
||||
char *acl_to_text(acl_t _acl, ssize_t *_len_p);
|
||||
int acl_valid(acl_t _acl);
|
||||
int acl_valid_fd_np(int _fd, acl_type_t _type, acl_t _acl);
|
||||
|
Loading…
Reference in New Issue
Block a user