mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-07 20:24:09 +00:00
lxc-* tools are vulnerable for arguments with spaces
this is related to the bug http://sourceforge.net/tracker/?func=detail&aid=3113612&group_id=163076&atid=826303 that suggested to modify bash lxc script to properly use "$@" in place of "$*" Signed-off-by: Michel Normand <michel.mno@free.fr> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
0411a75203
commit
1a91da6ca6
@ -18,7 +18,7 @@ function get_cgroup()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ls $* $lxcpath
|
ls "$@" $lxcpath
|
||||||
|
|
||||||
active=$(netstat -xa | grep $lxcpath | \
|
active=$(netstat -xa | grep $lxcpath | \
|
||||||
sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
|
sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
|
||||||
@ -26,6 +26,6 @@ active=$(netstat -xa | grep $lxcpath | \
|
|||||||
if test -n "$active"; then
|
if test -n "$active"; then
|
||||||
get_cgroup
|
get_cgroup
|
||||||
if test -n "$mount_point"; then
|
if test -n "$mount_point"; then
|
||||||
cd $mount_point; ls $* -d $active
|
cd $mount_point; ls "$@" -d $active
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -25,7 +25,7 @@ if [ $# -eq 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in $*; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
help; exit 1;;
|
help; exit 1;;
|
||||||
@ -37,7 +37,7 @@ for i in $*; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$exec" ]; then
|
if [ -z "$exec" ]; then
|
||||||
exec @BINDIR@/lxc-unshare -s MOUNT -- $0 -n $name --exec $*
|
exec @BINDIR@/lxc-unshare -s MOUNT -- $0 -n $name --exec "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$name" ]; then
|
if [ -z "$name" ]; then
|
||||||
@ -72,4 +72,4 @@ if [ -z "$pid" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mount --bind /proc/$pid/net /proc/$$/net && \
|
mount --bind /proc/$pid/net /proc/$$/net && \
|
||||||
exec netstat $*
|
exec netstat "$@"
|
||||||
|
@ -83,9 +83,9 @@ if [ $? != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- $(getopt dh $*)
|
set -- $(getopt dh "$@")
|
||||||
|
|
||||||
for i in $*; do
|
for i in "$@"; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-d)
|
-d)
|
||||||
LXC_DROP_CAPS="yes"
|
LXC_DROP_CAPS="yes"
|
||||||
|
@ -81,9 +81,9 @@ if [ $? != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -- $(getopt dh $*)
|
set -- $(getopt dh "$@")
|
||||||
|
|
||||||
for i in $*; do
|
for i in "$@"; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-d)
|
-d)
|
||||||
LXC_DROP_CAPS="yes"
|
LXC_DROP_CAPS="yes"
|
||||||
@ -108,4 +108,4 @@ if [ -z "$LXC_DROP_CAPS" ]; then
|
|||||||
lxc_setuid
|
lxc_setuid
|
||||||
else
|
else
|
||||||
lxc_dropuid
|
lxc_dropuid
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user