]> granicus.if.org Git - icinga2/commitdiff
Fixed invalid quoting for network device names
authorPer von Zweigbergk <pvz@itassistans.se>
Thu, 5 Nov 2015 16:23:41 +0000 (17:23 +0100)
committerJean Flach <jean-marcel.flach@netways.de>
Tue, 5 Jan 2016 14:18:22 +0000 (15:18 +0100)
Quoting needs to be with single quotes, not double quotes. Also single quotes need to be escaped.

refs #10544

Signed-off-by: Jean Flach <jean-marcel.flach@netways.de>
plugins/check_network.cpp

index d1e9d1937376bfd361f6e3bb6c11a6469a64b2bc..f140b3f1630929cb1987ed4f5f9afba49fe48d4d 100644 (file)
@@ -30,6 +30,7 @@
 #include <IPHlpApi.h>
 
 #include "check_network.h"
+#include "boost/algorithm/string/replace.hpp"
 
 #define VERSION 1.1
 
@@ -188,7 +189,8 @@ INT printOutput(printInfoStruct& printInfo, CONST std::vector<nInterface>& vInte
                                std::wcout << "\tNo friendly name found, using adapter name\n";
                        wsFriendlyName = it->name;
                }
-               tss << L"netI=\"" << wsFriendlyName << L"\";in=" << it->BytesInSec << "B/s;out=" << it->BytesOutSec << L"B/s ";
+               boost::algorithm::replace_all(wsFriendlyName, "'", "''");
+               tss << L"netI='" << wsFriendlyName << L"';in=" << it->BytesInSec << "B/s;out=" << it->BytesOutSec << L"B/s ";
        }
 
        if (printInfo.warn.rend(tIn + tOut))