|
@@ -0,0 +1,77 @@
+--- configure.orig 2008-05-06 08:00:18.000000000 +0200
++++ configure 2008-05-06 08:01:49.000000000 +0200
+@@ -124,10 +124,20 @@
+ SA_FT="0";
+ ETCDIR="$SPOOLDIR"
+ LOGDIR="$SPOOLDIR"
++DATABASE="vpopmail"
++DBUSER="root"
++DBPASS=""
++DBHOST="localhost"
++DBTABLE="quarantine_log"
+
+ while [ -n "$1" ]
+ do
+ case $1 in
++ --mysql-db) if [ "$2" != "" ] ; then shift ; fi ; DATABASE="$1" ;;
++ --mysql-user) if [ "$2" != "" ] ; then shift ; fi ; DBUSER="$1" ;;
++ --mysql-pass) if [ "$2" != "" ] ; then shift ; fi ; DBPASS="$1" ;;
++ --mysql-host) if [ "$2" != "" ] ; then shift ; fi ; DBHOST="$1" ;;
++ --mysql-table) if [ "$2" != "" ] ; then shift ; fi ; DBTABLE="$1" ;;
+ --qs-user) if [ "$2" != "" ] ; then shift ; fi ; QS_USER="$1" ;;
+ --spooldir) if [ "$2" != "" ] ; then shift ; fi ; SPOOLDIR="$1" ;;
+ --etcdir) if [ "$2" != "" ] ; then shift ; fi ; ETCDIR="$1" ;;
+--- qmail-scanner-queue.template.orig 2008-03-26 01:17:52.000000000 +0100
++++ qmail-scanner-queue.template 2008-05-06 08:00:03.000000000 +0200
+@@ -161,6 +161,22 @@
+ #Name of file where quarantine reports go (for long-term storage)
+ my $quarantinelog="quarantine.log";
+
++#DB definition for quarantine logging to sql
++# database name
++my $mydatabase="DATABASE";
++
++# database host
++my $myhost="DBHOST";
++
++# database user
++my $myuser="DBUSER";
++
++# database password
++my $mypass="DBPASS";
++
++# database table name
++my $mystattable="DBTABLE";
++
+ #Generate nice random filename
+ my ($sysname, $hostname, $release, $version, $machine) = uname();
+ #my $hostname='FQDN'; #could get via call I suppose...
+@@ -1652,6 +1668,7 @@
+ #This is almost 100% certainly SPAM - no point in notifying anyone
+ }
+ &write_quarantine_report;
++ &write_quarantine_report_sql;
+ $elapsed_time = tv_interval ($start_time, [gettimeofday]);
+ &debug("e_v_r: email_quarantine_report took ".tv_interval ($start_email_time, [gettimeofday])." seconds to execute");
+ }
+@@ -1966,6 +1983,20 @@
+ &debug("w_v_r: writing quarantine log report of: $report");
+ }
+
++sub write_quarantine_report_sql {
++ my ($temp,$desc,$report,$subj);
++ $subj=$headers{'subject'};
++ $subj =~ s/\t/ /g;
++ $desc=$quarantine_description;
++ $desc =~ s/\n\t/ /g;
++ use DBI;
++ my $db = DBI->connect("DBI:mysql:database=$mydatabase;host=$myhost", "$myuser", "$mypass") || print "Connection failed<BR>\n";
++ my $SQL_QRY = "INSERT INTO $mystattable (`nowtime`,`returnpath`,`receips`,`subject`,`description`,`scaninfo`) VALUES ('$nowtime','$returnpath','$recips','$subj','$desc','$SCANINFO')";
++ my $runcheck = $db->prepare($SQL_QRY);
++ $runcheck->execute();
++ &debug("w_v_r: writing quarantine sql report of: $report");
++}
++
+ sub scanner_info {
+ open(SC,"<$versionfile")||&error_condition("cannot open $versionfile - did you initialise the system by running \"$prog -z\"? - $!");
+ $SCANINFO = <SC>;
|
@@ -0,0 +1,12 @@
+CREATE TABLE `quarantine_log` (
+ `id` int(11) NOT NULL auto_increment,
+ `nowtime` varchar(150) collate latin1_german1_ci NOT NULL default '',
+ `returnpath` varchar(80) collate latin1_german1_ci NOT NULL default '',
+ `receips` varchar(80) collate latin1_german1_ci NOT NULL default '',
+ `subject` varchar(255) collate latin1_german1_ci NOT NULL default '',
+ `description` varchar(50) collate latin1_german1_ci NOT NULL default '',
+ `scaninfo` varchar(100) collate latin1_german1_ci NOT NULL default '',
+ UNIQUE KEY `id` (`id`),
+ KEY `quarIdx` (`nowtime`,`returnpath`,`receips`,`description`,`scaninfo`)
+) ENGINE=INNODB;
+
|