Skip to Content.
Sympa Menu

en - [sympa-users] search_condition always matches

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Giorgio Donnini <address@concealed>
  • To: address@concealed
  • Subject: [sympa-users] search_condition always matches
  • Date: Wed, 10 Oct 2012 17:53:31 +0200

Hello,
 we have been using sympa (version 5.4) for some years now, and we are moving it to a new server.

I have installed 6.1.14 version, and testing a send scenario I found what I think it's a bug.

It's a very simple scenario which on the old version is working very well


send authsql

send.authsql is in turn

search(authsql.sql)        md5,smime     -> do_it
search(authsql.sql)        smtp          -> request_auth
true()                     smtp,smime,md5   -> reject


the authsql.sql is

sql_named_filter_query
db_type mysql
db_host HOST
db_name sympa_appoggio
db_user USER
db_passwd PASSWORD
statement SELECT count(*) from list_auth where list_subscriber=[listname] and sender_auth=[sender] and is_auth="Y"


After some investigation I found in Scenario.pm (lines 1028-1042) these lines

======
unless ($ds->query($statement)) {
            do_log('debug','%s named filter cancelled', $file);
            return undef;
        }

        my $res = $ds->fetch;

        $ds->disconnect();
        do_log('debug2','Result of SQL query : %d = %s', $res->[0], $statement);

        if ($res->[0] == 0){
            $persistent_cache{'named_filter'}{$filter_file}{$filter}{'value'} = 0;
        }else {
            $persistent_cache{'named_filter'}{$filter_file}{$filter}{'value'} = 1;
       }
======

But $res->[0] is "ARRAY(0x190623f8)", and therefore is always true.  It's an array because it comes from a fetchall_arrayref (SQLSource.pm line 280)

So  $res->[0] should be changed in
$res->[0]->[0] (which gives 0 or 1)

But I don't know in how many other places this should be changed or if this changement could impact on some other piece of code.

Regards,
   Giorgio Donnini





  • [sympa-users] search_condition always matches, Giorgio Donnini, 10/10/2012

Archive powered by MHonArc 2.6.19+.

Top of Page