Closed llange closed 2 years ago
I'd rather not use code from nagios tbh. Haven't looked into their licenses lately, but i doubt it is compatibly with open source anymore. Besides that, it looks good. Bonus points for the test case :1st_place_medal:
Hi, I understand your concern, but I double-checked the license first to be extra sure it would be compatible withe the GPL-2 of naemon-livestatus :
1) The file is : https://github.com/NagiosEnterprises/nagioscore/blob/master/cgi/cgiutils.c and the license in the header is GPL-2:
*
* CGIUTILS.C - Common utilities for Nagios CGIs
*
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2) Additionally the repo https://github.com/NagiosEnterprises/nagioscore states in the README file the following:
Nagios is a host/service/network monitoring program written in C and released under the GNU General Public License, version 2
3) And last the LICENSE file (21 yr old !!!) for the whole repo is the proper GPL-2.
However, if you so prefer, I can craft another implementation.
alright, then my only remark is to please move the source reference into the git commit message instead of the code.
Done, thanks for your review.
great, thanks
As described in naemon/naemon-core#387, outputs (from passive checks) submitted through LiveStatus were not properly processed, in that the whole output was assigned to
plugin_output
regardless of whether it had multiple lines - or not.The main reason is that LiveStatus being a line-oriented protocol, it was not easy to submit outputs with a linefeed
\n
in them - as this would truncate the line at the\n
boundary.This PR intends to fix that, by allowing an escaped syntax for linefeed :
\\n
(and other control characters) when processing output submitted via LiveStatus. (This was the behaviour of Nagios 3.x - but the implementation may differ).This PR works by introducing a new
unescape_newlines
function shamelessly stolen from Nagios, that will convert\\n
(or any\\X
control characters) to their proper value.A test scenario has been written to validate and protect against possible future regression.
Example: