Blame SOURCES/sblim-wbemcli-1.6.1-ssl-proto-option.patch

8e04bf
diff -up sblim-wbemcli-1.6.1/CimCurl.cpp.orig sblim-wbemcli-1.6.1/CimCurl.cpp
8e04bf
--- sblim-wbemcli-1.6.1/CimCurl.cpp.orig	2009-03-04 20:10:54.000000000 +0100
8e04bf
+++ sblim-wbemcli-1.6.1/CimCurl.cpp	2015-08-10 13:59:47.312019828 +0200
8e04bf
@@ -165,8 +165,36 @@ void CimomCurl::genRequest(URL &url, con
8e04bf
     rv = curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYHOST, 0);
8e04bf
     //    rv = curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYPEER, 0);
8e04bf
     
8e04bf
-    /* Force using SSL V3 */
8e04bf
-    rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, 3);    
8e04bf
+    /* Force use of a specific SSL/TLS version */
8e04bf
+    char * curlSslVer = getenv("WBEMCLI_CURL_SSLVERSION");
8e04bf
+    if (curlSslVer) {
8e04bf
+      if (!strcasecmp(curlSslVer,"SSLv2"))
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv2);
8e04bf
+      else if (!strcasecmp(curlSslVer,"SSLv3"))
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
8e04bf
+      else if (!strcasecmp(curlSslVer,"TLSv1"))
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
8e04bf
+      else if (!strcasecmp(curlSslVer,"TLSv1.0") || !strcasecmp(curlSslVer,"TLSv1_0"))
8e04bf
+#if LIBCURL_VERSION_NUM >= 0x072200
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0);
8e04bf
+#else
8e04bf
+        throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.0 requires libcurl 7.34 or greater");
8e04bf
+#endif
8e04bf
+      else if (!strcasecmp(curlSslVer,"TLSv1.1") || !strcasecmp(curlSslVer,"TLSv1_1"))
8e04bf
+#if LIBCURL_VERSION_NUM >= 0x072200
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
8e04bf
+#else
8e04bf
+        throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.1 requires libcurl 7.34 or greater");
8e04bf
+#endif
8e04bf
+      else if (!strcasecmp(curlSslVer,"TLSv1.2") || !strcasecmp(curlSslVer,"TLSv1_2"))
8e04bf
+#if LIBCURL_VERSION_NUM >= 0x072200
8e04bf
+        rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
8e04bf
+#else
8e04bf
+        throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.2 requires libcurl 7.34 or greater");
8e04bf
+#endif
8e04bf
+      else
8e04bf
+        throw URLException("unknown WBEMCLI_CURL_SSLVERSION");
8e04bf
+    }
8e04bf
 
8e04bf
     /* Set username and password */
8e04bf
     if (url.user.length() > 0 && url.password.length() > 0) {
8e04bf
diff -up sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in.orig sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in
8e04bf
--- sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in.orig	2015-08-10 14:00:11.217163540 +0200
8e04bf
+++ sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in	2015-08-10 14:00:31.215283763 +0200
8e04bf
@@ -554,6 +554,13 @@ The example in the previous section can
8e04bf
 	wbemcli gi 'myCimom/root/cimv2:rpm_package.name="glibc"'
8e04bf
 .PP
8e04bf
 
8e04bf
+.SH ENVIRONMENT
8e04bf
+.TP
8e04bf
+.B WBEMCLI_CURL_SSLVERSION
8e04bf
+Specifies the SSL protocol that will be used.
8e04bf
+Valid values are SSLv2, SSLv3, TLSv1, TLSv1.0, TLSv1.1 or TLSv1.2.
8e04bf
+If this variable is not set, wbemcli will attempt to figure out the
8e04bf
+remote SSL protocol version.
8e04bf
 .SH FILES
8e04bf
 .TP
8e04bf
 .I @CACERT@