File 0011-openwsman_client.conf-add-client-curlopt_nosignal.patch of Package openwsman.10653

From e4a555d8175e2eebc290a57e7cedbe3f76c09355 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Tue, 25 Aug 2015 12:34:33 +0200
Subject: [PATCH 11/15] openwsman_client.conf: add client:curlopt_nosignal

---
 etc/openwsman_client.conf             | 6 ++++++
 src/lib/wsman-curl-client-transport.c | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/etc/openwsman_client.conf b/etc/openwsman_client.conf
index b8054625ced1..4e1f09fc433d 100644
--- a/etc/openwsman_client.conf
+++ b/etc/openwsman_client.conf
@@ -11,3 +11,9 @@ agent = openwsman 2.2.0
 
 # crlfile =
 
+# set CURLOPT_NOSIGNAL for libcurl
+# with multithreading client applications, the libcurl backend might crash if DNS lookups time out.
+# setting curlopt_nosignal = 1 prevents these crashes at the risk of hanging DNS lookups.
+# see http://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html for details
+# defaults to 0
+curlopt_nosignal = 0
diff --git a/src/lib/wsman-curl-client-transport.c b/src/lib/wsman-curl-client-transport.c
index bdb4780bcc62..69a54b8f8e2a 100644
--- a/src/lib/wsman-curl-client-transport.c
+++ b/src/lib/wsman-curl-client-transport.c
@@ -280,6 +280,15 @@ init_curl_transport(WsManClient *cl)
 		debug("Could not init easy curl");
 		goto DONE;
 	}
+        // client:curlopt_nosignal
+        if (ini) {
+          int nosignal = iniparser_getint(ini, "client:curlopt_nosignal", 0);
+          r = curl_easy_setopt(curl, CURLOPT_NOSIGNAL, nosignal);
+          if (r != 0) {
+            curl_err("curl_easy_setopt(CURLOPT_NOSIGNAL) failed");
+            goto DONE;
+          }
+        }
 	debug("cl->authentication.verify_peer: %d", cl->authentication.verify_peer );
 	// verify peer
 	r = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, wsman_transport_get_verify_peer(cl)?1:0);
-- 
2.18.0