public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2016-04-26  0:30 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2016-04-26  0:30 UTC (permalink / raw
  To: gentoo-commits

commit:     a299e275255caae5bb040d250763c746340b8336
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 26 00:23:28 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Apr 26 00:29:05 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a299e275

net-analyzer/nagios-core: new patch and revision to fix logo installation.

The fix for bug 388321 required a patch, but that patch broke the
installation of the theme logos (which live in their own
directory). That patch has been updated as a new revision,
use-INSTALL-to-install-themes-r1.patch, to avoid impacting
nagios-core-4.0.8-r2.ebuild which is stable on amd64. The new revision
nagios-4.1.1-r1 should pick up the new patch.

Gentoo-Bug: 388321
Gentoo-Bug: 581148

Package-Manager: portage-2.2.26

 .../files/use-INSTALL-to-install-themes-r1.patch   | 65 ++++++++++++++++++++++
 ...re-4.1.1.ebuild => nagios-core-4.1.1-r1.ebuild} |  6 +-
 2 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes-r1.patch b/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes-r1.patch
new file mode 100644
index 0000000..a14f5a3
--- /dev/null
+++ b/net-analyzer/nagios-core/files/use-INSTALL-to-install-themes-r1.patch
@@ -0,0 +1,65 @@
+From b6552e3b0b006fa28014150d199813de12d89ef4 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 25 Apr 2016 20:06:18 -0400
+Subject: [PATCH 1/1] Use $(INSTALL) to install themes.
+
+Most of the images installed under the htdocs folder are installed
+mode 644 with owner:group nagios:nagios. This is due to the use of
+$(INSTALL) in html/Makefile. However, the theme images and stylesheets
+are currently installed with a simple "cp -r", which leads to
+inconsistencies like the following:
+
+  $ cd /usr/share/nagios/htdocs/images
+  $ ls action*.gif
+  -rw-rw-r-- 1 nagios nagios 1.3K 2014-11-12 08:22 action.gif
+  -rw-r--r-- 1 root   root   1.3K 2014-11-12 08:22 action-graph.gif
+  -rw-r--r-- 1 root   root    171 2014-11-12 08:22 action-nagios.gif
+  -rw-r--r-- 1 root   root    162 2014-11-12 08:22 action-orig.gif
+
+By using $(INSTALL) in the install-exfoliation and install-classicui
+targets, we enforce some consistency.
+---
+ Makefile.in | 20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 5b97513..0ec50b7 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -300,8 +300,14 @@ install-webconf:
+ 	@echo ""
+ 
+ install-exfoliation:
+-	cp -rf contrib/exfoliation/stylesheets/* $(DESTDIR)$(HTMLDIR)/stylesheets
+-	cp -rf contrib/exfoliation/images/* $(DESTDIR)$(HTMLDIR)/images
++	for file in contrib/exfoliation/stylesheets/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/stylesheets; done
++
++	for file in contrib/exfoliation/images/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
++
++	for file in contrib/exfoliation/images/logos/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images/logos; done
+ 
+ 	@echo ""
+ 	@echo "*** Exfoliation theme installed ***"
+@@ -309,8 +315,14 @@ install-exfoliation:
+ 	@echo ""
+ 
+ install-classicui:
+-	cp -rf html/stylesheets/* $(DESTDIR)$(HTMLDIR)/stylesheets
+-	cp -rf html/images/* $(DESTDIR)$(HTMLDIR)/images
++	for file in html/stylesheets/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/stylesheets; done
++
++	for file in html/images/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images; done
++
++	for file in html/images/logos/*.*; \
++	do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images/logos; done
+ 
+ 	@echo ""
+ 	@echo "*** Classic theme installed ***"
+-- 
+2.7.3
+

diff --git a/net-analyzer/nagios-core/nagios-core-4.1.1.ebuild b/net-analyzer/nagios-core/nagios-core-4.1.1-r1.ebuild
similarity index 98%
rename from net-analyzer/nagios-core/nagios-core-4.1.1.ebuild
rename to net-analyzer/nagios-core/nagios-core-4.1.1-r1.ebuild
index 69a4faa..748ef0e 100644
--- a/net-analyzer/nagios-core/nagios-core-4.1.1.ebuild
+++ b/net-analyzer/nagios-core/nagios-core-4.1.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -92,9 +92,9 @@ src_prepare(){
 	#
 	# http://tracker.nagios.org/view.php?id=651
 	#
-	# Gentoo bug #388321.
+	# Gentoo bugs #388321 and #581148.
 	#
-	epatch "${FILESDIR}"/use-INSTALL-to-install-themes.patch
+	epatch "${FILESDIR}"/use-INSTALL-to-install-themes-r1.patch
 }
 
 src_configure() {


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2017-01-14 23:30 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2017-01-14 23:30 UTC (permalink / raw
  To: gentoo-commits

commit:     808f26f5899a40b08c1497b1ca97e08fa6add947
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 14 23:29:43 2017 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Jan 14 23:30:04 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=808f26f5

net-analyzer/nagios-core: bring back the 3.x ebuild to save pnp4nagios.

I tried removing the old versions of nagios to address a CVE, but
net-analyzer/pnp4nagios on three arches requires nagios-3.x. I've
filed a keyword request for icinga (which can also satisfy the
dependency), and after those keywords are added and everything is
stabilized we can try this again.

Gentoo-Bug: 602216
Gentoo-Bug: 605724

Package-Manager: portage-2.3.0

 net-analyzer/nagios-core/Manifest                  |   1 +
 net-analyzer/nagios-core/files/99_nagios3.conf     |  15 ++
 .../nagios-core/files/lighttpd_nagios3-r1.conf     |  24 +++
 .../files/nagios-core-3.5.1-process_cgivars.patch  | 175 +++++++++++++++++
 net-analyzer/nagios-core/files/nagios3             |  53 +++++
 net-analyzer/nagios-core/nagios-core-3.5.1.ebuild  | 217 +++++++++++++++++++++
 6 files changed, 485 insertions(+)

diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
index 203f0f3..60c9c97 100644
--- a/net-analyzer/nagios-core/Manifest
+++ b/net-analyzer/nagios-core/Manifest
@@ -1,2 +1,3 @@
+DIST nagios-3.5.1.tar.gz 1763584 SHA256 ca9dd68234fa090b3c35ecc8767b2c9eb743977eaf32612fa9b8341cc00a0f99 SHA512 48e2ecb91002b08203937b12a438c87c62cd3c5c401a0ed9e861cd6d79074c7017ed373e9379f013d87dea1fd7cb8e3d85112d55c87ac91aed96b256868c112d WHIRLPOOL 2c02584702c64dbb0e353e34b758fab079eee0dc7a401e7b5947a21733758d3596401e5519e2dd7f05c89ee4835c21965d2718157fd9d6d3d20af9c853d688ca
 DIST nagios-4.2.4.tar.gz 11088206 SHA256 b0055c475683ce50d77b1536ff0cec9abf89139adecf771601fa021ef9a20b70 SHA512 1f060f3139db6f77f7ca218bb4befb631c08b0ccb1b2b85e4c06cfc94328b5d09cef9b547eb54617089334a1e36b881347dfbb98bcc88b9b38e878214f97883a WHIRLPOOL a3d5454c72ab38388e8071dca8a319c717bb22915cfd06243727eb33f7b8a93cc323531be1535d14e283335b9964762a2729f4605f76d9a01ff78bbe924053a7
 DIST nagios-core-gentoo-icons-20141125.tar 40960 SHA256 68b715f636eb291343cab3259862bbed8b6b898520b58df522438524de3d8761 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766 WHIRLPOOL 7ec3a944b2a659b456d3168818ca5b1af3a427436e6af2f3e5d6cba6fc7b1c7bad6f552301f064df31988865b3b32fd117d9e6f61c630d6d817a51cbbbcb331d

diff --git a/net-analyzer/nagios-core/files/99_nagios3.conf b/net-analyzer/nagios-core/files/99_nagios3.conf
new file mode 100644
index 00000000..074f9ce
--- /dev/null
+++ b/net-analyzer/nagios-core/files/99_nagios3.conf
@@ -0,0 +1,15 @@
+<IfDefine NAGIOS>
+	ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi-bin/
+	<Directory "/usr/lib/nagios/cgi-bin/">
+		AllowOverride AuthConfig
+		Options ExecCGI
+		Order allow,deny
+		Allow from all
+	</Directory>
+	Alias /nagios /usr/share/nagios/htdocs
+	<Directory "/usr/share/nagios/htdocs">
+		AllowOverride AuthConfig
+		Order allow,deny
+		Allow from all
+	</Directory>
+</IfDefine>

diff --git a/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf b/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf
new file mode 100644
index 00000000..6e25770
--- /dev/null
+++ b/net-analyzer/nagios-core/files/lighttpd_nagios3-r1.conf
@@ -0,0 +1,24 @@
+server.modules += ("mod_cgi")
+server.modules += ("mod_auth")
+server.modules += ("mod_alias")
+
+auth.require += ( "/nagios" =>
+  (
+    "method"  => "digest",
+    "realm"   => "nagios",
+    "require" => "valid-user"
+  )
+)
+
+$HTTP["url"] =~ "^/nagios/cgi-bin/" {
+  dir-listing.activate = "disable"
+  cgi.assign = (
+    ".pl"  => "/usr/bin/perl",
+    ".cgi" => ""
+  )
+}
+
+alias.url += (
+  "/nagios/cgi-bin" => "/usr/lib/nagios/cgi-bin",
+  "/nagios"         => "/usr/share/nagios/htdocs"
+)

diff --git a/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch b/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch
new file mode 100644
index 00000000..9d95367
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-core-3.5.1-process_cgivars.patch
@@ -0,0 +1,175 @@
+commit d97e03f32741a7d851826b03ed73ff4c9612a866
+Author: Eric Stanley <estanley@nagios.com>
+Date:   Fri Dec 20 13:14:30 2013 -0600
+
+    CGIs: Fixed minor vulnerability where a custom query could crash the CGI.
+    
+    Most CGIs previously incremented the input variable counter twice when
+    it encountered a long key value. This could cause the CGI to read past
+    the end of the list of CGI variables. This commit removes the second
+    increment, removing the possibility of reading past the end of the list
+    of CGI variables.
+
+diff --git a/cgi/avail.c b/cgi/avail.c
+index 76afd86..64eaadc 100644
+--- a/cgi/avail.c
++++ b/cgi/avail.c
+@@ -1096,7 +1096,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/cmd.c b/cgi/cmd.c
+index fa6cf5a..50504eb 100644
+--- a/cgi/cmd.c
++++ b/cgi/cmd.c
+@@ -311,7 +311,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/config.c b/cgi/config.c
+index f061b0f..3360e70 100644
+--- a/cgi/config.c
++++ b/cgi/config.c
+@@ -344,7 +344,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/extinfo.c b/cgi/extinfo.c
+index 62a1b18..5113df4 100644
+--- a/cgi/extinfo.c
++++ b/cgi/extinfo.c
+@@ -591,7 +591,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/histogram.c b/cgi/histogram.c
+index 4616541..f6934d0 100644
+--- a/cgi/histogram.c
++++ b/cgi/histogram.c
+@@ -1060,7 +1060,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/notifications.c b/cgi/notifications.c
+index 8ba11c1..461ae84 100644
+--- a/cgi/notifications.c
++++ b/cgi/notifications.c
+@@ -327,7 +327,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/outages.c b/cgi/outages.c
+index 426ede6..cb58dee 100644
+--- a/cgi/outages.c
++++ b/cgi/outages.c
+@@ -225,7 +225,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/status.c b/cgi/status.c
+index 3253340..4ec1c92 100644
+--- a/cgi/status.c
++++ b/cgi/status.c
+@@ -567,7 +567,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/statusmap.c b/cgi/statusmap.c
+index ea48368..2580ae5 100644
+--- a/cgi/statusmap.c
++++ b/cgi/statusmap.c
+@@ -400,7 +400,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/statuswml.c b/cgi/statuswml.c
+index bd8cea2..d25abef 100644
+--- a/cgi/statuswml.c
++++ b/cgi/statuswml.c
+@@ -226,8 +226,13 @@ int process_cgivars(void) {
+ 
+ 	for(x = 0; variables[x] != NULL; x++) {
+ 
++		/* do some basic length checking on the variable identifier to prevent buffer overflows */
++		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
++			continue;
++			}
++
+ 		/* we found the hostgroup argument */
+-		if(!strcmp(variables[x], "hostgroup")) {
++		else if(!strcmp(variables[x], "hostgroup")) {
+ 			display_type = DISPLAY_HOSTGROUP;
+ 			x++;
+ 			if(variables[x] == NULL) {
+diff --git a/cgi/summary.c b/cgi/summary.c
+index 126ce5e..749a02c 100644
+--- a/cgi/summary.c
++++ b/cgi/summary.c
+@@ -725,7 +725,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/cgi/trends.c b/cgi/trends.c
+index b35c18e..895db01 100644
+--- a/cgi/trends.c
++++ b/cgi/trends.c
+@@ -1263,7 +1263,6 @@ int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 
+diff --git a/contrib/daemonchk.c b/contrib/daemonchk.c
+index 78716e5..9bb6c4b 100644
+--- a/contrib/daemonchk.c
++++ b/contrib/daemonchk.c
+@@ -174,7 +174,6 @@ static int process_cgivars(void) {
+ 
+ 		/* do some basic length checking on the variable identifier to prevent buffer overflows */
+ 		if(strlen(variables[x]) >= MAX_INPUT_BUFFER - 1) {
+-			x++;
+ 			continue;
+ 			}
+ 		}

diff --git a/net-analyzer/nagios-core/files/nagios3 b/net-analyzer/nagios-core/files/nagios3
new file mode 100644
index 00000000..48b4f46
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios3
@@ -0,0 +1,53 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+nagios_config="/etc/nagios/nagios.cfg"
+nagios_cmdfile="/var/nagios/rw/nagios.cmd"
+
+command="/usr/sbin/nagios"
+command_args="-d ${nagios_config}"
+pidfile="/var/nagios/nagios.lock"
+start_stop_daemon_args="-e HOME=/var/nagios/home"
+
+depend() {
+	need net
+	use dns logger firewall
+	after mysql postgresql
+}
+
+reload()
+{
+	checkconfig || return 1
+	ebegin "Reloading configuration"
+	start-stop-daemon --signal HUP --pidfile ${pidfile}
+	eend $?
+}
+
+checkconfig() {
+	ebegin "Verifying config files"
+
+	# Silent Check
+	/usr/sbin/nagios -v ${nagios_config} &>/dev/null && return 0
+
+	# Now we know there's problem - run again and display errors
+	/usr/sbin/nagios -v ${nagios_config}
+	eend $? "Configuration Error. Please fix your configfile"
+}
+
+start_pre() {
+	checkconfig || return 1
+
+	touch /var/nagios/nagios.log /var/nagios/status.sav
+	chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
+	rm -f ${nagios_cmdfile}
+}
+
+stop_post() {
+	rm -f /var/nagios/status.log /var/nagios/nagios.tmp ${pidfile} \
+		${nagios_cmdfile}
+}

diff --git a/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild b/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild
new file mode 100644
index 00000000..a6e24f3
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-3.5.1.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit depend.apache eutils multilib toolchain-funcs user
+
+MY_P=${PN/-core}-${PV}
+DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
+HOMEPAGE="http://www.nagios.org/"
+SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm ~arm64 hppa ppc ppc64 sparc x86"
+IUSE="debug lighttpd perl +web vim-syntax"
+DEPEND="virtual/mailx
+	web? (
+		>=media-libs/gd-1.8.3-r5[jpeg,png]
+		lighttpd? ( www-servers/lighttpd dev-lang/php[cgi] )
+		apache2? ( || ( dev-lang/php[apache2] dev-lang/php[cgi] ) )
+	)
+	perl? ( >=dev-lang/perl-5.6.1-r7:= )"
+RDEPEND="${DEPEND}
+	!net-analyzer/nagios-imagepack
+	vim-syntax? ( app-vim/nagios-syntax )"
+
+want_apache2
+
+S="${WORKDIR}/${PN/-core}"
+
+pkg_setup() {
+	depend.apache_pkg_setup
+
+	enewgroup nagios
+	enewuser nagios -1 /bin/bash /var/nagios/home nagios
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/${PN}-3.5.1-process_cgivars.patch"
+	local strip="$(echo '$(MAKE) strip-post-install')"
+	sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in"
+}
+
+src_configure() {
+	local myconf
+
+	if use perl ; then
+		myconf="${myconf} --enable-embedded-perl --with-perlcache"
+	fi
+
+	if use debug; then
+		myconf="${myconf} --enable-DEBUG0"
+		myconf="${myconf} --enable-DEBUG1"
+		myconf="${myconf} --enable-DEBUG2"
+		myconf="${myconf} --enable-DEBUG3"
+		myconf="${myconf} --enable-DEBUG4"
+		myconf="${myconf} --enable-DEBUG5"
+	fi
+
+	if use !apache2 && use !lighttpd ; then
+		myconf="${myconf} --with-command-group=nagios"
+	else
+		if use apache2 ; then
+			myconf="${myconf} --with-command-group=apache"
+			myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
+		elif use lighttpd ; then
+			myconf="${myconf} --with-command-group=lighttpd"
+		fi
+	fi
+
+	econf ${myconf} \
+		--prefix=/usr \
+		--bindir=/usr/sbin \
+		--sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
+		--datadir=/usr/share/nagios/htdocs \
+		--localstatedir=/var/nagios \
+		--sysconfdir=/etc/nagios \
+		--libexecdir=/usr/$(get_libdir)/nagios/plugins
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) nagios
+
+	if use web ; then
+		# Only compile the CGI's if "web" useflag is set.
+		emake CC=$(tc-getCC) DESTDIR="${D}" cgis
+	fi
+}
+
+src_install() {
+	dodoc Changelog INSTALLING LEGAL README UPGRADING
+
+	if ! use web ; then
+		sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
+			-e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
+			-e 's/$(MAKE) install-exfoliation/# line removed due missing web use flag/' \
+			Makefile
+	fi
+
+	sed -i -e 's/^contactgroups$//g' Makefile
+
+	emake DESTDIR="${D}" install
+	emake DESTDIR="${D}" install-config
+	emake DESTDIR="${D}" install-commandmode
+	if use web; then
+		emake DESTDIR="${D}" install-classicui
+	fi
+
+	newinitd "${FILESDIR}"/nagios3 nagios
+	newconfd "${FILESDIR}"/conf.d nagios
+
+	# Apache Module
+	if use web ; then
+		if use apache2 ; then
+			insinto "${APACHE_MODULES_CONFDIR}"
+			doins "${FILESDIR}"/99_nagios3.conf
+	    elif use lighttpd ; then
+			insinto /etc/lighttpd
+			newins "${FILESDIR}/lighttpd_nagios3-r1.conf" nagios.conf
+		else
+			ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
+			ewarn "out-of-the-box. Since you are not using one of them, you"
+			ewarn "have to configure your webserver accordingly yourself."
+		fi
+
+	fi
+
+	for dir in etc/nagios var/nagios ; do
+		chown -R nagios:nagios "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
+	done
+
+	dosbin p1.pl
+
+	chown -R root:root "${D}"/usr/$(get_libdir)/nagios
+	find "${D}"/usr/$(get_libdir)/nagios -type d -print0 | xargs -0 chmod 755
+	find "${D}"/usr/$(get_libdir)/nagios/cgi-bin -type f -print0 | xargs -0 chmod 755
+
+	keepdir /etc/nagios
+	keepdir /var/nagios
+	keepdir /var/nagios/archives
+	keepdir /var/nagios/rw
+	keepdir /var/nagios/spool/checkresults
+
+	if use !apache2 && use !lighttpd; then
+		chown -R nagios:nagios "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+	else
+		if use apache2 ; then
+			chown -R nagios:apache "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+		elif use lighttpd ; then
+			chown -R nagios:lighttpd "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
+		fi
+	fi
+
+	chmod ug+s "${D}"/var/nagios/rw || die "Failed Chmod of ${D}/var/nagios/rw"
+	chmod 0750 "${D}"/etc/nagios || die "Failed chmod of ${D}/etc/nagios"
+}
+
+pkg_postinst() {
+	elog "If you want nagios to start at boot time"
+	elog "remember to execute:"
+	elog "  rc-update add nagios default"
+	elog
+
+	if use web ; then
+		elog "This does not include cgis that are perl-dependent"
+		elog "Currently traceroute.cgi is perl-dependent"
+		elog "To have ministatus.cgi requires copying of ministatus.c"
+		elog "to cgi directory for compiling."
+
+		elog "Note that the user your webserver is running at needs"
+		elog "read-access to /etc/nagios."
+		elog
+
+		if use apache2 || use lighttpd ; then
+			elog "There are several possible solutions to accomplish this,"
+			elog "choose the one you are most comfortable with:"
+			elog
+			if use apache2 ; then
+				elog "	usermod -G nagios apache"
+				elog "or"
+				elog "	chown nagios:apache /etc/nagios"
+				elog
+				elog "Also edit /etc/conf.d/apache2 and add \"-D NAGIOS\""
+			elif use lighttpd ; then
+				elog "  usermod -G nagios lighttpd "
+				elog "or"
+				elog "  chown nagios:lighttpd /etc/nagios"
+			fi
+			elog
+			elog "That will make nagios's web front end visable via"
+			elog "http://localhost/nagios/"
+			elog
+		else
+			elog "IMPORTANT: Do not forget to add the user your webserver"
+			elog "is running as to the nagios group!"
+		fi
+
+	else
+		elog "Please note that you have installed Nagios without web interface."
+		elog "Please don't file any bugs about having no web interface when you do this."
+		elog "Thank you!"
+	fi
+
+	elog
+	elog "If your kernel has /proc protection, nagios"
+	elog "will not be happy as it relies on accessing the proc"
+	elog "filesystem. You can fix this by adding nagios into"
+	elog "the group wheel, but this is not recomended."
+	elog
+}
+
+pkg_postinst() {
+	einfo "Fixing permissions"
+	chown nagios:nagios "${ROOT}"var/nagios
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2018-08-08 21:08 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2018-08-08 21:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7a67d7c03bbbbc3a81ce80c3f5aaf4e931402a12
Author:     Tomas Mozes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Wed Aug  8 06:21:04 2018 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Aug  8 21:08:26 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7a67d7c0

net-analyzer/nagios-core: bump to 4.4.1

Closes: https://bugs.gentoo.org/662194
Package-Manager: Portage-2.3.44, Repoman-2.3.10
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 net-analyzer/nagios-core/Manifest                  |   1 +
 .../nagios-core/files/nagios-4.4.2-pre.patch       | 209 ++++++++++++++++++++
 net-analyzer/nagios-core/nagios-core-4.4.1.ebuild  | 218 +++++++++++++++++++++
 3 files changed, 428 insertions(+)

diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
index f051a22305c..11a8055082a 100644
--- a/net-analyzer/nagios-core/Manifest
+++ b/net-analyzer/nagios-core/Manifest
@@ -1,4 +1,5 @@
 DIST nagios-4.3.3.tar.gz 11101531 BLAKE2B 537d49ecf28b457fbc1e24eaaa9c5d9e8c4db59ed69c91a573c0cacb6cfb6fd2d52c31e87c0cef34b81a69247bb5b9513983d95e7eae3ea7f861742da485d2d4 SHA512 588292a95342cb2d95d7b58f70442b82b99a23dd9fdc1390e9ae0743626a047e5127d77b1d7e6a1d8edd6f34a425e581bcd42459b673a0ddea14125bde4b7d9e
 DIST nagios-4.3.4.tar.gz 11101966 BLAKE2B 6cb8182f40a4f83875c94df040bb1c62ce078d4130e10fa8595ea0b14cf715fc2a237ffb34199da9c1528e4789f3ce8deae3d993b5b795ad712d48b1e5fdb820 SHA512 f4e92aa98151739442a225a245871d93b5560d89510bdacb1a615959b9687f7a92675f10fcba71078b104ca8f237b0155a9261d67ec66f80aec7f033b4b3e316
 DIST nagios-4.4.0.tar.gz 11295727 BLAKE2B f89e7934b13814ec8c0ae7a19f14eed8842c7b0044fb2812f1399f27a82e5a639b63cc53f04b58ae99aa87bf595b2e25642ad3eb134a041e39f744919bd46d2f SHA512 8c136463133cf26c756ccd39b158ed417297e30f8a0b12d063a4dba6a43f126b27bb5f7ea962c8cde9fb9c1fd8d3439d7cfeaab833045315a9800c993fa0676f
+DIST nagios-4.4.1.tar.gz 11296403 BLAKE2B fdbaec5f913d18d5591f44cd1e0622b9741d7415b591f24f1521f2897b8a1bdbff00e9378ef6b3a6a99ab8d639960abd3d734fd66b665ea88ea1de169b552ace SHA512 d84f22a8fd21a573b4162f232c3a6bb2ba0b7d3a470e5fd80183a1862d2ae666956cfc2dd4c7fe6319ee7ccedb9f8a6920ba39a6b499ed9ff5b8be60a9779fa9
 DIST nagios-core-gentoo-icons-20141125.tar 40960 BLAKE2B 31c1953e1160c7c7b89606b72b1a80407e4c1b7a7938b40bd1c577cd0c309dd88ca6b775d692a9b846dbf67736537fa9c91e56aa15fdd447769608ca525bff09 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766

diff --git a/net-analyzer/nagios-core/files/nagios-4.4.2-pre.patch b/net-analyzer/nagios-core/files/nagios-4.4.2-pre.patch
new file mode 100644
index 00000000000..6483b9df9f2
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-4.4.2-pre.patch
@@ -0,0 +1,209 @@
+diff --git a/Changelog b/Changelog
+index 1e1bd9e2..8dd26fec 100644
+--- a/Changelog
++++ b/Changelog
+@@ -2,6 +2,18 @@
+ Nagios Core 4 Change Log
+ ########################
+ 
++4.4.2 - ??????????
++------------------
++FIXES
++* Fix comment data being duplicated after a `service nagios reload` or similar (Bryan Heden)
++* Fix check_interval and retry_interval not changing at the appropriate times (Scott Wilkerson)
++* Fixed passive checks sending recovery email when host was previously UP (Scott Wilkerson)
++* Fixed flapping comments duplication on nagios reload (Christian Jung)
++* Fix for CVE-2018-13441, CVE-2018-13458, CVE-2018-13457 null pointer dereference (Trevor McDonald)
++* Fixed syntax error in file: default-init.in (#558) (Christian Zettel)
++* Reset current notification number and state flags when the host recovers, reset all service variables when they recover fixes (#557) (Scott Wilkerson)
++* Fixed wrong counting of service status totals when showing servicegroup details (#548) (Christian Zettel, Bryan Heden)
++
+ 4.4.1 - 2018-06-25
+ ------------------
+ FIXES
+diff --git a/base/checks.c b/base/checks.c
+index 725dec9d..d45b6ac4 100644
+--- a/base/checks.c
++++ b/base/checks.c
+@@ -911,6 +911,11 @@ static inline void service_state_or_hard_state_type_change(service * svc, int st
+ 
+ 	if (state_or_type_change) {
+ 
++		/* check if service should go into downtime from flexible downtime */
++		if (svc->pending_flex_downtime > 0) {
++			check_pending_flex_service_downtime(svc);
++		}
++
+ 		/* reset notification times and suppression option */
+ 		svc->last_notification = (time_t)0;
+ 		svc->next_notification = (time_t)0;
+@@ -941,7 +946,10 @@ static inline void host_state_or_hard_state_type_change(host * hst, int state_ch
+ 
+ 		log_debug_info(DEBUGL_CHECKS, 2, "Check type passive and passive host checks aren't false\n");
+ 		
+-		hst->current_attempt = 1;
++		if (state_change == TRUE) {
++            hst->current_attempt = 1;
++        }
++        
+ 		hard_state_change = TRUE;
+ 	}
+ 
+@@ -989,6 +997,9 @@ static inline void host_state_or_hard_state_type_change(host * hst, int state_ch
+ 
+ 	if (state_or_type_change) {
+ 
++		/* check if host should go into downtime from flexible downtime */
++		check_pending_flex_host_downtime(hst);
++
+ 		/* reset notification times and suppression option */
+ 		hst->last_notification = (time_t)0;
+ 		hst->next_notification = (time_t)0;
+@@ -1228,7 +1239,7 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 	next_check = (time_t)(svc->last_check + (svc->check_interval * interval_length));
+ 
+ 	/***********************************************/
+-	/********** SCHEDULE HOST CHECK LOGIC **********/
++	/********** SCHEDULE SERVICE CHECK LOGIC **********/
+ 	/***********************************************/
+ 	if (svc->current_state == STATE_OK) {
+ 
+@@ -1269,6 +1280,7 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 
+ 			svc->host_problem_at_last_check = TRUE;
+ 		}
++        
+ 	}
+ 	else {
+ 
+@@ -1368,6 +1380,9 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 		else {
+ 
+ 			log_debug_info(DEBUGL_CHECKS, 1, "Service is a non-OK state (%s)!", service_state_name(svc->current_state));
++            
++            svc->state_type = SOFT_STATE;
++			svc->current_attempt = 1;
+ 
+ 			handle_event = TRUE;
+ 		}
+@@ -1395,6 +1410,21 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 
+ 				log_debug_info(DEBUGL_CHECKS, 1, "Service experienced a SOFT recovery.\n");				
+ 			}
++            
++            
++            /* reset all service variables because its okay now... */
++            svc->host_problem_at_last_check = FALSE;
++            svc->current_attempt = 1;
++            svc->state_type = HARD_STATE;
++            svc->last_hard_state = STATE_OK;
++            svc->last_notification = (time_t)0;
++            svc->next_notification = (time_t)0;
++            svc->current_notification_number = 0;
++            svc->problem_has_been_acknowledged = FALSE;
++            svc->acknowledgement_type = ACKNOWLEDGEMENT_NONE;
++            svc->notified_on = 0;
++            
++            hard_state_change = TRUE;
+ 		}
+ 
+ 		/***** SERVICE IS STILL IN PROBLEM STATE *****/
+@@ -1418,6 +1448,14 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 			}
+ 		}
+ 	}
++    
++    /* soft states should be using retry_interval */
++    if (svc->state_type == SOFT_STATE) {
++        
++            log_debug_info(DEBUGL_CHECKS, 2, "Service state type is soft, using retry_interval\n");
++            
++            next_check = (unsigned long) (current_time + svc->retry_interval * interval_length);
++    }
+ 
+ 	/* check for a state change */
+ 	if (svc->current_state != svc->last_state || (svc->current_state == STATE_OK && svc->state_type == SOFT_STATE)) {
+@@ -1454,6 +1492,8 @@ int handle_async_service_check_result(service *svc, check_result *cr)
+ 	if (svc->current_attempt >= svc->max_attempts && svc->current_state != svc->last_hard_state) {
+ 
+ 		log_debug_info(DEBUGL_CHECKS, 2, "Service had a HARD STATE CHANGE!!\n");
++        
++        next_check = (unsigned long)(current_time + (svc->check_interval * interval_length));
+ 
+ 		hard_state_change = TRUE;
+ 
+@@ -2197,6 +2237,9 @@ int handle_async_host_check_result(host *hst, check_result *cr)
+ 		else {
+ 
+ 			log_debug_info(DEBUGL_CHECKS, 1, "Host is no longer UP (%s)!\n", host_state_name(hst->current_state));
++            
++            hst->state_type = SOFT_STATE;
++            hst->current_attempt = 1;
+ 
+ 			/* propagate checks to immediate parents if they are UP */
+ 			host_propagate_checks_to_immediate_parents(hst, FALSE, current_time);
+@@ -2276,7 +2319,9 @@ int handle_async_host_check_result(host *hst, check_result *cr)
+ 	if (hst->current_state != HOST_UP && (hst->check_type == CHECK_TYPE_ACTIVE || translate_passive_host_checks == TRUE)) {
+ 
+ 		hst->current_state = determine_host_reachability(hst);
+-		next_check = (unsigned long)(current_time + (hst->retry_interval * interval_length));
++		if (hst->state_type == SOFT_STATE)
++            next_check = (unsigned long)(current_time + (hst->retry_interval * interval_length));
++        
+ 	}
+ 
+ 	/* check for state change */
+@@ -2310,7 +2355,9 @@ int handle_async_host_check_result(host *hst, check_result *cr)
+ 
+ 		log_debug_info(DEBUGL_CHECKS, 2, "Host had a HARD STATE CHANGE!!\n");
+ 
+-		hard_state_change = TRUE;
++		next_check = (unsigned long)(current_time + (hst->check_interval * interval_length));
++        
++        hard_state_change = TRUE;
+ 		send_notification = TRUE;
+ 	}
+ 
+@@ -2372,6 +2419,12 @@ int handle_async_host_check_result(host *hst, check_result *cr)
+ 		}
+ 	}
+ 
++    /* the host recovered, so reset the current notification number and state flags (after the recovery notification has gone out) */
++    if(hst->current_state == HOST_UP && hst->state_type == HARD_STATE && hard_state_change == TRUE) {
++        hst->current_notification_number = 0;
++        hst->notified_on = 0;
++        }
++        
+ 	if (obsess_over_hosts == TRUE) {
+ 		obsessive_compulsive_host_check_processor(hst);
+ 	}
+diff --git a/base/nagios.c b/base/nagios.c
+index 520ba71e..24719647 100644
+--- a/base/nagios.c
++++ b/base/nagios.c
+@@ -878,6 +878,9 @@ int main(int argc, char **argv) {
+ 			/* clean up the scheduled downtime data */
+ 			cleanup_downtime_data();
+ 
++			/* clean up comment data */
++			free_comment_data();
++
+ 			/* clean up the status data if we are not restarting */
+ 			if(sigrestart == FALSE) {
+ 				cleanup_status_data(TRUE);
+diff --git a/cgi/status.c b/cgi/status.c
+index 20c4ed48..8b1c8b31 100644
+--- a/cgi/status.c
++++ b/cgi/status.c
+@@ -873,6 +873,11 @@ void show_service_status_totals(void) {
+ 				count_service = 1;
+ 			}
+ 		else if(display_type == DISPLAY_SERVICEGROUPS) {
++
++			if (is_service_member_of_servicegroup(find_servicegroup(servicegroup_name), temp_service) == FALSE) {
++				continue;
++			}
++
+ 			if(show_all_servicegroups == TRUE) {
+ 				count_service = 1;
+ 				}

diff --git a/net-analyzer/nagios-core/nagios-core-4.4.1.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.1.ebuild
new file mode 100644
index 00000000000..bfc0aac4a73
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-4.4.1.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs user
+
+MY_P=${PN/-core}-${PV}
+DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
+HOMEPAGE="https://www.nagios.org/"
+
+# The name of the directory into which our Gentoo icons will be
+# extracted, and also the basename of the archive containing it.
+GENTOO_ICONS="${PN}-gentoo-icons-20141125"
+SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
+	web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="apache2 classicui lighttpd perl +web vim-syntax"
+
+# In pkg_postinst(), we change the group of the Nagios configuration
+# directory to that of the web server user. It can't belong to both
+# apache/lighttpd groups at the same time, so we block this combination
+# for our own sanity.
+#
+# This could be made to work, but we would need a better way to allow
+# the web user read-only access to Nagios's configuration directory.
+#
+REQUIRED_USE="apache2? ( !lighttpd )"
+
+# sys-devel/libtool dependency is bug #401237.
+#
+# Note, we require one of the apache2 CGI modules:
+#
+#   * mod_cgi
+#   * mod_cgid
+#   * mod_fcgid
+#
+# We just don't care /which/ one. And of course PHP supports both CGI
+# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
+# dependencies, and expect the user not to do anything /too/
+# stupid. (For example, installing Apache with only FastCGI support, and
+# PHP with only CGI support.)
+#
+# Another annoyance is that the upstream Makefile uses app-arch/unzip to
+# extract a snapshot of AngularJS, but that's only needed when USE=web.
+#
+MOD_ALIAS=apache2_modules_alias
+DEPEND="sys-devel/libtool
+	virtual/mailx
+	perl? ( dev-lang/perl:= )
+	web? (
+		app-arch/unzip
+		media-libs/gd[jpeg,png]
+		lighttpd? ( www-servers/lighttpd[php] )
+		apache2? (
+			|| (
+				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgi]
+				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgid]
+				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_fcgid] )
+			|| (
+				dev-lang/php:*[apache2]
+				dev-lang/php:*[cgi]
+				dev-lang/php:*[fpm] )
+		)
+	)"
+RDEPEND="${DEPEND}
+	vim-syntax? ( app-vim/nagios-syntax )"
+
+PATCHES=(
+	"${FILESDIR}/nagios-4.4.2-pre.patch"
+)
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+	enewgroup nagios
+	enewuser nagios -1 /bin/bash /var/nagios/home nagios
+}
+
+src_configure() {
+	local myconf
+
+	if use perl; then
+		myconf="${myconf} --enable-embedded-perl --with-perlcache"
+	fi
+
+	if use !apache2 && use !lighttpd ; then
+		myconf="${myconf} --with-command-group=nagios"
+	else
+		if use apache2 ; then
+			myconf="${myconf} --with-command-group=apache"
+			myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
+		elif use lighttpd ; then
+			myconf="${myconf} --with-command-group=lighttpd"
+		fi
+	fi
+
+	econf ${myconf} \
+		--prefix=/usr \
+		--bindir=/usr/sbin \
+		--sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
+		--datadir=/usr/share/nagios/htdocs \
+		--localstatedir=/var/nagios \
+		--sysconfdir=/etc/nagios \
+		--libexecdir=/usr/$(get_libdir)/nagios/plugins
+}
+
+src_compile() {
+	emake CC=$(tc-getCC) nagios
+
+	if use web; then
+		# Only compile the CGIs/HTML when USE=web is set.
+		emake CC=$(tc-getCC) DESTDIR="${D}" cgis html
+	fi
+}
+
+src_install() {
+	dodoc Changelog CONTRIBUTING.md README.md THANKS UPGRADING
+
+	# There is no way to install the CGIs unstripped from the top-level
+	# makefile, so descend into base/ here. The empty INSTALL_OPTS
+	# ensures that root:root: owns the nagios executables.
+	cd "${S}/base" || die
+	emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
+	cd "${S}" || die
+
+	# Otherwise this gets installed as 770 and you get "access denied"
+	# for some reason or other when starting nagios. The permissions
+	# on nagiostats are just for consistency (these should both get
+	# fixed upstream).
+	fperms 775 /usr/sbin/nagios /usr/sbin/nagiostats
+
+	# INSTALL_OPTS are needed for most of install-basic, but we don't
+	# want them on the LIBEXECDIR, argh.
+	emake DESTDIR="${D}" install-basic
+	fowners root:root /usr/$(get_libdir)/nagios/plugins
+
+	# Don't make the configuration owned by the nagios user, because
+	# then he can edit nagios.cfg and trick nagios into running as root
+	# and doing his bidding.
+	emake INSTALL_OPTS="" DESTDIR="${D}" install-config
+
+	# No INSTALL_OPTS used in install-commandmode, thankfully.
+	emake DESTDIR="${D}" install-commandmode
+
+	if use web; then
+		# There is no way to install the CGIs unstripped from the
+		# top-level makefile, so descend into cgi/ here. The empty
+		# INSTALL_OPTS ensures that root:root: owns the CGI executables.
+		cd "${S}/cgi" || die
+		emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
+		cd "${S}" || die
+
+		# install-html installs the new exfoliation theme
+		emake INSTALL_OPTS="" DESTDIR="${D}" install-html
+
+		if use classicui; then
+			# This overwrites the already-installed exfoliation theme
+			emake INSTALL_OPTS="" DESTDIR="${D}" install-classicui
+		fi
+
+		# Install cute Gentoo icons (bug #388323), setting their
+		# owner, group, and mode to match those of the rest of Nagios's
+		# images.
+		insinto /usr/share/nagios/htdocs/images/logos
+		doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
+	fi
+
+	newinitd startup/openrc-init nagios
+
+	if use web ; then
+		if use apache2 ; then
+			# Install the Nagios configuration file for Apache.
+			insinto "/etc/apache2/modules.d"
+			doins "${FILESDIR}"/99_nagios4.conf
+		elif use lighttpd ; then
+			# Install the Nagios configuration file for Lighttpd.
+			insinto /etc/lighttpd
+			newins "${FILESDIR}/lighttpd_nagios4.conf" nagios.conf
+		else
+			ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
+			ewarn "out of the box. Since you are not using one of them, you"
+			ewarn "will have to configure your webserver yourself."
+		fi
+	fi
+}
+
+pkg_postinst() {
+
+	if use web; then
+		if use apache2 || use lighttpd ; then
+			if use apache2; then
+				elog "To enable the Nagios web front-end, please edit"
+				elog "${ROOT}etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\""
+				elog "to APACHE2_OPTS. Then Nagios will be available at,"
+				elog
+			elif use lighttpd; then
+				elog "To enable the Nagios web front-end, please add"
+				elog "'include \"nagios.conf\"' to the lighttpd configuration"
+				elog "file at ${ROOT}etc/lighttpd/lighttpd.conf. Then Nagios"
+				elog "will be available at,"
+				elog
+			fi
+
+			elog "  http://localhost/nagios/"
+		fi
+	fi
+
+	elog
+	elog "If your kernel has /proc protection, nagios"
+	elog "will not be happy as it relies on accessing the proc"
+	elog "filesystem. You can fix this by adding nagios into"
+	elog "the group wheel, but this is not recomended."
+	elog
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2019-08-19 23:32 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2019-08-19 23:32 UTC (permalink / raw
  To: gentoo-commits

commit:     c4f4d3abf675460b53e5ebb9a0550a4c9a539771
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 19 23:30:32 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Mon Aug 19 23:30:56 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4f4d3ab

net-analyzer/nagios-core: new revision fixing zombie process bug.

Bug: https://bugs.gentoo.org/692092
Reported-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../nagios-core-4.4.4-no-zombie-processes.patch    | 158 +++++++++++++++++++++
 ...re-4.4.4.ebuild => nagios-core-4.4.4-r1.ebuild} |   2 +
 2 files changed, 160 insertions(+)

diff --git a/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch b/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch
new file mode 100644
index 00000000000..4592b1d27f4
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch
@@ -0,0 +1,158 @@
+This was an upstream bug that has been reverted for nagios-core-4.4.5:
+
+  https://github.com/NagiosEnterprises/nagioscore/issues/683
+
+Thanks to Tomáš Mózes (hydrapolic) for noticing and reporting the fix.
+
+diff --git a/base/events.c b/base/events.c
+index d601e970f..bb27b3240 100644
+--- a/base/events.c
++++ b/base/events.c
+@@ -351,13 +351,12 @@ void init_timing_loop(void) {
+ 			 */
+ 			check_delay =
+ 					mult_factor * scheduling_info.service_inter_check_delay;
+-			time_t check_window = reschedule_within_timeperiod(next_valid_time, temp_service->check_period_ptr, check_window(temp_service)) - current_time;
+-			if(check_delay > check_window) {
++			if(check_delay > check_window(temp_service)) {
+ 				log_debug_info(DEBUGL_EVENTS, 0,
+ 						"  Fixing check time %lu secs too far away\n",
+-						check_delay - check_window);
++						check_delay - check_window(temp_service));
+ 				fixed_services++;
+-				check_delay = check_window;
++				check_delay = check_window(temp_service);
+ 				log_debug_info(DEBUGL_EVENTS, 0, "  New check offset: %d\n",
+ 						check_delay);
+ 			}
+@@ -370,7 +369,8 @@ void init_timing_loop(void) {
+ 			if(is_valid_time == ERROR) {
+ 				log_debug_info(DEBUGL_EVENTS, 2, "Preferred Time is Invalid In Timeperiod '%s': %lu --> %s\n", temp_service->check_period_ptr->name, (unsigned long)temp_service->next_check, ctime(&temp_service->next_check));
+ 				get_next_valid_time(temp_service->next_check, &next_valid_time, temp_service->check_period_ptr);
+-				temp_service->next_check = reschedule_within_timeperiod(next_valid_time, temp_service->check_period_ptr, check_window(temp_service));
++				temp_service->next_check = 
++					(time_t)(next_valid_time + check_delay);
+ 				}
+ 
+ 			log_debug_info(DEBUGL_EVENTS, 2, "Actual Check Time: %lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next_check));
+@@ -508,7 +508,7 @@ void init_timing_loop(void) {
+ 			log_debug_info(DEBUGL_EVENTS, 1, "Fixing check time (off by %lu)\n",
+ 					check_delay - check_window(temp_host));
+ 			fixed_hosts++;
+-			check_delay = reschedule_within_timeperiod(next_valid_time, temp_host->check_period_ptr, check_window(temp_host));
++			check_delay = ranged_urand(0, check_window(temp_host));
+ 			}
+ 		temp_host->next_check = (time_t)(current_time + check_delay);
+ 
+diff --git a/cgi/status.c b/cgi/status.c
+index ae723c683..2f6a60fde 100644
+--- a/cgi/status.c
++++ b/cgi/status.c
+@@ -221,8 +221,26 @@ int main(void) {
+ 	document_header(TRUE);
+ 
+ 	/* if a navbar search was performed, find the host by name, address or partial name */
+-	if(navbar_search == TRUE) {
+-		if(host_name != NULL && NULL != strstr(host_name, "*")) {
++	if(navbar_search == TRUE && host_name != NULL) {
++
++		/* Remove trailing spaces from host_name */
++		len = strlen(host_name);
++		for (i = len - 1; i >= 0; i--) {
++			if (!isspace(host_name[i])) {
++				host_name[i+1] = '\0';
++				break;
++			}
++		}
++
++		/* Remove leading spaces from host_name */
++		for (i = 0; i < len; i++) {
++			if (!isspace(host_name[i])) {
++				break;
++			}
++		}
++		strcpy(host_name, host_name + i);
++
++		if(NULL != strstr(host_name, "*")) {
+ 			/* allocate for 3 extra chars, ^, $ and \0 */
+ 			host_filter = malloc(sizeof(char) * (strlen(host_name) * 2 + 3));
+ 			len = strlen(host_name);
+@@ -238,7 +256,7 @@ int main(void) {
+ 			host_filter[regex_i++] = '$';
+ 			host_filter[regex_i] = '\0';
+ 			}
+-		else if (host_name != NULL) {
++		else {
+ 			if((temp_host = find_host(host_name)) == NULL) {
+ 				for(temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) {
+ 					if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
+diff --git a/lib/worker.c b/lib/worker.c
+index 4f7cbc384..a94719cc4 100644
+--- a/lib/worker.c
++++ b/lib/worker.c
+@@ -215,7 +215,7 @@ int worker_buf2kvvec_prealloc(struct kvvec *kvv, char *buf, unsigned long len, i
+ 	} while (0)
+ 
+ /* forward declaration */
+-static int gather_output(child_process *cp, iobuf *io, int final);
++static void gather_output(child_process *cp, iobuf *io, int final);
+ 
+ static void destroy_job(child_process *cp)
+ {
+@@ -258,23 +258,15 @@ static void destroy_job(child_process *cp)
+ int finish_job(child_process *cp, int reason)
+ {
+ 	static struct kvvec resp = KVVEC_INITIALIZER;
+-	int i, ret, rd;
++	int i, ret;
+ 
+ 	/* get rid of still open filedescriptors */
+ 	if (cp->outstd.fd != -1) {
+-
+-		rd = 1;
+-		while(rd > 0) {
+-			rd = gather_output(cp, &cp->outstd, 0);
+-		}
++		gather_output(cp, &cp->outstd, 1);
+ 		iobroker_close(iobs, cp->outstd.fd);
+ 	}
+ 	if (cp->outerr.fd != -1) {
+-
+-		rd = 1;
+-		while(rd > 0) {
+-			rd = gather_output(cp, &cp->outerr, 0);
+-		}
++		gather_output(cp, &cp->outerr, 1);
+ 		iobroker_close(iobs, cp->outerr.fd);
+ 	}
+ 
+@@ -450,13 +442,13 @@ static void kill_job(child_process *cp, int reason)
+ 	destroy_job(cp);
+ }
+ 
+-static int gather_output(child_process *cp, iobuf *io, int final)
++static void gather_output(child_process *cp, iobuf *io, int final)
+ {
+ 	int retry = 5;
+-	int rd;
+ 
+ 	for (;;) {
+ 		char buf[4096];
++		int rd;
+ 
+ 		rd = read(io->fd, buf, sizeof(buf));
+ 		if (rd < 0) {
+@@ -492,13 +484,13 @@ static int gather_output(child_process *cp, iobuf *io, int final)
+ 		if (rd <= 0 || final) {
+ 			iobroker_close(iobs, io->fd);
+ 			io->fd = -1;
++			if (!final)
++				check_completion(cp, WNOHANG);
+ 			break;
+ 		}
+ 
+ 		break;
+ 	}
+-
+-	return rd;
+ }

diff --git a/net-analyzer/nagios-core/nagios-core-4.4.4.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild
similarity index 99%
rename from net-analyzer/nagios-core/nagios-core-4.4.4.ebuild
rename to net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild
index 74ddb853c43..520b2503a8c 100644
--- a/net-analyzer/nagios-core/nagios-core-4.4.4.ebuild
+++ b/net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild
@@ -70,6 +70,8 @@ RDEPEND="${DEPEND}
 
 S="${WORKDIR}/${MY_P}"
 
+PATCHES=( "${FILESDIR}/${P}-no-zombie-processes.patch" )
+
 pkg_setup() {
 	enewgroup nagios
 	enewuser nagios -1 /bin/bash /var/nagios/home nagios


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2019-08-31 21:35 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2019-08-31 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     390a02aa9cab0a7bdf5a86b0abc48f842d5b5ed3
Author:     Tomas Mozes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Fri Aug 30 07:19:45 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sat Aug 31 21:34:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=390a02aa

net-analyzer/nagios-core: drop old

Package-Manager: Portage-2.3.71, Repoman-2.3.17
Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 net-analyzer/nagios-core/Manifest                  |   1 -
 .../nagios-core-4.4.4-no-zombie-processes.patch    | 158 ---------------
 .../nagios-core/nagios-core-4.4.4-r1.ebuild        | 215 ---------------------
 3 files changed, 374 deletions(-)

diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
index 87e9dd98c4f..c1cd0864f89 100644
--- a/net-analyzer/nagios-core/Manifest
+++ b/net-analyzer/nagios-core/Manifest
@@ -1,4 +1,3 @@
 DIST nagios-4.3.4.tar.gz 11101966 BLAKE2B 6cb8182f40a4f83875c94df040bb1c62ce078d4130e10fa8595ea0b14cf715fc2a237ffb34199da9c1528e4789f3ce8deae3d993b5b795ad712d48b1e5fdb820 SHA512 f4e92aa98151739442a225a245871d93b5560d89510bdacb1a615959b9687f7a92675f10fcba71078b104ca8f237b0155a9261d67ec66f80aec7f033b4b3e316
-DIST nagios-4.4.4.tar.gz 11303598 BLAKE2B e4015ca5c0383b0540f2eaf3d608343df850c6045a4539c1f1ab8c19dc95e9223816efe71034b37f6995cb623dc6b83c92e22a677fe687a34d2215b1a2758c90 SHA512 c8f2b83bad744d67be4ba8356d9eea0be3efbf42d9a215d64815cdf7d944eba798348ce0faea6cebe64f1c99e0edbf12540d83ca42f8b4b563cbcc60139afdb0
 DIST nagios-4.4.5.tar.gz 11304463 BLAKE2B e1152c2cd14aa790fbdb84c0d7b3eb4691b05793640bf2871bc4ab1e2d645bb52bb2d1660b7389fb26d599d015f71820988ed1cd58003ed978dd9df38c357675 SHA512 14372e2e4470229bd000a8ad94def6ae504ce3f8e2cf94a9da73736560d1e3b2633302fe232ee7099d88ba00aecde5a9e352901828d6d9a9cd1fdce203deca30
 DIST nagios-core-gentoo-icons-20141125.tar 40960 BLAKE2B 31c1953e1160c7c7b89606b72b1a80407e4c1b7a7938b40bd1c577cd0c309dd88ca6b775d692a9b846dbf67736537fa9c91e56aa15fdd447769608ca525bff09 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766

diff --git a/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch b/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch
deleted file mode 100644
index 4592b1d27f4..00000000000
--- a/net-analyzer/nagios-core/files/nagios-core-4.4.4-no-zombie-processes.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-This was an upstream bug that has been reverted for nagios-core-4.4.5:
-
-  https://github.com/NagiosEnterprises/nagioscore/issues/683
-
-Thanks to Tomáš Mózes (hydrapolic) for noticing and reporting the fix.
-
-diff --git a/base/events.c b/base/events.c
-index d601e970f..bb27b3240 100644
---- a/base/events.c
-+++ b/base/events.c
-@@ -351,13 +351,12 @@ void init_timing_loop(void) {
- 			 */
- 			check_delay =
- 					mult_factor * scheduling_info.service_inter_check_delay;
--			time_t check_window = reschedule_within_timeperiod(next_valid_time, temp_service->check_period_ptr, check_window(temp_service)) - current_time;
--			if(check_delay > check_window) {
-+			if(check_delay > check_window(temp_service)) {
- 				log_debug_info(DEBUGL_EVENTS, 0,
- 						"  Fixing check time %lu secs too far away\n",
--						check_delay - check_window);
-+						check_delay - check_window(temp_service));
- 				fixed_services++;
--				check_delay = check_window;
-+				check_delay = check_window(temp_service);
- 				log_debug_info(DEBUGL_EVENTS, 0, "  New check offset: %d\n",
- 						check_delay);
- 			}
-@@ -370,7 +369,8 @@ void init_timing_loop(void) {
- 			if(is_valid_time == ERROR) {
- 				log_debug_info(DEBUGL_EVENTS, 2, "Preferred Time is Invalid In Timeperiod '%s': %lu --> %s\n", temp_service->check_period_ptr->name, (unsigned long)temp_service->next_check, ctime(&temp_service->next_check));
- 				get_next_valid_time(temp_service->next_check, &next_valid_time, temp_service->check_period_ptr);
--				temp_service->next_check = reschedule_within_timeperiod(next_valid_time, temp_service->check_period_ptr, check_window(temp_service));
-+				temp_service->next_check = 
-+					(time_t)(next_valid_time + check_delay);
- 				}
- 
- 			log_debug_info(DEBUGL_EVENTS, 2, "Actual Check Time: %lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next_check));
-@@ -508,7 +508,7 @@ void init_timing_loop(void) {
- 			log_debug_info(DEBUGL_EVENTS, 1, "Fixing check time (off by %lu)\n",
- 					check_delay - check_window(temp_host));
- 			fixed_hosts++;
--			check_delay = reschedule_within_timeperiod(next_valid_time, temp_host->check_period_ptr, check_window(temp_host));
-+			check_delay = ranged_urand(0, check_window(temp_host));
- 			}
- 		temp_host->next_check = (time_t)(current_time + check_delay);
- 
-diff --git a/cgi/status.c b/cgi/status.c
-index ae723c683..2f6a60fde 100644
---- a/cgi/status.c
-+++ b/cgi/status.c
-@@ -221,8 +221,26 @@ int main(void) {
- 	document_header(TRUE);
- 
- 	/* if a navbar search was performed, find the host by name, address or partial name */
--	if(navbar_search == TRUE) {
--		if(host_name != NULL && NULL != strstr(host_name, "*")) {
-+	if(navbar_search == TRUE && host_name != NULL) {
-+
-+		/* Remove trailing spaces from host_name */
-+		len = strlen(host_name);
-+		for (i = len - 1; i >= 0; i--) {
-+			if (!isspace(host_name[i])) {
-+				host_name[i+1] = '\0';
-+				break;
-+			}
-+		}
-+
-+		/* Remove leading spaces from host_name */
-+		for (i = 0; i < len; i++) {
-+			if (!isspace(host_name[i])) {
-+				break;
-+			}
-+		}
-+		strcpy(host_name, host_name + i);
-+
-+		if(NULL != strstr(host_name, "*")) {
- 			/* allocate for 3 extra chars, ^, $ and \0 */
- 			host_filter = malloc(sizeof(char) * (strlen(host_name) * 2 + 3));
- 			len = strlen(host_name);
-@@ -238,7 +256,7 @@ int main(void) {
- 			host_filter[regex_i++] = '$';
- 			host_filter[regex_i] = '\0';
- 			}
--		else if (host_name != NULL) {
-+		else {
- 			if((temp_host = find_host(host_name)) == NULL) {
- 				for(temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) {
- 					if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
-diff --git a/lib/worker.c b/lib/worker.c
-index 4f7cbc384..a94719cc4 100644
---- a/lib/worker.c
-+++ b/lib/worker.c
-@@ -215,7 +215,7 @@ int worker_buf2kvvec_prealloc(struct kvvec *kvv, char *buf, unsigned long len, i
- 	} while (0)
- 
- /* forward declaration */
--static int gather_output(child_process *cp, iobuf *io, int final);
-+static void gather_output(child_process *cp, iobuf *io, int final);
- 
- static void destroy_job(child_process *cp)
- {
-@@ -258,23 +258,15 @@ static void destroy_job(child_process *cp)
- int finish_job(child_process *cp, int reason)
- {
- 	static struct kvvec resp = KVVEC_INITIALIZER;
--	int i, ret, rd;
-+	int i, ret;
- 
- 	/* get rid of still open filedescriptors */
- 	if (cp->outstd.fd != -1) {
--
--		rd = 1;
--		while(rd > 0) {
--			rd = gather_output(cp, &cp->outstd, 0);
--		}
-+		gather_output(cp, &cp->outstd, 1);
- 		iobroker_close(iobs, cp->outstd.fd);
- 	}
- 	if (cp->outerr.fd != -1) {
--
--		rd = 1;
--		while(rd > 0) {
--			rd = gather_output(cp, &cp->outerr, 0);
--		}
-+		gather_output(cp, &cp->outerr, 1);
- 		iobroker_close(iobs, cp->outerr.fd);
- 	}
- 
-@@ -450,13 +442,13 @@ static void kill_job(child_process *cp, int reason)
- 	destroy_job(cp);
- }
- 
--static int gather_output(child_process *cp, iobuf *io, int final)
-+static void gather_output(child_process *cp, iobuf *io, int final)
- {
- 	int retry = 5;
--	int rd;
- 
- 	for (;;) {
- 		char buf[4096];
-+		int rd;
- 
- 		rd = read(io->fd, buf, sizeof(buf));
- 		if (rd < 0) {
-@@ -492,13 +484,13 @@ static int gather_output(child_process *cp, iobuf *io, int final)
- 		if (rd <= 0 || final) {
- 			iobroker_close(iobs, io->fd);
- 			io->fd = -1;
-+			if (!final)
-+				check_completion(cp, WNOHANG);
- 			break;
- 		}
- 
- 		break;
- 	}
--
--	return rd;
- }

diff --git a/net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild
deleted file mode 100644
index 520b2503a8c..00000000000
--- a/net-analyzer/nagios-core/nagios-core-4.4.4-r1.ebuild
+++ /dev/null
@@ -1,215 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit toolchain-funcs user
-
-MY_P=${PN/-core}-${PV}
-DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
-HOMEPAGE="https://www.nagios.org/"
-
-# The name of the directory into which our Gentoo icons will be
-# extracted, and also the basename of the archive containing it.
-GENTOO_ICONS="${PN}-gentoo-icons-20141125"
-SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
-	web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
-IUSE="apache2 classicui lighttpd perl +web vim-syntax"
-
-# In pkg_postinst(), we change the group of the Nagios configuration
-# directory to that of the web server user. It can't belong to both
-# apache/lighttpd groups at the same time, so we block this combination
-# for our own sanity.
-#
-# This could be made to work, but we would need a better way to allow
-# the web user read-only access to Nagios's configuration directory.
-#
-REQUIRED_USE="apache2? ( !lighttpd )"
-
-#
-# Note, we require one of the apache2 CGI modules:
-#
-#   * mod_cgi
-#   * mod_cgid
-#   * mod_fcgid
-#
-# We just don't care /which/ one. And of course PHP supports both CGI
-# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
-# dependencies, and expect the user not to do anything /too/
-# stupid. (For example, installing Apache with only FastCGI support, and
-# PHP with only CGI support.)
-#
-# Another annoyance is that the upstream Makefile uses app-arch/unzip to
-# extract a snapshot of AngularJS, but that's only needed when USE=web.
-#
-MOD_ALIAS=apache2_modules_alias
-DEPEND="dev-libs/libltdl:0
-	virtual/mailx
-	perl? ( dev-lang/perl:= )
-	web? (
-		app-arch/unzip
-		media-libs/gd[jpeg,png]
-		lighttpd? ( www-servers/lighttpd[php] )
-		apache2? (
-			|| (
-				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgi]
-				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgid]
-				>=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_fcgid] )
-			|| (
-				dev-lang/php:*[apache2]
-				dev-lang/php:*[cgi]
-				dev-lang/php:*[fpm] )
-		)
-	)"
-RDEPEND="${DEPEND}
-	vim-syntax? ( app-vim/nagios-syntax )"
-
-S="${WORKDIR}/${MY_P}"
-
-PATCHES=( "${FILESDIR}/${P}-no-zombie-processes.patch" )
-
-pkg_setup() {
-	enewgroup nagios
-	enewuser nagios -1 /bin/bash /var/nagios/home nagios
-}
-
-src_configure() {
-	local myconf
-
-	if use perl; then
-		myconf="${myconf} --enable-embedded-perl --with-perlcache"
-	fi
-
-	if use !apache2 && use !lighttpd ; then
-		myconf="${myconf} --with-command-group=nagios"
-	else
-		if use apache2 ; then
-			myconf="${myconf} --with-command-group=apache"
-			myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
-		elif use lighttpd ; then
-			myconf="${myconf} --with-command-group=lighttpd"
-		fi
-	fi
-
-	econf ${myconf} \
-		--prefix=/usr \
-		--bindir=/usr/sbin \
-		--localstatedir=/var/nagios \
-		--sysconfdir=/etc/nagios \
-		--libexecdir=/usr/$(get_libdir)/nagios/plugins \
-		--with-cgibindir=/usr/$(get_libdir)/nagios/cgi-bin \
-		--with-webdir=/usr/share/nagios/htdocs
-}
-
-src_compile() {
-	emake CC=$(tc-getCC) nagios
-
-	if use web; then
-		# Only compile the CGIs/HTML when USE=web is set.
-		emake CC=$(tc-getCC) DESTDIR="${D}" cgis html
-	fi
-}
-
-src_install() {
-	dodoc Changelog CONTRIBUTING.md README.md THANKS UPGRADING
-
-	# There is no way to install the CGIs unstripped from the top-level
-	# makefile, so descend into base/ here. The empty INSTALL_OPTS
-	# ensures that root:root: owns the nagios executables.
-	cd "${S}/base" || die
-	emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
-	cd "${S}" || die
-
-	# Otherwise this gets installed as 770 and you get "access denied"
-	# for some reason or other when starting nagios. The permissions
-	# on nagiostats are just for consistency (these should both get
-	# fixed upstream).
-	fperms 775 /usr/sbin/nagios /usr/sbin/nagiostats
-
-	# INSTALL_OPTS are needed for most of install-basic, but we don't
-	# want them on the LIBEXECDIR, argh.
-	emake DESTDIR="${D}" install-basic
-	fowners root:root /usr/$(get_libdir)/nagios/plugins
-
-	# Don't make the configuration owned by the nagios user, because
-	# then he can edit nagios.cfg and trick nagios into running as root
-	# and doing his bidding.
-	emake INSTALL_OPTS="" DESTDIR="${D}" install-config
-
-	# No INSTALL_OPTS used in install-commandmode, thankfully.
-	emake DESTDIR="${D}" install-commandmode
-
-	if use web; then
-		# There is no way to install the CGIs unstripped from the
-		# top-level makefile, so descend into cgi/ here. The empty
-		# INSTALL_OPTS ensures that root:root: owns the CGI executables.
-		cd "${S}/cgi" || die
-		emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
-		cd "${S}" || die
-
-		# install-html installs the new exfoliation theme
-		emake INSTALL_OPTS="" DESTDIR="${D}" install-html
-
-		if use classicui; then
-			# This overwrites the already-installed exfoliation theme
-			emake INSTALL_OPTS="" DESTDIR="${D}" install-classicui
-		fi
-
-		# Install cute Gentoo icons (bug #388323), setting their
-		# owner, group, and mode to match those of the rest of Nagios's
-		# images.
-		insinto /usr/share/nagios/htdocs/images/logos
-		doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
-	fi
-
-	newinitd startup/openrc-init nagios
-
-	if use web ; then
-		if use apache2 ; then
-			# Install the Nagios configuration file for Apache.
-			insinto "/etc/apache2/modules.d"
-			doins "${FILESDIR}"/99_nagios4.conf
-		elif use lighttpd ; then
-			# Install the Nagios configuration file for Lighttpd.
-			insinto /etc/lighttpd
-			newins "${FILESDIR}/lighttpd_nagios4.conf" nagios.conf
-		else
-			ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
-			ewarn "out of the box. Since you are not using one of them, you"
-			ewarn "will have to configure your webserver yourself."
-		fi
-	fi
-}
-
-pkg_postinst() {
-
-	if use web; then
-		if use apache2 || use lighttpd ; then
-			if use apache2; then
-				elog "To enable the Nagios web front-end, please edit"
-				elog "${ROOT}etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\""
-				elog "to APACHE2_OPTS. Then Nagios will be available at,"
-				elog
-			elif use lighttpd; then
-				elog "To enable the Nagios web front-end, please add"
-				elog "'include \"nagios.conf\"' to the lighttpd configuration"
-				elog "file at ${ROOT}etc/lighttpd/lighttpd.conf. Then Nagios"
-				elog "will be available at,"
-				elog
-			fi
-
-			elog "  http://localhost/nagios/"
-		fi
-	fi
-
-	elog
-	elog "If your kernel has /proc protection, nagios"
-	elog "will not be happy as it relies on accessing the proc"
-	elog "filesystem. You can fix this by adding nagios into"
-	elog "the group wheel, but this is not recomended."
-	elog
-}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2019-11-14 12:56 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2019-11-14 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     9211c22e7c5016ba72d98d115c2a8071e4a89534
Author:     Tomas Mozes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Thu Nov 14 06:56:40 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Nov 14 12:52:27 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9211c22e

net-analyzer/nagios-core: fix cgi-bin path for apache

Bug: https://bugs.gentoo.org/699002
Package-Manager: Portage-2.3.79, Repoman-2.3.17
Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 net-analyzer/nagios-core/files/99_nagios4-r1.conf                   | 2 +-
 .../{nagios-core-4.4.5-r4.ebuild => nagios-core-4.4.5-r5.ebuild}    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net-analyzer/nagios-core/files/99_nagios4-r1.conf b/net-analyzer/nagios-core/files/99_nagios4-r1.conf
index 54531ed6275..8d080d5c17b 100644
--- a/net-analyzer/nagios-core/files/99_nagios4-r1.conf
+++ b/net-analyzer/nagios-core/files/99_nagios4-r1.conf
@@ -1,6 +1,6 @@
 <IfDefine NAGIOS>
 
-  ScriptAlias /nagios/cgi-bin/ @CGIBINDIR@
+  ScriptAlias /nagios/cgi-bin @CGIBINDIR@
   <Directory "@CGIBINDIR@">
     AllowOverride AuthConfig
     Options ExecCGI

diff --git a/net-analyzer/nagios-core/nagios-core-4.4.5-r4.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.5-r5.ebuild
similarity index 97%
rename from net-analyzer/nagios-core/nagios-core-4.4.5-r4.ebuild
rename to net-analyzer/nagios-core/nagios-core-4.4.5-r5.ebuild
index 4a5ffee95d4..a1922298fa0 100644
--- a/net-analyzer/nagios-core/nagios-core-4.4.5-r4.ebuild
+++ b/net-analyzer/nagios-core/nagios-core-4.4.5-r5.ebuild
@@ -105,8 +105,8 @@ src_configure() {
 	# The paths in the web server configuration files need to match
 	# those passed to econf above.
 	cp "${FILESDIR}/99_nagios4-r1.conf" \
-	   "${FILESDIR}/lighttpd_nagios4-r1.conf" \
-	   "${T}/" || die "failed to create copies of web server conf files"
+		"${FILESDIR}/lighttpd_nagios4-r1.conf" \
+		"${T}/" || die "failed to create copies of web server conf files"
 
 	sed -e "s|@CGIBINDIR@|${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin|g" \
 		-e "s|@WEBDIR@|${EPREFIX}/usr/share/nagios/htdocs|" \
@@ -189,7 +189,7 @@ src_install() {
 		if use apache2 ; then
 			# Install the Nagios configuration file for Apache.
 			insinto "/etc/apache2/modules.d"
-			doins "${T}/99_nagios4-r1.conf"
+			newins "${T}/99_nagios4-r1.conf" "99_nagios4.conf"
 		elif use lighttpd ; then
 			# Install the Nagios configuration file for Lighttpd.
 			insinto /etc/lighttpd


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2022-09-20 12:17 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2022-09-20 12:17 UTC (permalink / raw
  To: gentoo-commits

commit:     f8955fe8fef3c48bed495ea27ff238febbb8dccb
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 20 12:05:58 2022 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Sep 20 12:16:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8955fe8

net-analyzer/nagios-core: new revision fixing some SSL issues.

This patch has been accepted upstream already and looks like it might
have some security implications (in addition to fixing an ugly crash),
so better safe than sorry. Thanks to Sylvain CANOINE for pointing it
out.

Closes: https://bugs.gentoo.org/871939
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/nagios-core-4.4.7-upgrade-sslfix.patch   | 120 +++++++++
 .../nagios-core/nagios-core-4.4.7-r1.ebuild        | 268 +++++++++++++++++++++
 2 files changed, 388 insertions(+)

diff --git a/net-analyzer/nagios-core/files/nagios-core-4.4.7-upgrade-sslfix.patch b/net-analyzer/nagios-core/files/nagios-core-4.4.7-upgrade-sslfix.patch
new file mode 100644
index 000000000000..c89f096caaa5
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-core-4.4.7-upgrade-sslfix.patch
@@ -0,0 +1,120 @@
+From 5fd2e1541a873e87f689de601beb3bc35910740d Mon Sep 17 00:00:00 2001
+From: Doug Nazar <nazard@nazar.ca>
+Date: Wed, 22 Jun 2022 15:07:03 -0400
+Subject: [PATCH 1/2] Fix SSL handling during upgrade check
+
+Only update counters if we've received data, not on error (-1) since
+we can then overwrite the stack, causing fault.
+
+my_ssl_connect() can return before initializing ssl & ctx. Ensure NULL
+initialization so *_free() are no-ops.
+
+Cleanly shutdown the channel after receiving all data.
+
+Use the client version of the TLS method to match the other options.
+---
+ base/netutils.c | 22 ++++++++++++----------
+ base/utils.c    |  4 ++--
+ 2 files changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/base/netutils.c b/base/netutils.c
+index 08ee40dd7..689b56f9b 100644
+--- a/base/netutils.c
++++ b/base/netutils.c
+@@ -154,7 +154,7 @@ int my_ssl_connect(const char *host_name, int port, int *sd, SSL **ssl, SSL_CTX
+ 
+ #if OPENSSL_VERSION_NUMBER >= 0x10100000
+ 
+-	method = TLS_method();
++	method = TLS_client_method();
+ 
+ #else		/* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+ 
+@@ -268,11 +268,11 @@ int my_ssl_sendall(int s, SSL *ssl, const char *buf, int *len, int timeout) {
+ 				/* If we hit one of these two errors, we just want to select() the socket again */
+ 				break;
+ 			}
++		} else {
++			total_sent += n;
++			bytes_left -= n;
+ 		}
+ 
+-		total_sent += n;
+-		bytes_left -= n;
+-
+ 		/* make sure we haven't overrun the timeout */
+ 		time(&current_time);
+ 		if(current_time - start_time > timeout) {
+@@ -337,17 +337,19 @@ int my_ssl_recvall(int s, SSL *ssl, char *buf, int *len, int timeout) {
+ 		n = SSL_read(ssl, buf + total_received, bytes_left);
+ 		if(n <= 0) {
+ 			int error = SSL_get_error(ssl, n);
++			/* If we hit one of these two errors, we just want to select() the socket again */
+ 			if (error != SSL_ERROR_WANT_READ && error != SSL_ERROR_WANT_WRITE) {
+-				/* An actual error happened */
+-				/* If we hit one of these two errors, we just want to select() the socket again */
++				/* EOF or an actual error happened */
++				if (error == SSL_ERROR_ZERO_RETURN)
++					SSL_shutdown(ssl);
+ 				break;
+ 			}
++		} else {
++			/* apply bytes we received */
++			total_received += n;
++			bytes_left -= n;
+ 		}
+ 
+-		/* apply bytes we received */
+-		total_received += n;
+-		bytes_left -= n;
+-
+ 		/* make sure we haven't overrun the timeout */
+ 		time(&current_time);
+ 		if(current_time - start_time > timeout) {
+diff --git a/base/utils.c b/base/utils.c
+index 79c6efba6..e83f7176a 100644
+--- a/base/utils.c
++++ b/base/utils.c
+@@ -3379,8 +3379,8 @@ int query_update_api(void) {
+ 	}
+ 
+ #ifdef HAVE_SSL
+-	SSL *ssl;
+-	SSL_CTX *ctx;
++	SSL *ssl = NULL;
++	SSL_CTX *ctx = NULL;
+ 
+ 	int result = my_ssl_connect(api_server, 443, &sd, &ssl, &ctx, 2);
+ 	if(sd > 0 && result != ERROR) {
+
+From a2c1415f14db6bbce9ba3d1d5a0c8218dd8c4fb8 Mon Sep 17 00:00:00 2001
+From: Doug Nazar <nazard@nazar.ca>
+Date: Wed, 22 Jun 2022 15:14:34 -0400
+Subject: [PATCH 2/2] Silence warning about port_str not large enough for port.
+
+---
+ base/netutils.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/base/netutils.c b/base/netutils.c
+index 689b56f9b..1fb1ec6a9 100644
+--- a/base/netutils.c
++++ b/base/netutils.c
+@@ -46,7 +46,7 @@ int my_ssl_connect(const char *host_name, int port, int *sd, SSL **ssl, SSL_CTX
+ 	hints.ai_socktype = SOCK_STREAM;
+ 
+ 	/* make sure our static port_str is long enough */
+-	if(port > 65535)
++	if(port < 0 || port > 65535)
+ 		return ERROR;
+ 
+ 	snprintf(port_str, sizeof(port_str), "%d", port);
+@@ -385,7 +385,7 @@ int my_tcp_connect(const char *host_name, int port, int *sd, int timeout) {
+ 	hints.ai_socktype = SOCK_STREAM;
+ 
+ 	/* make sure our static port_str is long enough */
+-	if(port > 65535)
++	if(port < 0 || port > 65535)
+ 		return ERROR;
+ 
+ 	snprintf(port_str, sizeof(port_str), "%d", port);

diff --git a/net-analyzer/nagios-core/nagios-core-4.4.7-r1.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.7-r1.ebuild
new file mode 100644
index 000000000000..86ae61814588
--- /dev/null
+++ b/net-analyzer/nagios-core/nagios-core-4.4.7-r1.ebuild
@@ -0,0 +1,268 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit systemd toolchain-funcs
+
+MY_P="${PN/-core}-${PV}"
+DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
+HOMEPAGE="https://www.nagios.org/"
+
+# The name of the directory into which our Gentoo icons will be
+# extracted, and also the basename of the archive containing it.
+GENTOO_ICONS="${PN}-gentoo-icons-20141125"
+SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
+	web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="apache2 classicui lighttpd +web vim-syntax"
+
+# In pkg_postinst(), we change the group of the Nagios configuration
+# directory to that of the web server user. It can't belong to both
+# apache/lighttpd groups at the same time, so we block this combination
+# for our own sanity.
+#
+# This could be made to work, but we would need a better way to allow
+# the web user read-only access to Nagios's configuration directory.
+#
+REQUIRED_USE="apache2? ( !lighttpd )"
+
+#
+# Note, we require one of the apache2 CGI modules:
+#
+#   * mod_cgi (USE=apache2_modules_cgi)
+#   * mod_cgid (USE=apache2_modules_cgid)
+#   * mod_fcgid (www-apache/mod_fcgid)
+#
+# We just don't care /which/ one. And of course PHP supports both CGI
+# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
+# dependencies, and expect the user not to do anything /too/
+# stupid. (For example, installing Apache with only FastCGI support, and
+# PHP with only CGI support.)
+#
+# Another annoyance is that the upstream Makefile uses app-arch/unzip to
+# extract a snapshot of AngularJS, but that's only needed when USE=web.
+#
+MOD_ALIAS=apache2_modules_alias
+
+# The dependencies checked by the configure script. All of these are
+# also runtime dependencies; that's why ./configure checks for them.
+CONFIGURE_DEPEND="acct-group/nagios
+	acct-user/nagios
+	virtual/mailx
+	dev-lang/perl:="
+
+# In addition to the things that the ./configure script checks for,
+# we also need to be able to unzip stuff on the build host.
+#
+# We need the apache/lighttpd groups in src_install() for the things
+# installed as the --with-command-group argument, so they go here too.
+# The groups are also needed at runtime, but that is ensured by apache
+# and lighttpd themselves being in RDEPEND.
+BDEPEND="${CONFIGURE_DEPEND}
+	apache2? ( acct-group/apache )
+	lighttpd? ( acct-group/lighttpd )
+	web? ( app-arch/unzip )"
+
+# This is linked into /usr/bin/nagios{,tats}
+DEPEND="dev-libs/libltdl:0"
+
+RDEPEND="${CONFIGURE_DEPEND}
+	${DEPEND}
+	web? (
+		media-libs/gd[jpeg,png]
+		lighttpd? ( www-servers/lighttpd[php] )
+		apache2? (
+			|| (
+				www-servers/apache[${MOD_ALIAS},apache2_modules_cgi]
+				www-servers/apache[${MOD_ALIAS},apache2_modules_cgid]
+				( www-servers/apache[${MOD_ALIAS}] www-apache/mod_fcgid ) )
+			|| (
+				dev-lang/php:*[apache2]
+				dev-lang/php:*[cgi]
+				dev-lang/php:*[fpm] )
+		)
+	)
+	vim-syntax? ( app-vim/nagios-syntax )"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=( "${FILESDIR}/${P}-upgrade-sslfix.patch" )
+
+src_configure() {
+	local myconf
+
+	if use !apache2 && use !lighttpd ; then
+		myconf="${myconf} --with-command-group=nagios"
+	else
+		if use apache2 ; then
+			myconf="${myconf} --with-command-group=apache"
+			myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
+		elif use lighttpd ; then
+			myconf="${myconf} --with-command-group=lighttpd"
+		fi
+	fi
+
+	# We pass "unknown" as the init type because we don't want it to
+	# guess. Later on, we'll manually install both OpenRC and systemd
+	# services.
+	econf ${myconf} \
+		--prefix="${EPREFIX}/usr" \
+		--bindir="${EPREFIX}/usr/sbin" \
+		--localstatedir="${EPREFIX}/var/lib/nagios" \
+		--sysconfdir="${EPREFIX}/etc/nagios" \
+		--libexecdir="${EPREFIX}/usr/$(get_libdir)/nagios/plugins" \
+		--with-cgibindir="${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin" \
+		--with-webdir="${EPREFIX}/usr/share/nagios/htdocs" \
+		--with-init-type="unknown"
+
+	# The paths in the web server configuration files need to match
+	# those passed to econf above.
+	cp "${FILESDIR}/99_nagios4-r1.conf" \
+		"${FILESDIR}/lighttpd_nagios4-r1.conf" \
+		"${T}/" || die "failed to create copies of web server conf files"
+
+	sed -e "s|@CGIBINDIR@|${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin|g" \
+		-e "s|@WEBDIR@|${EPREFIX}/usr/share/nagios/htdocs|" \
+		-i "${T}/99_nagios4-r1.conf" \
+		-i "${T}/lighttpd_nagios4-r1.conf" \
+		|| die "failed to substitute paths into web server conf files"
+
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" nagios
+
+	if use web; then
+		# Only compile the CGIs/HTML when USE=web is set.
+		emake CC="$(tc-getCC)" cgis html
+	fi
+}
+
+src_install() {
+	dodoc Changelog CONTRIBUTING.md README.md THANKS UPGRADING
+
+	# There is no way to install the CGIs unstripped from the top-level
+	# makefile, so descend into base/ here. The empty INSTALL_OPTS
+	# ensures that root:root: owns the nagios executables.
+	cd "${S}/base" || die
+	emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
+	cd "${S}" || die
+
+	# Otherwise this gets installed as 770 and you get "access denied"
+	# for some reason or other when starting nagios. The permissions
+	# on nagiostats are just for consistency (these should both get
+	# fixed upstream).
+	fperms 775 /usr/sbin/nagios /usr/sbin/nagiostats
+
+	# INSTALL_OPTS are needed for most of install-basic, but we don't
+	# want them on the LIBEXECDIR, argh.
+	emake DESTDIR="${D}" install-basic
+	fowners root:root /usr/$(get_libdir)/nagios/plugins
+
+	# Don't make the configuration owned by the nagios user, because
+	# then he can edit nagios.cfg and trick nagios into running as root
+	# and doing his bidding.
+	emake INSTALL_OPTS="" DESTDIR="${D}" install-config
+
+	# No INSTALL_OPTS used in install-commandmode, thankfully.
+	emake DESTDIR="${D}" install-commandmode
+
+	# The build system installs these directories, but portage assumes
+	# that the build system doesn't know what it's doing so we have to
+	# keepdir them, too. I guess you'll have to manually re-check the
+	# upstream build system forever to see if this is still necessary.
+	keepdir /var/lib/nagios{,/archives,/rw,/spool,/spool/checkresults}
+
+	if use web; then
+		# There is no way to install the CGIs unstripped from the
+		# top-level makefile, so descend into cgi/ here. The empty
+		# INSTALL_OPTS ensures that root:root: owns the CGI executables.
+		cd "${S}/cgi" || die
+		emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
+		cd "${S}" || die
+
+		# install-html installs the new exfoliation theme
+		emake INSTALL_OPTS="" DESTDIR="${D}" install-html
+
+		if use classicui; then
+			# This overwrites the already-installed exfoliation theme
+			emake INSTALL_OPTS="" DESTDIR="${D}" install-classicui
+		fi
+
+		# Install cute Gentoo icons (bug #388323), setting their
+		# owner, group, and mode to match those of the rest of Nagios's
+		# images.
+		insinto /usr/share/nagios/htdocs/images/logos
+		doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
+	fi
+
+	# The ./configure script for nagios detects the init system on the
+	# build host, which is wrong for all sorts of reasons. We've gone
+	# to great lengths above to avoid running "install-init" -- even
+	# indirectly -- and so now we must install whatever service files
+	# we need by hand.
+	newinitd startup/openrc-init nagios
+	systemd_newunit startup/default-service nagios.service
+
+	if use web ; then
+		if use apache2 ; then
+			# Install the Nagios configuration file for Apache.
+			insinto "/etc/apache2/modules.d"
+			newins "${T}/99_nagios4-r1.conf" "99_nagios4.conf"
+		elif use lighttpd ; then
+			# Install the Nagios configuration file for Lighttpd.
+			insinto /etc/lighttpd
+			newins "${T}/lighttpd_nagios4-r1.conf" nagios.conf
+		else
+			ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
+			ewarn "out of the box. Since you are not using one of them, you"
+			ewarn "will have to configure your webserver yourself."
+		fi
+	fi
+}
+
+pkg_postinst() {
+
+	if use web; then
+		if use apache2 || use lighttpd ; then
+			if use apache2; then
+				elog "To enable the Nagios web front-end, please edit"
+				elog "${ROOT}/etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\""
+				elog "to APACHE2_OPTS. Then Nagios will be available at,"
+				elog
+			elif use lighttpd; then
+				elog "To enable the Nagios web front-end, please add"
+				elog "'include \"nagios.conf\"' to the lighttpd configuration"
+				elog "file at ${ROOT}/etc/lighttpd/lighttpd.conf. Then Nagios"
+				elog "will be available at,"
+				elog
+			fi
+
+			elog "  http://localhost/nagios/"
+		fi
+	fi
+
+	elog
+	elog "If your kernel has /proc protection, nagios"
+	elog "will not be happy as it relies on accessing the proc"
+	elog "filesystem. You can fix this by adding nagios into"
+	elog "the group wheel, but this is not recomended."
+	elog
+
+	if [ -n "${REPLACING_VERSIONS}" ]; then
+		ewarn "The local state directory for nagios has changed in v4.4.5,"
+		ewarn "from ${EROOT}/var/nagios to ${EROOT}/var/lib/nagios. If you"
+		ewarn "wish to migrate your state to the new location, first stop"
+		ewarn "nagios and then run"
+		ewarn ""
+		ewarn "  diff --recursive --brief ${EROOT}/var/nagios ${EROOT}/var/lib/nagios"
+		ewarn ""
+		ewarn "to identify any files that should be moved to the new"
+		ewarn "location. They can simply be moved with \"mv\" before"
+		ewarn "restarting nagios."
+	fi
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/
@ 2024-04-01 16:51 Michael Orlitzky
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Orlitzky @ 2024-04-01 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     9c5839b123bc6d8ddb7d5aea92c257449a63e54b
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  1 16:45:39 2024 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Mon Apr  1 16:45:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9c5839b1

net-analyzer/nagios-core: fix build (testfail) on musl

Upstream patch replaces uint by unsigned int.

Closes: https://bugs.gentoo.org/928032
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../nagios-core/files/nagios-core-4.5.1-musl.patch | 98 ++++++++++++++++++++++
 net-analyzer/nagios-core/nagios-core-4.5.1.ebuild  |  2 +
 2 files changed, 100 insertions(+)

diff --git a/net-analyzer/nagios-core/files/nagios-core-4.5.1-musl.patch b/net-analyzer/nagios-core/files/nagios-core-4.5.1-musl.patch
new file mode 100644
index 000000000000..eda71db9bcd4
--- /dev/null
+++ b/net-analyzer/nagios-core/files/nagios-core-4.5.1-musl.patch
@@ -0,0 +1,98 @@
+From 19602faf7111203b748a4dc9ccaf3111586a8e96 Mon Sep 17 00:00:00 2001
+From: Sebastian Wolf <swolf@nagios.com>
+Date: Fri, 29 Mar 2024 17:01:52 -0400
+Subject: [PATCH 1/2] Fix #952 - s/uint/unsigned int/g
+
+---
+ Changelog         |  4 ++++
+ lib/t-utils.c     | 10 +++++-----
+ lib/test-dkhash.c |  2 +-
+ 3 files changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/Changelog b/Changelog
+index ec3cd64fc..fcf4742f2 100644
+--- a/Changelog
++++ b/Changelog
+@@ -2,6 +2,10 @@
+ Nagios Core 4 Change Log
+ ########################
+ 
++4.5.2 - 2024-04-30
++------------------
++* Fix build when compiling against musl libc (#952) (Sebastian Wolf)
++
+ 4.5.1 - 2024-02-28
+ -------------------
+ * Fix text rendering in Configuration -> Command Expansion when the command ends in whitespace (Thanks Joran LEREEC for reporting this issue) (Dylan Anderson)
+diff --git a/lib/t-utils.c b/lib/t-utils.c
+index badab7c03..123f114c8 100644
+--- a/lib/t-utils.c
++++ b/lib/t-utils.c
+@@ -1,8 +1,8 @@
+ #include "t-utils.h"
+ 
+ const char *cyan = "", *red = "", *green = "", *yellow = "", *reset = "";
+-uint passed, failed, t_verbose = 0;
+-static uint t_depth;
++unsigned int passed, failed, t_verbose = 0;
++static unsigned int t_depth;
+ static const char *indent_str = "  ";
+ 
+ /* can't be used when a or b has side-effects, but we don't care here */
+@@ -27,9 +27,9 @@ void t_set_colors(int force)
+ 	}
+ }
+ 
+-static void t_indent(uint depth)
++static void t_indent(unsigned int depth)
+ {
+-	uint i;
++	unsigned int i;
+ 	for (i = 0; i < depth; i++) {
+ 		printf("%s", indent_str);
+ 	}
+@@ -136,7 +136,7 @@ int ok_int(int a, int b, const char *name)
+ 	return TEST_FAIL;
+ }
+ 
+-int ok_uint(uint a, uint b, const char *name)
++int ok_unsigned int(unsigned int a, unsigned int b, const char *name)
+ {
+ 	if (a == b) {
+ 		t_pass("%s", name);
+diff --git a/lib/test-dkhash.c b/lib/test-dkhash.c
+index 6db1d7a92..15c2b676c 100644
+--- a/lib/test-dkhash.c
++++ b/lib/test-dkhash.c
+@@ -68,7 +68,7 @@ static struct test_data *ddup(int x, int i, int j)
+ }
+ 
+ struct dkhash_check {
+-	uint entries, count, max, added, removed;
++	unsigned int entries, count, max, added, removed;
+ 	int ent_delta, addrm_delta;
+ };
+ 
+
+From c4f56318e6ecfab85d592ea302d747c80be5f557 Mon Sep 17 00:00:00 2001
+From: Sebastian Wolf <swolf@nagios.com>
+Date: Fri, 29 Mar 2024 17:04:29 -0400
+Subject: [PATCH 2/2] derp
+
+---
+ lib/t-utils.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/t-utils.c b/lib/t-utils.c
+index 123f114c8..24098655f 100644
+--- a/lib/t-utils.c
++++ b/lib/t-utils.c
+@@ -136,7 +136,7 @@ int ok_int(int a, int b, const char *name)
+ 	return TEST_FAIL;
+ }
+ 
+-int ok_unsigned int(unsigned int a, unsigned int b, const char *name)
++int ok_uint(unsigned int a, unsigned int b, const char *name)
+ {
+ 	if (a == b) {
+ 		t_pass("%s", name);

diff --git a/net-analyzer/nagios-core/nagios-core-4.5.1.ebuild b/net-analyzer/nagios-core/nagios-core-4.5.1.ebuild
index 8e54a1b53013..968007cec951 100644
--- a/net-analyzer/nagios-core/nagios-core-4.5.1.ebuild
+++ b/net-analyzer/nagios-core/nagios-core-4.5.1.ebuild
@@ -90,6 +90,8 @@ RDEPEND="${CONFIGURE_DEPEND}
 
 S="${WORKDIR}/${MY_P}"
 
+PATCHES=( "${FILESDIR}/${P}-musl.patch" )
+
 src_configure() {
 	local myconf
 


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-01 16:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-19 23:32 [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/files/, net-analyzer/nagios-core/ Michael Orlitzky
  -- strict thread matches above, loose matches on Subject: below --
2024-04-01 16:51 Michael Orlitzky
2022-09-20 12:17 Michael Orlitzky
2019-11-14 12:56 Michael Orlitzky
2019-08-31 21:35 Michael Orlitzky
2018-08-08 21:08 Michael Orlitzky
2017-01-14 23:30 Michael Orlitzky
2016-04-26  0:30 Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox