use a correct type for UIO_*.

This commit is contained in:
yamt 2007-09-23 16:00:08 +00:00
parent 4b788a8f96
commit 97427fb0e4
3 changed files with 18 additions and 18 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: kauth.9,v 1.52 2007/07/11 19:12:09 dsl Exp $
.\" $NetBSD: kauth.9,v 1.53 2007/09/23 16:03:41 yamt Exp $
.\"
.\" Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
.\" All rights reserved.
@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 11, 2007
.Dd September 24, 2007
.Dt KAUTH 9
.Os
.Sh NAME
@ -873,7 +873,7 @@ Return the group-id of the group at index
in the group list of
.Ar cred .
.It Ft int Fn kauth_cred_setgroups "kauth_cred_t cred" "gid_t *groups" \
"size_t ngroups" "uid_t gmuid" "unsigned int flags"
"size_t ngroups" "uid_t gmuid" "enum uio_seg seg"
Copy
.Ar ngroups
groups from array pointed to by
@ -883,8 +883,8 @@ to the group list in
adjusting the number of groups in
.Ar cred
appropriately.
.Ar flags
should contain either
.Ar seg
should be either
.Dv UIO_USERSPACE
or
.Dv UIO_SYSSPACE
@ -900,15 +900,15 @@ KPI.
.Pp
The return value is an error code, or zero for success.
.It Ft int Fn kauth_cred_getgroups "kauth_cred_t cred" "gid_t *groups" \
"size_t ngroups" "unsigned int flags"
"size_t ngroups" "enum uio_seg seg"
Copy
.Ar ngroups
groups from the group list in
.Ar cred
to the buffer pointed to by
.Ar groups .
.Ar flags
should contain either
.Ar seg
should be either
.Dv UIO_USERSPACE
or
.Dv UIO_SYSSPACE

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_auth.c,v 1.51 2007/07/06 17:33:31 dsl Exp $ */
/* $NetBSD: kern_auth.c,v 1.52 2007/09/23 16:00:08 yamt Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.51 2007/07/06 17:33:31 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.52 2007/09/23 16:00:08 yamt Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -393,7 +393,7 @@ kauth_cred_group(kauth_cred_t cred, u_int idx)
/* XXX elad: gmuid is unused for now. */
int
kauth_cred_setgroups(kauth_cred_t cred, const gid_t *grbuf, size_t len,
uid_t gmuid, unsigned int flags)
uid_t gmuid, enum uio_seg seg)
{
int error = 0;
@ -404,10 +404,10 @@ kauth_cred_setgroups(kauth_cred_t cred, const gid_t *grbuf, size_t len,
return EINVAL;
if (len) {
if ((flags & (UIO_USERSPACE | UIO_SYSSPACE)) == UIO_SYSSPACE)
if (seg == UIO_SYSSPACE) {
memcpy(cred->cr_groups, grbuf,
len * sizeof(cred->cr_groups[0]));
else {
} else {
error = copyin(grbuf, cred->cr_groups,
len * sizeof(cred->cr_groups[0]));
if (error != 0)
@ -454,14 +454,14 @@ kauth_proc_setgroups(struct lwp *l, kauth_cred_t ncred)
int
kauth_cred_getgroups(kauth_cred_t cred, gid_t *grbuf, size_t len,
unsigned int flags)
enum uio_seg seg)
{
KASSERT(cred != NULL);
if (len > cred->cr_ngroups)
return EINVAL;
if ((flags & (UIO_USERSPACE | UIO_SYSSPACE)) == UIO_USERSPACE)
if (seg == UIO_USERSPACE)
return copyout(cred->cr_groups, grbuf, sizeof(*grbuf) * len);
memcpy(grbuf, cred->cr_groups, sizeof(*grbuf) * len);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kauth.h,v 1.39 2007/06/30 13:32:14 dsl Exp $ */
/* $NetBSD: kauth.h,v 1.40 2007/09/23 16:00:08 yamt Exp $ */
/*-
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
@ -300,8 +300,8 @@ void kauth_cred_hold(kauth_cred_t);
u_int kauth_cred_getrefcnt(kauth_cred_t);
int kauth_cred_setgroups(kauth_cred_t, const gid_t *, size_t, uid_t,
unsigned int);
int kauth_cred_getgroups(kauth_cred_t, gid_t *, size_t, unsigned int);
enum uio_seg);
int kauth_cred_getgroups(kauth_cred_t, gid_t *, size_t, enum uio_seg);
/* This is for sys_setgroups() */
int kauth_proc_setgroups(struct lwp *, kauth_cred_t);