Package: mimedefang / 3.5-1

graphdefang.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
--- a/contrib/graphdefang-0.91/graphdefang.pl
+++ b/contrib/graphdefang-0.91/graphdefang.pl
@@ -26,7 +26,7 @@
 use strict;
 use warnings;
 
-use vars qw($MYDIR $OUTPUT_DIR $SUMMARYDB $QUIET $NODB $DATAFILE @DATAFILES @GRAPHS %TZ);
+use vars qw($SHAREDIR $OUTPUT_DIR $SUMMARYDB $QUIET $NODB $DATAFILE @DATAFILES @GRAPHS %TZ);
 
 # Argument parsing
 use Getopt::Long;
@@ -53,19 +53,23 @@ pod2usage(-exitstatus => 0, -verbose =>
 
 # Get the directory from where graphdefang.pl is running
 use File::Basename ();
-($MYDIR) = (File::Basename::dirname($0) =~ /(.*)/);
+#($MYDIR) = (File::Basename::dirname($0) =~ /(.*)/);
+$SHAREDIR="/usr/share/graphdefang";
 
 # Get graph configurations
-require("$MYDIR/graphdefang-config");
+#require("$MYDIR/graphdefang-config");
+require("/etc/graphdefang/graphdefang-config");
 
 # Require the graphdefang library file
-require ("$MYDIR/graphdefanglib.pl");
+#require ("$MYDIR/graphdefanglib.pl");
+require ("/usr/share/graphdefang/graphdefanglib.pl");
 
 #
 # Path to summary database
 #
 
-$SUMMARYDB = "$MYDIR/SummaryDB.db";
+#$SUMMARYDB = "$MYDIR/SummaryDB.db";
++$SUMMARYDB = "/var/cache/graphdefang/SummaryDB.db";
 
 # Do we do a database trim?
 if ($trim) {
@@ -110,7 +114,7 @@ foreach my $settings (@GRAPHS) {
 
 __END__
 
-=head1 graphdefang.pl
+=head1 NAME
 
 Application for generating graphs from mimedefang log files.
 
--- a/contrib/graphdefang-0.91/graphdefanglib.pl
+++ b/contrib/graphdefang-0.91/graphdefanglib.pl
@@ -205,7 +205,7 @@ sub read_and_summarize_data($$) {
 	my @GraphTimes = ("hourly","daily","monthly");
 
 	# Load event processing perl code from the events subdirectory
-	my $dirname = "$MYDIR/event";
+	my $dirname = "$SHAREDIR/event";
 	opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
 	while (defined(my $file = readdir(DIR))) {
 		if (!($file =~ m/^\./) and !($file =~ m/^CVS/)) {
--- a/contrib/graphdefang-0.91/web/graphdefang.cgi
+++ b/contrib/graphdefang-0.91/web/graphdefang.cgi
@@ -31,15 +31,18 @@ use CGI::Carp qw(fatalsToBrowser);
 use Fcntl;
 use Data::Dumper;
 
-use vars qw($MYDIR $OUTPUT_DIR $SUMMARYDB $QUIET $NODB $NOFILE $DATAFILE @GRAPHS %TZ);
+use vars qw($SHAREDIR $OUTPUT_DIR $SUMMARYDB $QUIET $NODB $NOFILE $DATAFILE @GRAPHS %TZ);
 
 # CONFIGURE HERE
-my $GRAPHDEFANGDIR = '/home/jpk/graphdefang';
-$SUMMARYDB = "$GRAPHDEFANGDIR/SummaryDB.db";
+#my $GRAPHDEFANGDIR = '/home/jpk/graphdefang';
+#$SUMMARYDB = "$GRAPHDEFANGDIR/SummaryDB.db";
+$SUMMARYDB = "/var/cache/graphdefang/SummaryDB.db";
+$SHAREDIR = "/usr/share/graphdefang";
 # THE REST SHOULD BE OKAY
 
 # Require the graphdefang library file
-require ("$GRAPHDEFANGDIR/graphdefanglib.pl");
+#require ("$GRAPHDEFANGDIR/graphdefanglib.pl");
+require ("$SHAREDIR/graphdefanglib.pl");
 
 # Don't output messages for the web app
 $QUIET = 1;
@@ -114,7 +117,7 @@ if ($cmd eq 'get-image') {
 		     -expires=>'now');
 	print start_html(-title=>'GraphDefang CGI Interface');
 	print h2('Select graph attributes and click the Submit button');
-	print startform();
+	print start_form();
 	print "<table border=1 cellspacing=0 cellpadding=5>\n";
 	print "  <tr>\n";
 	print "    <th>Data Types</th>\n";
@@ -199,7 +202,7 @@ if ($cmd eq 'get-image') {
 	print "<p>\n";
 	print submit(-value=>'Submit');
 	print hidden(-name=>'submit', 'default'=>['1']);
-	print endform();
+	print end_form();
 	print "<img src=./graphdefang.cgi?cmd=get-image;" . query_string() . ">\n" if (param('submit') && !$error);
 	if ($error) {
 		print "$error";
--- a/contrib/graphdefang-0.91/web/index.php
+++ b/contrib/graphdefang-0.91/web/index.php
@@ -27,7 +27,7 @@
 
 <?php
 # CONFIGURE ME!!!
-$OUTPUT_DIR = '/home/jpk/public_html/spam';
+$OUTPUT_DIR = '/var/lib/graphdefang';
 ?>
 
 <html>
@@ -78,7 +78,7 @@ foreach($filename_array as $value) {
 </center>
 Graphs created with <a href="http://www.bl.org/~jpk/graphdefang">GraphDefang</a>.
 <br/><br/>
-Interactive CGI Version at: <a href="./graphdefang.cgi">GraphDefang CGI</a>.
+Interactive CGI Version at: <a href="/cgi-bin/graphdefang.cgi">GraphDefang CGI</a>.
 <p align="left">
   <a href="http://validator.w3.org/check/referer"><img
   src="http://www.w3.org/Icons/valid-xhtml10"
--- a/contrib/graphdefang-0.91/graphdefang-config-mimedefang-example
+++ b/contrib/graphdefang-0.91/graphdefang-config-mimedefang-example
@@ -33,7 +33,7 @@
 # $DATAFILES[0] = '/var/log/maillog.host1';
 # $DATAFILES[1] = '/var/log/maillog.host2';
 
-$DATAFILE = '/var/log/maillog';
+$DATAFILE = '/var/log/mail.log';
 
 #
 # Optional Timezone variable by host name.  The host name must match
@@ -54,7 +54,7 @@ $DATAFILE = '/var/log/maillog';
 # Output directory for png files that are created
 #
 
-$OUTPUT_DIR = '/home/jpk/public_html/spam';
+$OUTPUT_DIR = '/var/lib/graphdefang';
 
 # Set graph settings
 #