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));
|
|
|
|
m.VFS_CHECKPERMS_ENDPT = endpt;
|
|
|
|
m.VFS_CHECKPERMS_GRANT = grant;
|
|
|
|
m.VFS_CHECKPERMS_COUNT = size;
|
|
|
|
|
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;
|
|
|
|
}
|