Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libvirt
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libvirt Packaging Team
libvirt
Commits
368375af
Commit
368375af
authored
14 years ago
by
Guido Günther
Browse files
Options
Downloads
Patches
Plain Diff
Update netcat detectionto new code
parent
46878f5c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
debian/patches/Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
+43
-63
43 additions, 63 deletions
...utodetect-if-the-remote-nc-command-supports-the-q-o.patch
with
43 additions
and
63 deletions
debian/patches/Autodetect-if-the-remote-nc-command-supports-the-q-o.patch
+
43
−
63
View file @
368375af
...
...
@@ -12,72 +12,52 @@ Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/605172
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=562176
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=614420
---
src/remote/remote_driver.c |
47 ++++++++
+++++++++++++++++++++++++++++------
1 files changed,
40
insertions(+),
7
deletions(-)
src/remote/remote_driver.c |
35
+++++++++++++++++++++++++++++------
1 files changed,
29
insertions(+),
6
deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index
e30780c..e5a2f15
100644
index
8335a1a..b85707b
100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -746,7 +746,8 @@
doRemoteOpen (virConnectPtr conn,
}
@@ -774,12 +774,36 @@
doRemoteOpen (virConnectPtr conn,
virCommandAddArgList(cmd, "-T", "-o", "BatchMode=yes", "-e",
"none", NULL);
}
- virCommandAddArgList(cmd, priv->hostname, netcat ? netcat : "nc",
- "-U", (sockname ? sockname :
- (flags & VIR_CONNECT_RO
- ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
- : LIBVIRTD_PRIV_UNIX_SOCKET)), NULL);
case trans_ssh: {
- int j, nr_args = 6;
+ int j, nr_args = 5;
+ virBuffer cmd_netcat = VIR_BUFFER_INITIALIZER;
+ virCommandAddArgList(cmd, priv->hostname, "sh -c", NULL);
+ /*
+ * This ugly thing is a shell script to detect availability of
+ * the -q option for 'nc': debian and suse based distros need this
+ * flag to ensure the remote nc will exit on EOF, so it will go away
+ * when we close the VNC tunnel. If it doesn't go away, subsequent
+ * VNC connection attempts will hang.
+ *
+ * Fedora's 'nc' doesn't have this option, and apparently defaults
+ * to the desired behavior.
+ */
+ virCommandAddArgFormat(cmd, "'%s -q 2>&1 | grep -q \"requires an argument\";"
+ "if [ $? -eq 0 ] ; then"
+ " CMD=\"%s -q 0 -U %s\";"
+ "else"
+ " CMD=\"%s -U %s\";"
+ "fi;"
+ "eval \"$CMD\";'",
+ netcat ? netcat : "nc",
+ netcat ? netcat : "nc",
+ sockname ? sockname :
+ (flags & VIR_CONNECT_RO
+ ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
+ : LIBVIRTD_PRIV_UNIX_SOCKET),
+ netcat ? netcat : "nc",
+ sockname ? sockname :
+ (flags & VIR_CONNECT_RO
+ ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
+ : LIBVIRTD_PRIV_UNIX_SOCKET));
priv->is_secure = 1;
}
if (username) nr_args += 2; /* For -l username */
if (no_tty) nr_args += 5; /* For -T -o BatchMode=yes -e none */
@@ -779,12 +780,44 @@
doRemoteOpen (virConnectPtr conn,
cmd_argv[j++] = strdup ("none");
}
cmd_argv[j++] = strdup (priv->hostname);
- cmd_argv[j++] = strdup (netcat ? netcat : "nc");
- cmd_argv[j++] = strdup ("-U");
- cmd_argv[j++] = strdup (sockname ? sockname :
- (flags & VIR_CONNECT_RO
- ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
- : LIBVIRTD_PRIV_UNIX_SOCKET));
+ cmd_argv[j++] = strdup ("sh -c");
+
+ /*
+ * This ugly thing is a shell script to detect availability of
+ * the -q option for 'nc': debian and suse based distros need this
+ * flag to ensure the remote nc will exit on EOF, so it will go away
+ * when we close the VNC tunnel. If it doesn't go away, subsequent
+ * VNC connection attempts will hang.
+ *
+ * Fedora's 'nc' doesn't have this option, and apparently defaults
+ * to the desired behavior.
+ */
+
+ virBufferVSprintf(&cmd_netcat, "'%s -q 2>&1 | grep -q \"requires an argument\";"
+ "if [ $? -eq 0 ] ; then"
+ " CMD=\"%s -q 0 -U %s\";"
+ "else"
+ " CMD=\"%s -U %s\";"
+ "fi;"
+ "eval \"$CMD\";'",
+ netcat ? netcat : "nc",
+ netcat ? netcat : "nc",
+ sockname ? sockname :
+ (flags & VIR_CONNECT_RO
+ ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
+ : LIBVIRTD_PRIV_UNIX_SOCKET),
+ netcat ? netcat : "nc",
+ sockname ? sockname :
+ (flags & VIR_CONNECT_RO
+ ? LIBVIRTD_PRIV_UNIX_SOCKET_RO
+ : LIBVIRTD_PRIV_UNIX_SOCKET));
+
+ if (virBufferError(&cmd_netcat)) {
+ virBufferFreeAndReset(&cmd_netcat);
+ goto out_of_memory;
+ }
+
+ cmd_argv[j++] = virBufferContentAndReset(&cmd_netcat);
cmd_argv[j++] = 0;
assert (j == nr_args);
for (j = 0; j < (nr_args-1); j++)
--
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment