From 4540b3a67fcd6dc96c77354b70cd6510fd22f5b0 Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Sun, 8 Apr 2012 16:56:01 +0300
Subject: [PATCH] SetSSLChannels: remove leading s off all spice channel names

---
 SpiceXPI/src/plugin/plugin.cpp |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 8acde24..956c9d3 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -334,13 +334,19 @@ void nsPluginInstance::SetSSLChannels(const char *aSSLChannels)
      * 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");
+    size_t found;
+    const char* chan_names[] = {"smain" , "sdisplay", "sinputs" , "scursor",
+                                "splayback", "srecord"};
+    const int nnames = sizeof(chan_names) / sizeof(chan_names[0]);
+    int i;
+
+    for (i=0; i < nnames; i++) {
+        const char *name = chan_names[i];
+        found = 0;
+        while ((found = m_ssl_channels.find(name, found)) != std::string::npos) {
+            m_ssl_channels.replace(found, strlen(name), name+1);
+        }
+    }
     /* HACK */
 }
 
-- 
1.7.1
