[Spice-devel] [spice-xpi 1/4] Move secure channel fixup to secure channel setter

Christophe Fergeau cfergeau at redhat.com
Tue Apr 3 07:38:04 PDT 2012


The secure channel names need to be fixed for compatibility with
older spice versions. However, it's better to do it directly when
m_secure_channels is set rather than waiting until its first use
---
 SpiceXPI/src/plugin/plugin.cpp |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index e3e6e80..04d272b 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -329,6 +329,20 @@ char *nsPluginInstance::GetSSLChannels() const
 void nsPluginInstance::SetSSLChannels(const char *aSSLChannels)
 {
     m_ssl_channels = aSSLChannels;
+
+    /*
+     * HACK -- remove leading s from m_SSLChannels, e.g. "main" not "smain"
+     * RHEL5 uses 'smain' and 'sinpusts
+     * RHEL6 uses 'main'  and 'inputs'
+     */
+    std::size_t found = 0;
+    while ((found = m_ssl_channels.find("smain", found)) != std::string::npos)
+        m_ssl_channels.replace(found, 5, "main");
+
+    found = 0;
+    while ((found = m_ssl_channels.find("sinputs", found)) != std::string::npos)
+        m_ssl_channels.replace(found, 7, "inputs");
+    /* HACK */
 }
 
 //* attribute string TrustStore; */
@@ -695,21 +709,6 @@ void nsPluginInstance::Connect()
         SendBool(CONTROLLER_ENABLE_USB, m_usb_redir);
         SendBool(CONTROLLER_ENABLE_USB_AUTOSHARE, m_usb_auto_share);
         SendStr(CONTROLLER_USB_FILTER, m_usb_filter.c_str());
-
-        /*
-         * HACK -- remove leading s from m_SSLChannels, e.g. "main" not "smain"
-         * RHEL5 uses 'smain' and 'sinpusts
-         * RHEL6 uses 'main'  and 'inputs'
-         */
-        std::size_t found = 0;
-        while ((found = m_ssl_channels.find("smain", found)) != std::string::npos)
-            m_ssl_channels.replace(found, 5, "main");
-
-        found = 0;
-        while ((found = m_ssl_channels.find("sinputs", found)) != std::string::npos)
-            m_ssl_channels.replace(found, 7, "inputs");
-        /* HACK */
-
         SendStr(CONTROLLER_SECURE_CHANNELS, m_ssl_channels.c_str());
         SendStr(CONTROLLER_CA_FILE, m_trust_store_file.c_str());
         SendStr(CONTROLLER_HOST_SUBJECT, m_host_subject.c_str());
-- 
1.7.9.3



More information about the Spice-devel mailing list