minix/lib/libminixfs/fetch_credentials.c
Thomas Veerman 49ad4e8888 Spring cleanup
Remove old versions of system calls and system calls that don't have
a libc api interface anymore (dup, dup2, creat).

VFS still contains support for old system call numbers for the new stat
system calls (i.e., 65, 66, 67) to keep supporting old binaries built for
MINIX 3.2.1 (prior to the release).

Change-Id: I721779b58a50c7eeae20669de24658d55d69b25b
2013-03-06 09:56:08 +00:00

31 lines
641 B
C

#include <minix/vfsif.h>
#include <minix/type.h>
#include <minix/syslib.h>
#include <assert.h>
#include <string.h>
#include "minixfs.h"
int fs_lookup_credentials(vfs_ucred_t *credentials,
uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size)
{
int r;
memset(credentials, 0, sizeof(*credentials));
r = sys_safecopyfrom(VFS_PROC_NR, grant2, (vir_bytes) 0,
(vir_bytes) credentials, cred_size);
if (r != OK) {
printf("FS: cred copy failed\n");
return(r);
}
assert(credentials->vu_ngroups <= NGROUPS_MAX);
*caller_uid = credentials->vu_uid;
*caller_gid = credentials->vu_gid;
return OK;
}