From 813b19875b7c2d07b3e0bea4aca455eaf5b21a20 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 23 Apr 1996 22:53:50 +0000 Subject: (check_hashbang: user_port): Use default root port when secure. --- exec/hashexec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'exec/hashexec.c') diff --git a/exec/hashexec.c b/exec/hashexec.c index 14d5f6c6..6d876dba 100644 --- a/exec/hashexec.c +++ b/exec/hashexec.c @@ -98,25 +98,31 @@ check_hashbang (struct execdata *e, return err; } + /* Find the specified port, using defaults if so specified. */ mach_port_t port = ((which < nports && portarray[which] != MACH_PORT_NULL) ? portarray[which] : (flags & EXEC_DEFAULTS) ? std_ports[which] : MACH_PORT_NULL); + /* Reauthenticate dir ports if they are the defaults. */ switch (which) { case INIT_PORT_CRDIR: - if ((flags & EXEC_SECURE) || port == std_ports[which]) - return (reauthenticate (port, &user_crdir) ?: + /* If secure, always use the default root. */ + if ((flags & EXEC_SECURE) || + port == std_ports[which]) + return (reauthenticate (std_ports[which], &user_crdir) ?: (*operate) (user_crdir)); break; case INIT_PORT_CWDIR: + /* If secure, reauthenticate cwd whether default or given. */ if ((flags & EXEC_SECURE) || port == std_ports[which]) return (reauthenticate (port, &user_cwdir) ?: (*operate) (user_cwdir)); break; } + return (*operate) (port); } /* Look up NAME on behalf of the client. */ -- cgit v1.2.3