From 21a0fbc5e080e3d14d0c516913ccba01fd767dcc Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 7 Sep 2011 11:33:26 +0000 Subject: beter determination if the shell is restricted; from Alf Schlichting. ok jasper@ millert@ --- bin/ksh/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'bin/ksh') 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); + } -- cgit v1.2.3