Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Fix kern/7944: getcwd permission checking was overl...



details:   https://anonhg.NetBSD.org/src/rev/e1e28d887e39
branches:  trunk
changeset: 474553:e1e28d887e39
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Sun Jul 11 09:27:23 1999 +0000

description:
Fix kern/7944: getcwd permission checking was overly restrictive.
(Don't require start directory to have read permission).

diffstat:

 sys/kern/vfs_getcwd.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r d202cf46158d -r e1e28d887e39 sys/kern/vfs_getcwd.c
--- a/sys/kern/vfs_getcwd.c     Sun Jul 11 03:04:14 1999 +0000
+++ b/sys/kern/vfs_getcwd.c     Sun Jul 11 09:27:23 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_getcwd.c,v 1.9 1999/07/04 20:16:57 sommerfeld Exp $ */
+/* $NetBSD: vfs_getcwd.c,v 1.10 1999/07/11 09:27:23 sommerfeld Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -383,7 +383,8 @@
        struct vnode *uvp = NULL;
        char *bp = NULL;
        int error;
-       
+       int perms = VEXEC;
+
        if (rvp == NULL) {
                rvp = cwdi->cwdi_rdir;
                if (rvp == NULL)
@@ -430,9 +431,10 @@
                 * whether or not caller cares.
                 */
                if (flags & GETCWD_CHECK_ACCESS) {
-                       error = VOP_ACCESS(lvp, VEXEC|VREAD, p->p_ucred, p);
+                       error = VOP_ACCESS(lvp, perms, p->p_ucred, p);
                        if (error)
                                goto out;
+                       perms = VEXEC|VREAD;
                }
                
                /*



Home | Main Index | Thread Index | Old Index