2011-09-08 18:49:54 +02:00
|
|
|
|
|
|
|
#include <minix/vfsif.h>
|
|
|
|
#include <minix/type.h>
|
2011-11-14 11:07:49 +01:00
|
|
|
#include <minix/syslib.h>
|
2011-09-08 18:49:54 +02:00
|
|
|
#include <assert.h>
|
2011-11-14 11:07:49 +01:00
|
|
|
#include <string.h>
|
2011-09-08 18:49:54 +02:00
|
|
|
|
|
|
|
#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));
|
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
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);
|
2011-09-08 18:49:54 +02:00
|
|
|
}
|
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
assert(credentials->vu_ngroups <= NGROUPS_MAX);
|
2011-09-08 18:49:54 +02:00
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
*caller_uid = credentials->vu_uid;
|
|
|
|
*caller_gid = credentials->vu_gid;
|
2011-09-08 18:49:54 +02:00
|
|
|
|
2013-02-28 15:44:23 +01:00
|
|
|
return OK;
|
2011-09-08 18:49:54 +02:00
|
|
|
}
|
|
|
|
|