1999-04-08 Owen Taylor <otaylor@redhat.com>
* extfs/deb.in extfs/ulha.in extfs/ucpio.in: Fix up sections marked "TMP RACE" comments so they are at least secure.
Этот коммит содержится в:
родитель
fa95649cfa
Коммит
c0820900e4
@ -1,3 +1,9 @@
|
|||||||
|
1999-04-08 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* extfs/deb.in extfs/ulha.in extfs/ucpio.in: Fix
|
||||||
|
up "TMP RACE" comments so they are at least secure,
|
||||||
|
if not terribly robust.
|
||||||
|
|
||||||
1999-03-31 Serge Winitzki <swinitzk@hotmail.com>
|
1999-03-31 Serge Winitzki <swinitzk@hotmail.com>
|
||||||
|
|
||||||
* added copy_in capability to mtools filesystem
|
* added copy_in capability to mtools filesystem
|
||||||
|
@ -146,12 +146,21 @@ sub mcdebfs_run
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# FIXME: TMP RACE
|
$suffix = "aaa";
|
||||||
$tmpcmd="/tmp/mcdebfs.run.$$";
|
while (1) {
|
||||||
|
$tmpdir = /tmp/mcdebfs.run.$$.$suffix;
|
||||||
|
last if mkdir $tmpdir, 0700;
|
||||||
|
$suffix++;
|
||||||
|
# Somebody is being really nasty, give up
|
||||||
|
exit 1 if $suffix eq "zzz";
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpcmd="$tmpdir/run";
|
||||||
&mcdebfs_copyout($archive, $filename, $tmpcmd);
|
&mcdebfs_copyout($archive, $filename, $tmpcmd);
|
||||||
system("chmod u+x $tmpcmd");
|
system("chmod u+x $tmpcmd");
|
||||||
system($tmpcmd);
|
system($tmpcmd);
|
||||||
unlink($tmpcmd);
|
unlink($tmpcmd);
|
||||||
|
rmdir($tmpdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ mccpiofs_copyout ()
|
|||||||
# $3 is a name of a file within the system (to add from or extract to)
|
# $3 is a name of a file within the system (to add from or extract to)
|
||||||
{
|
{
|
||||||
TMPDIR=/tmp/mctmpdir.$$
|
TMPDIR=/tmp/mctmpdir.$$
|
||||||
# FIXME: TMP RACE: when mkdir fails, we go there, anyway
|
# FIXME: Try harder to generate a unique directory if this fails
|
||||||
mkdir $TMPDIR
|
mkdir -m 0700 $TMPDIR || exit 1
|
||||||
cd $TMPDIR
|
cd $TMPDIR
|
||||||
uni_cat "$1" | cpio -icumd "$2" 2>/dev/null
|
uni_cat "$1" | cpio -icumd "$2" 2>/dev/null
|
||||||
mv "$2" "$3"
|
mv "$2" "$3"
|
||||||
|
@ -46,8 +46,11 @@ LHA_LIST="lha l"
|
|||||||
LHA_GET="lha pq"
|
LHA_GET="lha pq"
|
||||||
LHA_PUT="lha aq"
|
LHA_PUT="lha aq"
|
||||||
|
|
||||||
# Define the temporary name of a command to be run from the archive
|
# Define a directory to create a temporary file for when
|
||||||
TMPCMD=/tmp/mc-cmd.$$
|
# running a command to be run from the archive
|
||||||
|
TMPDIR=/tmp/mc-cmd.$$
|
||||||
|
# Temporary file within the directory
|
||||||
|
TMPCMD=$TMPDIR/run
|
||||||
|
|
||||||
# The 'list' command executive
|
# The 'list' command executive
|
||||||
|
|
||||||
@ -137,12 +140,14 @@ mc_lha_fs_copyin ()
|
|||||||
|
|
||||||
mc_lha_fs_run()
|
mc_lha_fs_run()
|
||||||
{
|
{
|
||||||
# FIXME: TMP RACE
|
trap "rm $TMPCMD; rmdir $TMPDIR; exit 0" 1 2 3 4 15
|
||||||
trap "rm $TMPCMD; exit 0" 1 2 3 4 15
|
# FIXME: Try harder to generate a unique directory if this fails
|
||||||
|
mkdir -m 0700 $TMPDIR || exit 1
|
||||||
$LHA_GET $1 $2 > $TMPCMD 2> /dev/null
|
$LHA_GET $1 $2 > $TMPCMD 2> /dev/null
|
||||||
chmod a+x $TMPCMD 2> /dev/null
|
chmod a+x $TMPCMD 2> /dev/null
|
||||||
$TMPCMD 2> /dev/null
|
$TMPCMD 2> /dev/null
|
||||||
rm $TMPCMD
|
rm $TMPCMD
|
||||||
|
rmdir $TMPDIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user