Pino Toscano
2016-May-31 10:06 UTC
[Libguestfs] [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)
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; -- 2.5.5
Richard W.M. Jones
2016-May-31 10:23 UTC
Re: [Libguestfs] [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)
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
Pino Toscano
2016-May-31 10:42 UTC
Re: [Libguestfs] [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)
In data martedì 31 maggio 2016 11:23:06, Richard W.M. Jones ha scritto:> 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?Makes sense indeed -- added in the other two places, and pushed. Thanks, -- Pino Toscano
Apparently Analagous Threads
- Re: [PATCH] p2v: require a non-interative sudo (RHBZ#1340809)
- [PATCH 0/4] p2v: Send ^C to remote end to cancel the conversion.
- [PATCH] p2v: show error dialog if virt-v2v fails (RHBZ#1167601)
- [PATCH] p2v: improve error message for sudo with password
- [PATCH 0/7] p2v: Multiple improvements to the look of virt-p2v.