mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
mount: call into auth
This commit is contained in:
@@ -74,6 +74,13 @@ int vfs_mount(vnode_t *backing, vnode_t *pathref, char *path, char *name, void *
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err = auth_filesystem_check(getcred(), AUTH_ACTIONS_FILESYSTEM_MOUNT, mounton);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
VOP_RELEASE(mounton);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
if (mounton->type != V_TYPE_DIR) {
|
if (mounton->type != V_TYPE_DIR) {
|
||||||
VOP_RELEASE(mounton);
|
VOP_RELEASE(mounton);
|
||||||
return ENOTDIR;
|
return ENOTDIR;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define AUTH_ACTIONS_FILESYSTEM_WRITE 2
|
#define AUTH_ACTIONS_FILESYSTEM_WRITE 2
|
||||||
#define AUTH_ACTIONS_FILESYSTEM_READ 4
|
#define AUTH_ACTIONS_FILESYSTEM_READ 4
|
||||||
#define AUTH_ACTIONS_FILESYSTEM_SETATTR 8
|
#define AUTH_ACTIONS_FILESYSTEM_SETATTR 8
|
||||||
|
#define AUTH_ACTIONS_FILESYSTEM_MOUNT 16
|
||||||
|
|
||||||
typedef int (*authlistener_t)(cred_t *cred, int actions, void *arg0, void *arg1, void *arg2);
|
typedef int (*authlistener_t)(cred_t *cred, int actions, void *arg0, void *arg1, void *arg2);
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,15 @@ static int filesystem(cred_t *cred, int actions, void *arg0, void *arg1, void *a
|
|||||||
DONE_CHECK(actions);
|
DONE_CHECK(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actions & AUTH_ACTIONS_FILESYSTEM_MOUNT) {
|
||||||
|
// vnode is where it will be mounted on
|
||||||
|
if (CRED_IS_ESU(cred))
|
||||||
|
weight += 1;
|
||||||
|
else
|
||||||
|
return AUTH_DECISION_DENY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return weight ? AUTH_DECISION_ALLOW : AUTH_DECISION_DEFER;
|
return weight ? AUTH_DECISION_ALLOW : AUTH_DECISION_DEFER;
|
||||||
}
|
}
|
||||||
@@ -96,7 +105,6 @@ static int system(cred_t *cred, int actions, void *arg0, void *arg1, void *arg2)
|
|||||||
DONE_CHECK(actions);
|
DONE_CHECK(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return weight ? AUTH_DECISION_ALLOW : AUTH_DECISION_DEFER;
|
return weight ? AUTH_DECISION_ALLOW : AUTH_DECISION_DEFER;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user