[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-devel:12414] Re: Cannot print by xdvi-ja.small



佐野@浜松です。

In article <20000522154430.17240.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  at "Tue, 23 May 2000 00:43:04 +0900',
   with "[debian-devel:12411] Re: Cannot print by xdvi-ja.small",
 nakahara@xxxxxxxxxxxxxxxxxxxxx さん writes:

> 中原です。
> 
>  > やすいです.
> 
>  > ii  lpr            2000.05.07-2   BSD lpr/lpd line printer spooling system
> 
> woody ですね。(今のところ woody な machine が周りにありません。)
> lpr_2000.05.07-2 の lpr の man を見るかぎり -s -r option はあるような
> のですが、
> 
> 	lpr -s -r /tmp/XX.dvi 
> 
> は大丈夫ですか。
> 
> xdviprint をどうするかは別として、lpr のバグではないですか。

私もそうかなと思っていたのですが、

ii  lpr            0.48-1         BSD lpr/lpd line printer spooling system

な potato の環境で LANG=C man lpr すると

     -r      Remove the file upon completion of spooling. Can not be used with
             the -s option, due to security concerns.

     -s      Use symbolic links.  Usually files are copied to the spool direc-
             tory.  The -s option will use symlink(2) to link data files
             rather than trying to copy them so large files can be printed.
             This means the files should not be modified or removed until they
             have been printed.

とあって、 -r は -s と一緒には使えなくなっている、みたいです。

 "Can not be used with the -s option, due to security concerns."

たぶん、

lpr (1:0.43-1-1) unstable; urgency=low

  * Fixes two security problems: one permissions race, one symlink attack

 -- Adam Klein <aklein@debian.org>  Sat, 16 Oct 1999 14:15:48 -0700

このあたりに関係しているのかな、という気もするのですが、もしそうであれば、
けっこう前なので、今まで気がつかなかったのは不思議かもしれません。

 # 自分は今までコマンドラインから lpr することが多くて、
 # xdvi 経由で印刷したことが無かったので気がつきませんでした。

試してみると、自分の環境では印刷は可能なんですが、
 /tmp 以下に作成される一時ファイルは削除されないようです。

 xdviprint にある lpr コマンドから -s オプションを除くと
 /tmp 以下の一時ファイルは削除されます。

でも symlink attack って /tmp 以下に重要なファイルへの symlink を
置く攻撃だったような気がするので、spool data を symlink にすると
いう -s オプションとは関係無いような気がするのだけれど、違うのかな。

なお日本語 manpage だと

     -r      スプーリングの終了時、もしくは、出力の終了時にファイルを削除しま
             す (-s オプション使用時)。

     -s      シンボリックリンクを利用します。通常、ファイルはスプールディレク
             トリにコピーされますが、大きなファイルをコピーするよりは -s オプ
             ションで symlink(2) を使ってデータファイルにリンクを張ったほうが
             よいでしょう。つまり、これはファイルのプリントアウトが完了するま
             ではファイルに変更を加えたり、削除したりするべきではないというこ
             とを意味します。

となっていて意味が違ってますね。

-- 
     # (わたしのおうちは浜松市、「夜のお菓子」で有名さ。)
    <kgh12351@xxxxxxxxxxx> : Taketoshi Sano (佐野 武俊)