Gentoo Archives: gentoo-commits

From: "Jorge Manuel B. S. Vicetto" <jmbsvicetto@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/jmbsvicetto:master commit in: net-analyzer/cacti/, net-analyzer/cacti/files/
Date: Tue, 27 Aug 2013 02:08:14
Message-Id: 1377569236.b18b9936001fc7713f46f7197b1c577a3082ab52.jmbsvicetto@gentoo
1 commit: b18b9936001fc7713f46f7197b1c577a3082ab52
2 Author: Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 27 02:07:16 2013 +0000
4 Commit: Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 27 02:07:16 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/jmbsvicetto.git;a=commit;h=b18b9936
7
8 Do a revision bump to add a patch to address http://bugs.cacti.net/view.php?id=2383 .
9 Fixes bug 482424 (CVE-2013-5588, CVE-2013-5589).
10
11 ---
12 net-analyzer/cacti/cacti-0.8.8b-r1.ebuild | 87 +++++++++++++++++
13 net-analyzer/cacti/files/cacti-r7420.patch | 150 +++++++++++++++++++++++++++++
14 2 files changed, 237 insertions(+)
15
16 diff --git a/net-analyzer/cacti/cacti-0.8.8b-r1.ebuild b/net-analyzer/cacti/cacti-0.8.8b-r1.ebuild
17 new file mode 100644
18 index 0000000..053d473
19 --- /dev/null
20 +++ b/net-analyzer/cacti/cacti-0.8.8b-r1.ebuild
21 @@ -0,0 +1,87 @@
22 +# Copyright 1999-2013 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +# $Header: $
25 +
26 +EAPI="4"
27 +
28 +inherit depend.php eutils webapp
29 +
30 +# Support for _p* in version.
31 +MY_P=${P/_p*/}
32 +
33 +DESCRIPTION="Cacti is a complete frontend to rrdtool"
34 +HOMEPAGE="http://www.cacti.net/"
35 +SRC_URI="http://www.cacti.net/downloads/${MY_P}.tar.gz"
36 +
37 +# patches
38 +UPSTREAM_PATCHES=""
39 +if [[ -n ${UPSTREAM_PATCHES} ]]; then
40 + for i in ${UPSTREAM_PATCHES}; do
41 + SRC_URI="${SRC_URI} http://www.cacti.net/downloads/patches/${PV/_p*}/${i}.patch"
42 + done
43 +fi
44 +
45 +LICENSE="GPL-2"
46 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
47 +IUSE="snmp doc"
48 +
49 +need_httpd
50 +
51 +DEPEND=""
52 +RDEPEND="
53 + dev-lang/php[cli,mysql,session,sockets,xml]
54 + dev-php/adodb
55 + net-analyzer/rrdtool
56 + virtual/cron
57 + virtual/mysql
58 + snmp? ( >=net-analyzer/net-snmp-5.2.0 )
59 +"
60 +
61 +src_unpack() {
62 + unpack ${MY_P}.tar.gz
63 +
64 + if [[ -n ${UPSTREAM_PATCHES} ]]; then
65 + [ ! ${MY_P} == ${P} ] && mv ${MY_P} ${P}
66 + fi
67 +}
68 +
69 +src_prepare() {
70 + # Patch to address http://bugs.cacti.net/view.php?id=2383
71 + # Fixes bug 482424 (CVE-2013-5588, CVE-2013-5589)
72 + epatch "${FILESDIR}/${PN}-r7420.patch"
73 +
74 + if [[ -n ${UPSTREAM_PATCHES} ]]; then
75 + for i in ${UPSTREAM_PATCHES} ; do
76 + EPATCH_OPTS="-p1 -d ${S} -N" epatch "${DISTDIR}"/${i}.patch
77 + done ;
78 + fi
79 +
80 + sed -i -e \
81 + 's:$config\["library_path"\] . "/adodb/adodb.inc.php":"adodb/adodb.inc.php":' \
82 + "${S}"/include/global.php || die
83 +
84 + rm -rf lib/adodb || die # don't use bundled adodb
85 +}
86 +
87 +src_compile() { :; }
88 +
89 +src_install() {
90 + webapp_src_preinst
91 +
92 + rm LICENSE README || die
93 + dodoc docs/{CHANGELOG,CONTRIB,README,txt/manual.txt} || die
94 + use doc && dohtml -r docs/html/
95 + rm -rf docs
96 +
97 + edos2unix `find -type f -name '*.php'`
98 +
99 + dodir ${MY_HTDOCSDIR}
100 + cp -r . "${D}"${MY_HTDOCSDIR}
101 +
102 + webapp_serverowned ${MY_HTDOCSDIR}/rra
103 + webapp_serverowned ${MY_HTDOCSDIR}/log/cacti.log
104 + webapp_configfile ${MY_HTDOCSDIR}/include/config.php
105 + webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
106 +
107 + webapp_src_install
108 +}
109
110 diff --git a/net-analyzer/cacti/files/cacti-r7420.patch b/net-analyzer/cacti/files/cacti-r7420.patch
111 new file mode 100644
112 index 0000000..55a244e
113 --- /dev/null
114 +++ b/net-analyzer/cacti/files/cacti-r7420.patch
115 @@ -0,0 +1,150 @@
116 +Index: cacti-0.8.8b/host.php
117 +===================================================================
118 +--- cacti-0.8.8b/host.php (revision 7419)
119 ++++ cacti-0.8.8b/host.php (revision 7420)
120 +@@ -149,6 +149,9 @@
121 + if ($_POST["snmp_version"] == 3 && ($_POST["snmp_password"] != $_POST["snmp_password_confirm"])) {
122 + raise_message(4);
123 + }else{
124 ++ input_validate_input_number(get_request_var_post("id"));
125 ++ input_validate_input_number(get_request_var_post("host_template_id"));
126 ++
127 + $host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
128 + trim($_POST["hostname"]), $_POST["snmp_community"], $_POST["snmp_version"],
129 + $_POST["snmp_username"], $_POST["snmp_password"],
130 +Index: cacti-0.8.8b/lib/api_device.php
131 +===================================================================
132 +--- cacti-0.8.8b/lib/api_device.php (revision 7419)
133 ++++ cacti-0.8.8b/lib/api_device.php (revision 7420)
134 +@@ -107,7 +107,7 @@
135 + $_host_template_id = db_fetch_cell("select host_template_id from host where id=$id");
136 + }
137 +
138 +- $save["id"] = $id;
139 ++ $save["id"] = form_input_validate($id, "id", "^[0-9]+$", false, 3);
140 + $save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+$", false, 3);
141 + $save["description"] = form_input_validate($description, "description", "", false, 3);
142 + $save["hostname"] = form_input_validate(trim($hostname), "hostname", "", false, 3);
143 +Index: cacti-0.8.8b/install/index.php
144 +===================================================================
145 +--- cacti-0.8.8b/install/index.php (revision 7419)
146 ++++ cacti-0.8.8b/install/index.php (revision 7420)
147 +@@ -310,27 +310,28 @@
148 + }
149 +
150 + /* pre-processing that needs to be done for each step */
151 +-if (empty($_REQUEST["step"])) {
152 +- $_REQUEST["step"] = 1;
153 +-}else{
154 +- if ($_REQUEST["step"] == "1") {
155 +- $_REQUEST["step"] = "2";
156 +- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "1")) {
157 +- $_REQUEST["step"] = "3";
158 +- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "3")) {
159 +- $_REQUEST["step"] = "8";
160 +- }elseif (($_REQUEST["step"] == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
161 +- $_REQUEST["step"] = "9";
162 +- }elseif ($_REQUEST["step"] == "8") {
163 +- $_REQUEST["step"] = "3";
164 +- }elseif ($_REQUEST["step"] == "9") {
165 +- $_REQUEST["step"] = "3";
166 +- }elseif ($_REQUEST["step"] == "3") {
167 +- $_REQUEST["step"] = "4";
168 ++if (isset($_REQUEST["step"]) && $_REQUEST["step"] > 0) {
169 ++ $step = intval($_REQUEST["step"]);
170 ++ if ($step == "1") {
171 ++ $step = "2";
172 ++ } elseif (($step == "2") && ($_REQUEST["install_type"] == "1")) {
173 ++ $step = "3";
174 ++ } elseif (($step == "2") && ($_REQUEST["install_type"] == "3")) {
175 ++ $step = "8";
176 ++ } elseif (($step == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
177 ++ $step = "9";
178 ++ } elseif ($step == "8") {
179 ++ $step = "3";
180 ++ } elseif ($step == "9") {
181 ++ $step = "3";
182 ++ } elseif ($step == "3") {
183 ++ $step = "4";
184 + }
185 ++} else {
186 ++ $step = 1;
187 + }
188 +
189 +-if ($_REQUEST["step"] == "4") {
190 ++if ($step == "4") {
191 + include_once("../lib/data_query.php");
192 + include_once("../lib/utility.php");
193 +
194 +@@ -366,7 +367,7 @@
195 +
196 + header ("Location: ../index.php");
197 + exit;
198 +-}elseif (($_REQUEST["step"] == "8") && ($_REQUEST["install_type"] == "3")) {
199 ++}elseif (($step == "8") && ($_REQUEST["install_type"] == "3")) {
200 + /* if the version is not found, die */
201 + if (!is_int($old_version_index)) {
202 + print " <p style='font-family: Verdana, Arial; font-size: 16px; font-weight: bold; color: red;'>Error</p>
203 +@@ -505,7 +506,7 @@
204 + </tr>
205 + <tr>
206 + <td width="100%" style="font-size: 12px;">
207 +- <?php if ($_REQUEST["step"] == "1") { ?>
208 ++ <?php if ($step == "1") { ?>
209 +
210 + <p>Thanks for taking the time to download and install cacti, the complete graphing
211 + solution for your network. Before you can start making cool graphs, there are a few
212 +@@ -530,7 +531,7 @@
213 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
214 + GNU General Public License for more details.</p>
215 +
216 +- <?php }elseif ($_REQUEST["step"] == "2") { ?>
217 ++ <?php }elseif ($step == "2") { ?>
218 +
219 + <p>Please select the type of installation</p>
220 +
221 +@@ -551,7 +552,7 @@
222 + print "Server Operating System Type: " . $config["cacti_server_os"] . "<br>"; ?>
223 + </p>
224 +
225 +- <?php }elseif ($_REQUEST["step"] == "3") { ?>
226 ++ <?php }elseif ($step == "3") { ?>
227 +
228 + <p>Make sure all of these values are correct before continuing.</p>
229 + <?php
230 +@@ -609,7 +610,7 @@
231 + is an upgrade. You can change any of the settings on this screen at a later
232 + time by going to "Cacti Settings" from within Cacti.</p>
233 +
234 +- <?php }elseif ($_REQUEST["step"] == "8") { ?>
235 ++ <?php }elseif ($step == "8") { ?>
236 +
237 + <p>Upgrade results:</p>
238 +
239 +@@ -659,7 +660,7 @@
240 + print $upgrade_results;
241 + ?>
242 +
243 +- <?php }elseif ($_REQUEST["step"] == "9") { ?>
244 ++ <?php }elseif ($step == "9") { ?>
245 +
246 + <p style='font-size: 16px; font-weight: bold; color: red;'>Important Upgrade Notice</p>
247 +
248 +@@ -673,7 +674,7 @@
249 +
250 + <?php }?>
251 +
252 +- <p align="right"><input type="image" src="install_<?php if ($_REQUEST["step"] == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($_REQUEST["step"] == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
253 ++ <p align="right"><input type="image" src="install_<?php if ($step == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($step == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
254 + </td>
255 + </tr>
256 + </table>
257 +@@ -681,7 +682,7 @@
258 + </tr>
259 + </table>
260 +
261 +-<input type="hidden" name="step" value="<?php print $_REQUEST["step"];?>">
262 ++<input type="hidden" name="step" value="<?php print $step;?>">
263 +
264 + </form>
265 +