make setuid/setgid scripts and access() work again
by reverting some OpenBSD and applying some Debian diff
This commit is contained in:
8
exec.c
8
exec.c
@ -1,11 +1,11 @@
|
||||
/** $MirOS: src/bin/mksh/exec.c,v 1.3 2005/05/25 11:31:15 tg Exp $ */
|
||||
/** $MirOS: src/bin/mksh/exec.c,v 1.4 2005/05/25 13:45:59 tg Exp $ */
|
||||
/* $OpenBSD: exec.c,v 1.41 2005/03/30 17:16:37 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.3 2005/05/25 11:31:15 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.4 2005/05/25 13:45:59 tg Exp $");
|
||||
|
||||
static int comexec(struct op *, struct tbl *volatile, char **,
|
||||
int volatile);
|
||||
@ -856,7 +856,7 @@ findcom(const char *name, int flags)
|
||||
tp = tbi;
|
||||
if (!tp && (flags & FC_PATH) && !(flags & FC_DEFPATH)) {
|
||||
tp = tsearch(&taliases, name, h);
|
||||
if (tp && (tp->flag & ISSET) && access(tp->val.s, X_OK) != 0) {
|
||||
if (tp && (tp->flag & ISSET) && eaccess(tp->val.s, X_OK) != 0) {
|
||||
if (tp->flag & ALLOC) {
|
||||
tp->flag &= ~ALLOC;
|
||||
afree(tp->val.s, APERM);
|
||||
@ -930,7 +930,7 @@ search_access(const char *lpath, int mode,
|
||||
|
||||
if (stat(lpath, &statb) < 0)
|
||||
return -1;
|
||||
ret = access(lpath, mode);
|
||||
ret = eaccess(lpath, mode);
|
||||
if (ret < 0)
|
||||
err = errno; /* File exists, but we can't access it */
|
||||
else if (mode == X_OK && (!S_ISREG(statb.st_mode) ||
|
||||
|
Reference in New Issue
Block a user