From 8da02df781576414867ceac279115e0607ffe916 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Sun, 11 Jul 1999 09:54:41 +0000 Subject: [PATCH] Add permission checking (execute-only innermost directory) --- regress/sys/kern/getcwd/getcwd.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/regress/sys/kern/getcwd/getcwd.c b/regress/sys/kern/getcwd/getcwd.c index 93ffd480aad9..ed1beb02d29f 100644 --- a/regress/sys/kern/getcwd/getcwd.c +++ b/regress/sys/kern/getcwd/getcwd.c @@ -1,4 +1,4 @@ -/* $NetBSD: getcwd.c,v 1.4 1999/06/19 18:02:06 sommerfeld Exp $ */ +/* $NetBSD: getcwd.c,v 1.5 1999/07/11 09:54:41 sommerfeld Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -260,6 +260,19 @@ test___getcwd_perms() chdir ("/"); rmdir ("/tmp/permdir/subdir"); rmdir ("/tmp/permdir"); + + mkdir ("/tmp/permdir", 0755); + mkdir ("/tmp/permdir/subdir", 0711); + chdir ("/tmp/permdir/subdir"); + + seteuid(altid); + + CHECK("/tmp/permdir/subdir", __getcwd(kbuf, sizeof(kbuf)), 20, 0); + + seteuid(0); + chdir ("/"); + rmdir ("/tmp/permdir/subdir"); + rmdir ("/tmp/permdir"); } void