diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-01-18 19:30:07 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-01-18 19:30:07 +0000 |
commit | efcbdd9256426c6916662c08961d16fa84c1ce95 (patch) | |
tree | 73a9b2b0aa82282db682244f44bb77201bca7578 /libdiskfs/dir-readdir.c | |
parent | 9c1fb7615cfd785ce5bb396371bc38d015dc194b (diff) |
(diskfs_S_dir_readdir): Require read permission before succeeding.
Diffstat (limited to 'libdiskfs/dir-readdir.c')
-rw-r--r-- | libdiskfs/dir-readdir.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libdiskfs/dir-readdir.c b/libdiskfs/dir-readdir.c index c4a6dd12..23e24213 100644 --- a/libdiskfs/dir-readdir.c +++ b/libdiskfs/dir-readdir.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1993, 1994 Free Software Foundation + Copyright (C) 1993, 1994, 1996 Free Software Foundation This file is part of the GNU Hurd. @@ -39,6 +39,13 @@ diskfs_S_dir_readdir (struct protid *cred, np = cred->po->np; mutex_lock (&np->lock); + + if ((cred->po->openstat & O_READ) == 0) + { + mutex_unlock (&np->lock); + return EBADF; + } + if ((np->dn_stat.st_mode & S_IFMT) != S_IFDIR) { mutex_unlock (&np->lock); |