2013-11-03 22:33:44 +01:00
|
|
|
#include "syslib.h"
|
|
|
|
|
2013-10-05 16:31:35 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <minix/safecopies.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
checkperms(endpoint_t endpt, char *path, size_t size)
|
|
|
|
{
|
|
|
|
cp_grant_id_t grant;
|
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
|
|
|
if ((grant = cpf_grant_direct(VFS_PROC_NR, (vir_bytes) path, size,
|
|
|
|
CPF_READ | CPF_WRITE)) == GRANT_INVALID)
|
2013-11-03 22:33:44 +01:00
|
|
|
return ENOMEM;
|
2013-10-05 16:31:35 +02:00
|
|
|
|
|
|
|
memset(&m, 0, sizeof(m));
|
2014-05-12 12:53:20 +02:00
|
|
|
m.m_lsys_vfs_checkperms.endpt = endpt;
|
|
|
|
m.m_lsys_vfs_checkperms.grant = grant;
|
|
|
|
m.m_lsys_vfs_checkperms.count = size;
|
2013-10-05 16:31:35 +02:00
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
r = _taskcall(VFS_PROC_NR, VFS_CHECKPERMS, &m);
|
2013-10-05 16:31:35 +02:00
|
|
|
|
2013-11-03 22:33:44 +01:00
|
|
|
cpf_revoke(grant);
|
2013-10-05 16:31:35 +02:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|