[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 04/70: utils: escape arguments in remap.sh
From: |
Samuel Thibault |
Subject: |
[hurd] 04/70: utils: escape arguments in remap.sh |
Date: |
Mon, 16 Sep 2013 07:41:34 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 67dcc66dbbe940d2ead770a0bfe1c74411b002e7
Author: Justus Winter <address@hidden>
Date: Fri Aug 23 10:09:35 2013 +0200
utils: escape arguments in remap.sh
remap.sh uses /bin/sh to first change the working directory and then
execute the given program in the remap context. But the arguments
given on the command line were not properly escaped:
% '/bin/sh' '-c' 'echo $0'
/bin/sh
% remap '/bin/sh' '-c' 'echo $0'
<empty line>
% remap-fixed '/bin/sh' '-c' 'echo $0'
/bin/sh
* utils/remap.sh: Escape arguments handed to /bin/sh so that they are
not evaluated prematurely.
---
utils/remap.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/utils/remap.sh b/utils/remap.sh
index d799759..064f0f5 100644
--- a/utils/remap.sh
+++ b/utils/remap.sh
@@ -57,10 +57,16 @@ if [ $# -eq 0 ]; then
set -- ${SHELL:-/bin/sh}
fi
+TARGET=
+until [ $# -eq 0 ]; do
+ TARGET="${TARGET} '$(echo "$1" | sed -e "s/'/'\\\\''/g")'"
+ shift
+done
+
# We exec settrans, which execs the "fakeauth" command in the chroot context.
# The `pwd` is evaluated here and now, and that result interpreted inside
# the shell running under fakeauth to chdir there inside the chroot world.
# That shell then execs our arguments as a command line.
exec /bin/settrans --chroot \
- /bin/sh -c "cd `pwd`; $*" \
+ /bin/sh -c "cd `pwd`; exec ${TARGET}" \
-- / /hurd/remap $MAPPED
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 50/70: proc: Remove unused declaration of zombie_list, (continued)
- [hurd] 50/70: proc: Remove unused declaration of zombie_list, Samuel Thibault, 2013/09/16
- [hurd] 31/70: Merge branch 'master-merge2' into master-merge, Samuel Thibault, 2013/09/16
- [hurd] 12/70: umount: add a umount utility, Samuel Thibault, 2013/09/16
- [hurd] 10/70: sutils: allow multiple entries for the device "none", Samuel Thibault, 2013/09/16
- [hurd] 08/70: mount: implement -O, --test-opts, Samuel Thibault, 2013/09/16
- [hurd] 07/70: mount: add -f and --fake arguments, Samuel Thibault, 2013/09/16
- [hurd] 11/70: sutils: fix the semantic of -t, --types in fstab.c, Samuel Thibault, 2013/09/16
- [hurd] 42/70: trans: register symlink translators as important, Samuel Thibault, 2013/09/16
- [hurd] 33/70: Reserve RPC ID for proc_set_init_task, Samuel Thibault, 2013/09/16
- [hurd] 06/70: mount: fix mount -oremount with one parameter, Samuel Thibault, 2013/09/16
- [hurd] 04/70: utils: escape arguments in remap.sh,
Samuel Thibault <=
- [hurd] 30/70: umount: add a umount utility, Samuel Thibault, 2013/09/16
- [hurd] 32/70: Merge branch 'master-merge', Samuel Thibault, 2013/09/16
- [hurd] 28/70: libnetfs: implement file_get_translator_cntl, Samuel Thibault, 2013/09/16
- [hurd] 02/70: Fix polling pfinet tun for write, Samuel Thibault, 2013/09/16
- [hurd] 69/70: Large store support for ext2fs, Samuel Thibault, 2013/09/16
- [hurd] 01/70: config.make: Use more configure settings when building xkb-data, Samuel Thibault, 2013/09/16
- [hurd] 09/70: mount: ignore mounted filesystems if --all is given, Samuel Thibault, 2013/09/16
- [hurd] 05/70: mount: add -n and --no-mtab arguments, Samuel Thibault, 2013/09/16
- [hurd] 29/70: libnetfs: handle dead-name notifications, Samuel Thibault, 2013/09/16
- [hurd] 16/70: Add configure checks for libdaemon, Samuel Thibault, 2013/09/16