Skip to content

Commit

Permalink
Merge branch 'sql' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
steveschnepp committed Dec 31, 2013
2 parents cb38133 + 6bb9d89 commit c8228b8
Show file tree
Hide file tree
Showing 13 changed files with 545 additions and 134 deletions.
8 changes: 5 additions & 3 deletions common/lib/Munin/Common/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ sub _looks_like_a_bool {


sub _parse_bool {
my ($class, $str) = @_;
my ($class, $str, $default) = @_;

croak "Parse exception: '$str' is not a boolean."
unless $class->_looks_like_a_bool($str);
if (! $class->_looks_like_a_bool($str)) {
return $default if defined $default;
croak "Parse exception: '$str' is not a boolean."
}

return $str =~ m{\A no|false|off|0 \z}xi ? 0 : 1;
}
Expand Down
12 changes: 12 additions & 0 deletions contrib/dump_storable
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ use Storable;
use Data::Dumper;

$Data::Dumper::Indent = 1;
$Data::Dumper::Quotekeys = 0;
$Data::Dumper::Pair = ": ";
$Data::Dumper::Terse = 1;
$Data::Dumper::Deepcopy = 1;

$Data::Dumper::Sortkeys = sub {
my ($hash) = @_;
my @keys = sort keys %$hash;
@keys = grep { !/^#%#/ } @keys unless $ENV{KEEP_ALL};
return \@keys;
};


while (my $file = shift) {
my $ref = Storable::retrieve($file);
Expand Down
32 changes: 32 additions & 0 deletions dev_scripts/cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

FINDBIN=$(cd -- "$(dirname "$0")" && pwd)
. $FINDBIN/common.sh

cd $BASEDIR


usage() {
echo "Usage: $0 <NAME>"
exit 1
}


if [ -z "$1" ]; then
usage
fi


RUN=$(find $DESTDIR -name $1 -type f -executable)
shift

if [ -z "$RUN" ]; then
usage
fi

export PATH_INFO=$1
shift

export PERL5LIB=$DESTDIR$PERLSITELIB

$TIMING $RUN "$@"
8 changes: 8 additions & 0 deletions dev_scripts/disable_taint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/sh

FINDBIN=$(cd -- "$(dirname "$0")" && pwd)
. $FINDBIN/common.sh

cd $BASEDIR

perl -pi -e "s,bin/perl -T,bin/perl," $( find $DESTDIR -type f -executable )
4 changes: 4 additions & 0 deletions dev_scripts/dump_sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh

sqlite3 ./sandbox/var/opt/munin/datafile.sqlite '.dump' > ./sandbox/var/opt/munin/datafile.sql
echo "./sandbox/var/opt/munin/datafile.sql"
9 changes: 9 additions & 0 deletions dev_scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ tls_verify_depth 5
./dev_scripts/run munin-node-configure --shell --families=contrib,auto | sh -x
fi


for i in $(find $DESTDIR -name 'munin-cgi-*' -type f -executable)
do
echo "Untainting CGI $i"
echo "#! /usr/bin/perl" > $i.tmp
cat $i >> $i.tmp
chmod +x $i.tmp
mv $i.tmp $i
done
18 changes: 18 additions & 0 deletions dev_scripts/nested-munin.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Group1;h1.domain.test]
address 127.0.0.1
use_node_name ignore

[Group1;h2.domain.test]
address 127.0.0.1
use_node_name ignore

[Group2;Sub1;h3.domain.test]
address 127.0.0.1
use_node_name ignore
[Group2;Sub2;h4.domain.test]
address 127.0.0.1
use_node_name ignore

[Group2;Sub2;h5.domain.test]
address 127.0.0.1
use_node_name ignore
10 changes: 4 additions & 6 deletions master/_bin/munin-cgi-graph.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ my %content_types = (
"xml" => "text/xml",
);

my $logfile;
my $scale = "day";

my @params ;
Expand All @@ -70,14 +69,13 @@ push @params, "--config", $ENV{'MUNIN_CONFIG'}
if (defined $ENV{'MUNIN_CONFIG'});
push @params, "--no-fork"; # FastCgi forks for us
push @params, "--skip-locking", "--skip-stats", "--nolazy";
push @params, "--log-file", $logfile;

my $config = graph_startup(\@params);

logger_open($config->{'logdir'});
logger_open($1) if ($config->{'logdir'} =~ m/(.*)/);
if(defined($ENV{CGI_DEBUG})) {
logger_debug();
push @params, "--debug", $logfile;
push @params, "--debug";
}

# BEGIN FAST-CGI LOOP:
Expand All @@ -90,7 +88,7 @@ while (new CGI::Fast) {
# This fixes http://bugs.debian.org/668666 and closes a lots of other potential bugs.
if ( has_offending_chars($ENV{PATH_INFO}) || has_offending_chars($ENV{QUERY_STRING}) ) {
# If parameters are not valid, just pretend we didn't find anything.
print "Status: 404 Not Found\r\n",
print "Status: 400 Bad Request (has_offending_chars)\r\n",
"Content-Type: image/png\r\n",
"X-Munin-Pid: $$\r\n",
"X-Munin-Request: $nb_request/$nb_request_max\r\n",
Expand Down Expand Up @@ -152,7 +150,7 @@ while (new CGI::Fast) {

if (! &verify_parameters ($dom, $host, $serv, $scale)) {
# If parameters are not valid, just say we didn't find anything.
print "Status: 404 Not Found\r\n",
print "Status: 404 Not Found (verify_parameters)\r\n",
"Content-Type: $content_types{$fileext}\r\n",
"X-Munin-Pid: $$\r\n",
"X-Munin-Request: $nb_request/$nb_request_max\r\n",
Expand Down
Loading

0 comments on commit c8228b8

Please sign in to comment.