diff options
author | Emilio Pozuelo Monfort <pochu27@gmail.com> | 2010-05-26 01:27:40 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-01-08 22:46:06 +0100 |
commit | 4152b0ca04f4703a6c6f33e59ba0e7bd95837069 (patch) | |
tree | e10f7b717da381cacf8a5d98087d664f271f3bba /libdiskfs/file-exec.c | |
parent | 67fa50fb8f0a6894e5ed6534936afb8044e66613 (diff) | |
download | hurd-4152b0ca04f4703a6c6f33e59ba0e7bd95837069.tar.gz hurd-4152b0ca04f4703a6c6f33e59ba0e7bd95837069.tar.bz2 hurd-4152b0ca04f4703a6c6f33e59ba0e7bd95837069.zip |
Add a file_exec_file_name RPC
* hurd/fs.defs (file_exec): Deprecate in favor of...
(file_exec_paths): ...this new RPC.
* TODO: Update.
* doc/hurd.texi: Update RPC name.
* hurd/hurd_types.h: Update RPC name.
* libdiskfs/boot-start.c: Update RPC name.
* configure.ac: Check for presence of RPC stubs file_exec_paths exec_exec_paths.
* exec/hashexec.c (check_hashbang): When file_exec_paths is available, use it
instead of file_exec.
* startup/startup.c (run, run_for_real, start_child): Likewise.
* utils/login.c (main): Likewise.
* libfshelp/start-translator-long.c (fshelp_start_translator_long): Likewise.
* libdiskfs/file-exec.c (diskfs_S_file_exec): Move code to
new function diskfs_S_file_exec_paths and call it.
(diskfs_S_file_exec_paths): New function, use exec_exec_paths when available
instead of exec_exec
* libnetfs/file-exec.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise.
* trans/fakeroot.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise.
* libtrivfs/file-exec.c (trivfs_S_file_exec_paths): New function.
Diffstat (limited to 'libdiskfs/file-exec.c')
-rw-r--r-- | libdiskfs/file-exec.c | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/libdiskfs/file-exec.c b/libdiskfs/file-exec.c index e544b14a..3e830161 100644 --- a/libdiskfs/file-exec.c +++ b/libdiskfs/file-exec.c @@ -1,5 +1,6 @@ -/* File execution (file_exec RPC) for diskfs servers, using exec server. - Copyright (C) 1993,94,95,96,97,98,2000,02 Free Software Foundation, Inc. +/* File execution (file_exec_paths RPC) for diskfs servers, using exec server. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, + 2010 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -47,6 +48,41 @@ diskfs_S_file_exec (struct protid *cred, mach_port_t *destroynames, size_t destroynameslen) { + return diskfs_S_file_exec_paths (cred, + task, + flags, + "", + "", + argv, argvlen, + envp, envplen, + fds, fdslen, + portarray, portarraylen, + intarray, intarraylen, + deallocnames, deallocnameslen, + destroynames, destroynameslen); +} + +kern_return_t +diskfs_S_file_exec_paths (struct protid *cred, + task_t task, + int flags, + char *path, + char *abspath, + char *argv, + size_t argvlen, + char *envp, + size_t envplen, + mach_port_t *fds, + size_t fdslen, + mach_port_t *portarray, + size_t portarraylen, + int *intarray, + size_t intarraylen, + mach_port_t *deallocnames, + size_t deallocnameslen, + mach_port_t *destroynames, + size_t destroynameslen) +{ struct node *np; uid_t uid; gid_t gid; @@ -136,9 +172,9 @@ diskfs_S_file_exec (struct protid *cred, if (! err) /* Make a new peropen for the exec server to access the file, since any - seeking the exec server might want to do should not affect the - original peropen on which file_exec was called. (The new protid for - this peropen clones the caller's iouser to preserve the caller's + seeking the exec server might want to do should not affect the original + peropen on which file_exec_paths was called. (The new protid + for this peropen clones the caller's iouser to preserve the caller's authentication credentials.) The new peropen's openmodes must have O_READ even if the caller had only O_EXEC privilege, so the exec server can read the executable file. We also include O_EXEC so that @@ -159,14 +195,31 @@ diskfs_S_file_exec (struct protid *cred, do { right = ports_get_send_right (newpi); - err = exec_exec (execserver, - right, MACH_MSG_TYPE_COPY_SEND, - task, flags, argv, argvlen, envp, envplen, - fds, MACH_MSG_TYPE_COPY_SEND, fdslen, - portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, - intarray, intarraylen, - deallocnames, deallocnameslen, - destroynames, destroynameslen); +#ifdef HAVE_EXEC_EXEC_PATHS + err = exec_exec_paths (execserver, + right, MACH_MSG_TYPE_COPY_SEND, + task, flags, path, abspath, + argv, argvlen, envp, envplen, + fds, MACH_MSG_TYPE_COPY_SEND, fdslen, + portarray, MACH_MSG_TYPE_COPY_SEND, + portarraylen, + intarray, intarraylen, + deallocnames, deallocnameslen, + destroynames, destroynameslen); + /* For backwards compatibility. Just drop it when we kill + exec_exec. */ + if (err == MIG_BAD_ID) +#endif + err = exec_exec (execserver, + right, MACH_MSG_TYPE_COPY_SEND, + task, flags, argv, argvlen, envp, envplen, + fds, MACH_MSG_TYPE_COPY_SEND, fdslen, + portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, + intarray, intarraylen, + deallocnames, deallocnameslen, + destroynames, destroynameslen); + + mach_port_deallocate (mach_task_self (), right); if (err == MACH_SEND_INVALID_DEST) { |