File 0009-wsmc_create-honor-client-agent-from-openwsman_client.patch of Package openwsman.10653

From ea2a59ff336feb550fdba8cc8eb6d9b6295eb1d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Tue, 25 Aug 2015 12:26:40 +0200
Subject: [PATCH 09/15] wsmc_create: honor client:agent from
 openwsman_client.conf

---
 src/lib/wsman-client.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/lib/wsman-client.c b/src/lib/wsman-client.c
index 88ad07c54644..2732c4b986d2 100644
--- a/src/lib/wsman-client.c
+++ b/src/lib/wsman-client.c
@@ -1987,6 +1987,9 @@ wsmc_create(const char *hostname,
 		const char *username,
 		const char *password)
 {
+#ifndef _WIN32
+        dictionary *ini;
+#endif
 	WsManClient *wsc = (WsManClient *) calloc(1, sizeof(WsManClient));
         if (wsc == NULL) {
           error("Can't alloc WsManClient");
@@ -2000,6 +2003,14 @@ wsmc_create(const char *hostname,
 	}
 #ifndef _WIN32
 	wsmc_set_conffile(wsc, DEFAULT_CLIENT_CONFIG_FILE);
+        ini = iniparser_new(wsmc_get_conffile(wsc));
+        if (ini) {
+          char *user_agent = iniparser_getstr(ini, "client:agent");
+          if (user_agent) {
+            wsman_transport_set_agent(wsc, user_agent);
+          }
+          iniparser_free(ini);
+        }
 #endif
 	wsc->serctx = ws_serializer_init();
 	wsc->dumpfile = stdout;
-- 
2.18.0