summaryrefslogtreecommitdiffstats
path: root/bin/test
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-11-05 17:28:03 +0000
committerache <ache@FreeBSD.org>1994-11-05 17:28:03 +0000
commit63bfe9e23a77356b11d22a671e409970e1590552 (patch)
treedde43fa982af0071db797fe18097cd68d6a13633 /bin/test
parentbc1cc6dddad4bcec665d32fe6b2876b87c647fc5 (diff)
downloadFreeBSD-src-63bfe9e23a77356b11d22a671e409970e1590552.zip
FreeBSD-src-63bfe9e23a77356b11d22a671e409970e1590552.tar.gz
More complex implementation of previos superuser fix
because rw and x bit treats differently infact
Diffstat (limited to 'bin/test')
-rw-r--r--bin/test/test.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/test/test.c b/bin/test/test.c
index e925c1b..8fcea4a 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;
OpenPOWER on IntegriCloud