From efcbdd9256426c6916662c08961d16fa84c1ce95 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 18 Jan 1996 19:30:07 +0000 Subject: (diskfs_S_dir_readdir): Require read permission before succeeding. --- libdiskfs/dir-readdir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libdiskfs') 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); -- cgit v1.2.3