diff options
author | Roland McGrath <roland@gnu.org> | 1996-04-23 22:53:50 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-04-23 22:53:50 +0000 |
commit | 813b19875b7c2d07b3e0bea4aca455eaf5b21a20 (patch) | |
tree | 4167b8439f094f74695ec5ebe9c0d3b71fb47dec /exec | |
parent | 9a2fb5b9c375302781c4a812c6d37612f41ea347 (diff) |
(check_hashbang: user_port): Use default root port when secure.
Diffstat (limited to 'exec')
-rw-r--r-- | exec/hashexec.c | 10 |
1 files changed, 8 insertions, 2 deletions
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. */ |