Re: [PATCH] command: enforce fd vs. buffer considerations

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

 



2010/12/7 Eric Blake <eblake@xxxxxxxxxx>:
> * docs/internals/command.html.in: Better documentation of buffer
> vs. fd considerations.
> * src/util/command.c (virCommandRunAsync): Reject raw execution
> with string io.
> (virCommandRun): Reject execution with user-specified fds not
> visiting a regular file.
> ---
>
> Perhaps we need to relax the fstat check to permit block devices
> in addition to regular files; but that can be a later patch if needed.
>
> Âdocs/internals/command.html.in | Â 35 ++++++++++++++++++++++++++---------
> Âsrc/util/command.c       |  37 ++++++++++++++++++++++++++++++++++++-
> Â2 files changed, 62 insertions(+), 10 deletions(-)

> + Â Âif (async_io ? (!(cmd->flags & VIR_EXEC_DAEMON) || string_io)
> + Â Â Â Â: ((cmd->flags & VIR_EXEC_DAEMON) && string_io)) {
> + Â Â Â ÂvirCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
> + Â Â Â Â Â Â Â Â Â Â Â Â_("invalid use of command API"));
> + Â Â Â Âreturn -1;
> + Â Â}

> + Â Â/* Buffer management can only be requested via virCommandRun. Â*/
> + Â Âif ((cmd->inbuf && cmd->infd == -1) ||
> + Â Â Â Â(cmd->outbuf && cmd->outfdptr != &cmd->outfd) ||
> + Â Â Â Â(cmd->errbuf && cmd->errfdptr != &cmd->errfd)) {
> + Â Â Â ÂvirCommandError(VIR_ERR_INTERNAL_ERROR, "%s",
> + Â Â Â Â Â Â Â Â Â Â Â Â_("invalid use of command API"));
> + Â Â Â Âreturn -1;
> + Â Â}

Maybe make the error message about invalid use distinct from each
other. That would allow to tell based on the error message what type
of invalid usage has happened.

ACK.

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]