Re: Is Maia Really functional

Eric McCorkle <[email protected]> Sun, 6 Dec 2020 18:43:56 -0500
Newsgroups gmane.mail.virus.maiamailguard
Message-ID <[email protected]>
Seems the maiad patch is shorter.  Here it is (it looks like it contains
a fix I created for something that was later fixed):


--- usr/local/sbin/maiad	2020-12-06 23:39:31.519323000 +0000
+++ /usr/local/sbin/maiad	2020-10-30 15:46:33.654197000 +0000
@@ -339,6 +339,7 @@
 use Carp ();
 use Errno qw(ENOENT EACCES);
 use IO::File;
+use DBD::Pg;

 use vars @EXPORT;

@@ -3870,7 +3871,13 @@
             $insert = "INSERT INTO maia_mail (id, received_date, size,
sender_email, envelope_to, subject, contents) VALUES (?,NOW(),?,?,?,?,?)";
             $sth = $dbh->prepare($insert)
                 or do_log(0, sprintf("Maia: [store_mail] Couldn't
prepare query: %s", $dbh->errstr));
-            $sth->execute($mail_id, $size, $sender, $recipients,
$subject, $contents)
+            $sth->bind_param(1, $mail_id);
+            $sth->bind_param(2, $size);
+            $sth->bind_param(3, $sender);
+            $sth->bind_param(4, $recipients);
+            $sth->bind_param(5, $subject);
+            $sth->bind_param(6, $contents, { pg_type =>
DBD::Pg::PG_BYTEA });
+            $sth->execute()
                 or do_log(0, sprintf("Maia: [store_mail] Couldn't
execute query: %s", $dbh->errstr));
         }

@@ -4294,13 +4301,7 @@
     if (!$mail_score) {
 	   $mail_score = 0.0;
     }
-
-    my($autolearn_status, $autolearn_status_force) = split(' ',
$autolearn_status);
     $autolearn_status = validate($autolearn_status, '^([a-z]{2,15})$',
'si');
-    if(!$autolearn_status) {
-        $autolearn_status = 'unavailable';
-    }
-
     my $test_list = validate($spam_status, 'tests=(.*)', 'si');
     $test_list =~ s/[\s\t\n]//g;
     my @tests = split ",", $test_list;
@@ -4409,6 +4410,10 @@

     }

+    if (undef == $autolearn_status) {
+        $autolearn_status = 'unavailable';
+    }
+
     # update the mail item's final score
     $update = "UPDATE maia_mail SET score = ?, autolearn_status = ?
WHERE id = ?";
     $sth = $dbh->prepare_cached($update)
@@ -8933,7 +8938,7 @@
   $VIRUSFILE = undef; $av_output = undef; @detecting_scanners = ();
   @virusname = (); @banned_filename = (); @bad_headers = ();
   $spam_level = undef; $spam_status = undef; $spam_report = undef;
-  $autolearn_status = undef;
+  $autolearn_status = 'unavailable';

   # comment out to retain SQL cache entries for the whole child lifetime:
   $sql_policy->clear_cache  if defined $sql_policy;


On 12/6/20 6:38 PM, Eric McCorkle wrote:
> Here is the patch for the webapp.
> 
> Basically, you have to call "encode(col, 'escape')" on all of the BYTEA
> columns, because they get output as hex strings.
> 
> The maiad patch is similar, but it's being a bit harder for me to pull.
>  I'll deliver that one shortly.
> 
> On 12/6/20 12:27 PM, jjs - mainphrame wrote:
>> Much obliged sir.
>>
>> Jake
>>
>> On Sun, Dec 6, 2020 at 9:23 AM Eric McCorkle <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     Sure.
>>
>>     Note that I am neither a perl nor a PHP programmer, so these are
>>     basically hacks I've put in.
>>
>>     I'll pull patches and reply with them.
>>
>>     On 12/6/20 11:56 AM, jjs - mainphrame wrote:
>>     > Eric,
>>     >
>>     > Would you be willing to share the changes you made for postgres?
>>     >
>>     > Jake
>>     >
>>     > On Sun, Dec 6, 2020 at 4:35 AM Eric McCorkle <[email protected]
>>     <mailto:[email protected]>
>>     > <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>     >
>>     >     I'm running it on a FreeBSD server with PostGRES; however, it
>>     requires
>>     >     manual edits to some of the database queries to function
>>     >
>>     >     On 12/6/20 7:33 AM, jason hirsh wrote:
>>     >     > Jake
>>     >     >
>>     >     > It is what ever build is out in the current port for Freebsd 
>>     >     >
>>     >     >
>>     >     > It appears to work with this error message
>>     >     >
>>     >     >
>>     >     > JAsoaan
>>     >     >
>>     >     >> On Dec 5, 2020, at 9:34 PM, jjs - mainphrame
>>     <[email protected] <mailto:[email protected]>
>>     >     <mailto:[email protected] <mailto:[email protected]>>
>>     >     >> <mailto:[email protected] <mailto:[email protected]>
>>     <mailto:[email protected] <mailto:[email protected]>>>> wrote:
>>     >     >>
>>     >     >> I'm not sure what build you're using, but that sounds like
>>     some php
>>     >     >> related issues that were fixed to make maia work with php
>>     7. I know
>>     >     >> those fixes are in the technion and the mainphrame git repos.
>>     >     >>
>>     >     >> There are some people on this list who manage the freebsd
>>     build,
>>     >     >> hopefully they'll weigh in, if they haven't already
>>     contacted you off
>>     >     >> list.
>>     >     >>
>>     >     >> Jake
>>     >     >>
>>     >     >>
>>     >     >>
>>     >     >> On Sat, Dec 5, 2020 at 11:51 AM jason hirsh <[email protected]
>>     <mailto:[email protected]>
>>     >     <mailto:[email protected] <mailto:[email protected]>>
>>     >     >> <mailto:[email protected] <mailto:[email protected]>
>>     <mailto:[email protected] <mailto:[email protected]>>>> wrote:
>>     >     >>
>>     >     >>
>>     >     >>     I am running, I think Maia 1.04 on FreeBes 12.1. With
>>     Postfix,
>>     >     >>     Dovecot and MYSQL
>>     >     >>
>>     >     >>
>>     >     >>     After my last port update is started getting the
>>     following errors
>>     >     >>     when I signed in 
>>     >     >>
>>     >     >>
>>     >     >>     *"Warning*: count(): Parameter must be an array or an
>>     object that
>>     >     >>     implements Countable in */usr/local/share/pear/MDB2.php* on
>>     >     line *826*
>>     >     >>
>>     >     >>     *Notice*: A non well formed numeric value encountered
>>     >     >>     in */usr/local/share/pear/MDB2/Driver/mysqli.php* on
>>     line *1154"*
>>     >     >>     *
>>     >     >>     *
>>     >     >>     *As I remember Maia dates back to 2014 and I am
>>     wondering if the
>>     >     >>     update to PHP and mysql may have killed it..  *
>>     >     >>     *
>>     >     >>     *
>>     >     >>     *Then again maybe I killed it..*
>>     >     >>     _______________________________________________
>>     >     >>     Maia-users mailing list
>>     >     >>     [email protected]
>>     <mailto:[email protected]> <mailto:[email protected]
>>     <mailto:[email protected]>>
>>     >     <mailto:[email protected]
>>     <mailto:[email protected]> <mailto:[email protected]
>>     <mailto:[email protected]>>>
>>     >     >>   
>>      http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
>>     >     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>>
>>     >     >>   
>>     >   
>>       <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
>>     >     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>>>
>>     >     >>
>>     >     >> _______________________________________________
>>     >     >> Maia-users mailing list
>>     >     >> [email protected]
>>     <mailto:[email protected]> <mailto:[email protected]
>>     <mailto:[email protected]>>
>>     >     <mailto:[email protected]
>>     <mailto:[email protected]> <mailto:[email protected]
>>     <mailto:[email protected]>>>
>>     >     >>
>>     http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
>>     >     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>>
>>     >     >
>>     >     >
>>     >     > _______________________________________________
>>     >     > Maia-users mailing list
>>     >     > [email protected] <mailto:[email protected]>
>>     <mailto:[email protected] <mailto:[email protected]>>
>>     >     >
>>     http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
>>     >     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>>
>>     >     >
>>     >     _______________________________________________
>>     >     Maia-users mailing list
>>     >     [email protected] <mailto:[email protected]>
>>     <mailto:[email protected] <mailto:[email protected]>>
>>     >     http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>
>>     >     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
>>     <http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users>>
>>     >
>>
>>
>> _______________________________________________
>> Maia-users mailing list
>> [email protected]
>> http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users
_______________________________________________
Maia-users mailing list
[email protected]
http://www.renaissoft.com/cgi-bin/mailman/listinfo/maia-users