diff options
author | Miles Bader <miles@gnu.org> | 1996-10-08 18:50:39 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-10-08 18:50:39 +0000 |
commit | ff3c9c18b066040ab0abe0c40dc0675091dbd7da (patch) | |
tree | a633fc346768875562f8cfb347f4883b695e6723 /storeio | |
parent | 501cea175dc34b7c0aaa3ec0353ed493207b6055 (diff) |
(trivfs_S_file_get_storage_info):
If necessary to enforce security, make a copy of STORE and inactivate it
before returning.
Diffstat (limited to 'storeio')
-rw-r--r-- | storeio/io.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/storeio/io.c b/storeio/io.c index edab8e6d..07f6494c 100644 --- a/storeio/io.c +++ b/storeio/io.c @@ -306,7 +306,32 @@ trivfs_S_file_get_storage_info (struct trivfs_protid *cred, if (! cred) return EOPNOTSUPP; else - return store_return (((struct open *)cred->po->hook)->dev->store, - ports, num_ports, ints, num_ints, - offsets, num_offsets, data, data_len); + { + error_t err; + struct store *store = ((struct open *)cred->po->hook)->dev->store; + + if (!cred->isroot + && !store_is_securely_returnable (store, cred->po->openmodes)) + { + struct store *clone; + err = store_clone (store, &clone); + if (! err) + { + err = store_set_flags (clone, STORE_INACTIVE); + if (err == EINVAL) + err = EACCES; + else + err = store_return (clone, + ports, num_ports, ints, num_ints, + offsets, num_offsets, data, data_len); + store_free (clone); + } + } + else + err = store_return (store, + ports, num_ports, ints, num_ints, + offsets, num_offsets, data, data_len); + + return err; + } } |