1
1

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.
Этот коммит содержится в:
Owen Taylor 1999-04-08 17:16:58 +00:00
родитель fa95649cfa
Коммит c0820900e4
4 изменённых файлов: 28 добавлений и 8 удалений

Просмотреть файл

@ -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>
* added copy_in capability to mtools filesystem

Просмотреть файл

@ -146,12 +146,21 @@ sub mcdebfs_run
}
else
{
# FIXME: TMP RACE
$tmpcmd="/tmp/mcdebfs.run.$$";
$suffix = "aaa";
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);
system("chmod u+x $tmpcmd");
system($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)
{
TMPDIR=/tmp/mctmpdir.$$
# FIXME: TMP RACE: when mkdir fails, we go there, anyway
mkdir $TMPDIR
# FIXME: Try harder to generate a unique directory if this fails
mkdir -m 0700 $TMPDIR || exit 1
cd $TMPDIR
uni_cat "$1" | cpio -icumd "$2" 2>/dev/null
mv "$2" "$3"

Просмотреть файл

@ -46,8 +46,11 @@ LHA_LIST="lha l"
LHA_GET="lha pq"
LHA_PUT="lha aq"
# Define the temporary name of a command to be run from the archive
TMPCMD=/tmp/mc-cmd.$$
# Define a directory to create a temporary file for when
# 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
@ -137,12 +140,14 @@ mc_lha_fs_copyin ()
mc_lha_fs_run()
{
# FIXME: TMP RACE
trap "rm $TMPCMD; exit 0" 1 2 3 4 15
trap "rm $TMPCMD; rmdir $TMPDIR; 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
chmod a+x $TMPCMD 2> /dev/null
$TMPCMD 2> /dev/null
rm $TMPCMD
rmdir $TMPDIR
}