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

Re: xorriso: extracting files to stdout



Hi,

> Is it possible with xorriso to extract one file (or even cating several
> files) from an iso image to stdout (or to a given filename that would
> not be unlinked first like a fifo or /dev/fd/1 or to any file descriptor
> or maybe to a pipe to a supplied command to exec)?

Currently not. But it would be doable.

The unconditional attempt to delete the extration target file
before writing the extracted data, is a security measure against
symbolic link traps. (As malicious user create a link to a file
which does not offer permission. Then lure an authorized user
into writing data to the link.)

One could lift that precaution for named pipes, block devices,
and character devices.
/dev/fd/1 is supposed to be a symbolic link pointing to some
/dev/pts/NNN. So the ban would also have to be lifted for
symbolic links with appropriate target file types.

So you see any use case where a regular data file should be
overwritten rather than being replaced ?
(Other than the existing xorriso command -paste_in, which
 composes a disk file from several data files in the ISO.)

-----------------------------------------------------------------

The removal of the existing file is performed in
  xorriso/read_run.c : Xorriso_restore_overwrite()
by
     ret= Xorriso_rmx(xorriso, (off_t) 0, path, 8 | (flag & 64));

Then there is a safety precaution against writing to existing files in
  xorriso/read_run.c : Xorriso_tree_restore_node()
by
     if(disk_offset==0 || !(flag&2))
       open_flags|= O_EXCL;

If these two are disabled, then

  -extract /my/file /dev/fd/1

writes the content of  /my/file  to stdout.

-----------------------------------------------------------------

I will put this onto my todo list.

There remains the problem, that xorriso might also write text messages
to stdout, which would be hard to distinguish from file content.
A similar situation is given with ISO image output to stdout. Probably
i can derive safety precautions from that occasion.

How urgent is this feature to you ?


Have a nice day :)

Thomas


Reply to: