diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-11-05 17:28:03 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-11-05 17:28:03 +0000 |
commit | ea8bd6e34847293b90187382c131edffa454ffee (patch) | |
tree | dde43fa982af0071db797fe18097cd68d6a13633 /bin | |
parent | 3b0beab69cf5df53921c685cbb2e79b4866c4000 (diff) | |
download | src-ea8bd6e34847293b90187382c131edffa454ffee.tar.gz src-ea8bd6e34847293b90187382c131edffa454ffee.zip |
More complex implementation of previos superuser fix
because rw and x bit treats differently infact
Notes
Notes:
svn path=/head/; revision=4167
Diffstat (limited to 'bin')
-rw-r--r-- | bin/test/test.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/test/test.c b/bin/test/test.c index e925c1b3baad..8fcea4adb4f6 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: test.c,v 1.4 1994/09/24 02:59:15 davidg Exp $ + * $Id: test.c,v 1.5 1994/11/05 17:07:14 ache Exp $ */ #ifndef lint @@ -336,22 +336,30 @@ expr_operator(op, sp, fs) sp->type = BOOLEAN; break; case ISEXIST: +exist: if (fs == NULL || fs->rcode == -1) goto false; else goto true; case ISREAD: + if (geteuid() == 0) + goto exist; i = S_IROTH; goto permission; case ISWRITE: + if (geteuid() == 0) + goto exist; i = S_IWOTH; goto permission; case ISEXEC: + if (geteuid() != 0) { i = S_IXOTH; -permission: if (geteuid() == 0 || fs->stat.st_uid == geteuid()) +permission: if (fs->stat.st_uid == geteuid()) i <<= 6; else if (fs->stat.st_gid == getegid()) i <<= 3; + } else + i = S_IXOTH|S_IXGRP|S_IXUSR; goto filebit; /* true if (stat.st_mode & i) != 0 */ case ISFILE: i = S_IFREG; |