diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2011-09-07 11:33:26 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2011-09-07 11:33:26 +0000 |
commit | 21a0fbc5e080e3d14d0c516913ccba01fd767dcc (patch) | |
tree | 069947798079a1a3496d03af4dbf4fe466582bad /bin/ksh | |
parent | 1260d574e7b3d392a9d88b3bcca52ed273942594 (diff) |
beter determination if the shell is restricted; from Alf Schlichting.
ok jasper@ millert@
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/main.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c index 7a5886e067f..0718a637590 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.46 2010/05/19 17:36:08 jasper Exp $ */ +/* $OpenBSD: main.c,v 1.47 2011/09/07 11:33:25 otto Exp $ */ /* * startup, main loop, environments and error handling @@ -748,7 +748,14 @@ is_restricted(char *name) char *p; if ((p = strrchr(name, '/'))) - name = p; - /* accepts rsh, rksh, rpdksh, pdrksh, etc. */ - return (p = strchr(name, 'r')) && strstr(p, "sh"); + name = p + 1; + /* accepts rsh, rksh, rpdksh, pdrksh */ + if (strcmp(name, "rsh") && \ + strcmp(name, "rksh") && \ + strcmp(name, "rpdksh") && \ + strcmp(name, "pdrksh")) + return(0); + else + return(1); + } |