On Fri, 17 Jan 2014 21:49:53 +0100, Tobias Stoeckmann wrote:

> lpd wants to verify that it doesn't open a symbolic link, checking with
> lstat(), then open()ing the file.  The only reason I can see that the
> code does not simply use O_NOFOLLOW is a different return value if
> it encounters a symlink (maybe I am wrong here, would like to get feedback
> on this assumption).

All that symlink nonsense is to support "lpr -s".  If you allow a
symlink in the spool you need to make sure it still points to the
same thing that was printed with lpr.

> I suggest to skip lstat() and check the fstat() result later on,
> continuing the train of thought of current lpd behaviour -- lpd will
> just _always_ do the file check.

I don't think that will work since fdev and fino are only set for
"lpr -s" as far as I can tell.  So you still need to be able to
tell whether the file you opened is a link...

 - todd

Reply via email to