Search
j0ke.net Open Build Service
>
Projects
>
server:mail
>
qmail-scanner
> qmail-scanner-2.04_sql.diff
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File qmail-scanner-2.04_sql.diff of Package qmail-scanner (Revision 40)
Currently displaying revision
40
,
show latest
--- 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>;