diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-02-19 07:45:57 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-02-19 07:45:57 +0000 |
commit | d822f1e0c93ee19dd34462ed3fab51b2b4f22bc4 (patch) | |
tree | 751a583f10cc861bce4a7eac1b62bfa3001aec7f /term/users.c | |
parent | b4d4e7e9b8ca92adddbb2c19bb1c3d1beda23441 (diff) | |
download | hurd-d822f1e0c93ee19dd34462ed3fab51b2b4f22bc4.tar.gz hurd-d822f1e0c93ee19dd34462ed3fab51b2b4f22bc4.tar.bz2 hurd-d822f1e0c93ee19dd34462ed3fab51b2b4f22bc4.zip |
1999-02-06 Mark Kettenis <kettenis@gnu.org>
* main.c (main): Initialize status from underlying node.
* users.c (check_access_hook): New function. Correctly implement
access permission checking.
(trivfs_check_access_hook): Initialize with check_access_hook.
(trivfs_S_file_check_access): Removed.
Diffstat (limited to 'term/users.c')
-rw-r--r-- | term/users.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/term/users.c b/term/users.c index 8794bfb6..31780aed 100644 --- a/term/users.c +++ b/term/users.c @@ -105,6 +105,33 @@ init_users () static error_t +check_access_hook (struct trivfs_control *cntl, + struct iouser *user, + mach_port_t realnode, + int *allowed) +{ + struct stat st; + + mutex_lock (&global_lock); + + st.st_uid = term_owner; + st.st_gid = term_group; + st.st_mode = term_mode; + + *allowed = 0; + if (fshelp_access (&st, S_IREAD, user) == 0) + *allowed |= O_READ; + if (fshelp_access (&st, S_IWRITE, user) == 0) + *allowed |= O_WRITE; + + mutex_unlock (&global_lock); + return 0; +} +error_t (*trivfs_check_access_hook) (struct trivfs_control *, struct iouser *, + mach_port_t, int *) + = check_access_hook; + +static error_t open_hook (struct trivfs_control *cntl, struct iouser *user, int flags) @@ -508,19 +535,6 @@ out: return err; } -error_t -trivfs_S_file_check_access (struct trivfs_protid *cred, - mach_port_t reply, mach_msg_type_name_t reply_type, - int *allowed) -{ - if (!cred) - return EOPNOTSUPP; - - /* XXX Do the right thing eventually. */ - *allowed = O_READ | O_WRITE; - return 0; -} - /* Called for user writes to the terminal as described in <hurd/io.defs>. */ |