[Libguestfs] [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)

Richard W.M. Jones rjones at redhat.com
Tue May 31 10:23:06 UTC 2016


On Tue, May 31, 2016 at 12:06:15PM +0200, Pino Toscano wrote:
> Run sudo with -n (non-interactive), so it will fail right away when not
> configured to not require a password.  This will avoid the connection to
> time out.
> ---
>  p2v/ssh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/p2v/ssh.c b/p2v/ssh.c
> index b432cbd..c6bf306 100644
> --- a/p2v/ssh.c
> +++ b/p2v/ssh.c
> @@ -490,7 +490,7 @@ test_connection (struct config *config)
>     */
>    if (mexp_printf (h,
>                     "%svirt-v2v --version\n",
> -                   config->sudo ? "sudo " : "") == -1) {
> +                   config->sudo ? "sudo -n " : "") == -1) {
>      set_ssh_error ("mexp_printf: %m");
>      mexp_close (h);
>      return -1;

ACK, but to be on the safe side shouldn't we also need to do the same
thing for the 'virt-v2v --machine-readable' command, and also for the
final virt-v2v command that runs from conversion.c:start_conversion?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list