Skip to Content.
Sympa Menu

en - [sympa-users] custom condition errors

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Chris Pax <address@concealed>
  • To: address@concealed
  • Subject: [sympa-users] custom condition errors
  • Date: Wed, 22 Jul 2009 22:40:35 +0200

I am trying to get a custom condition to work with sympa. but i get a error im
not sure of how to fix. I believe that the error results from the syntax of
the
scenario file. please review the files I provided below, I included the text
from the error, the scenario file, and the code itself.
note, I tested the code using a separate pl file; it works and returns
expected
results.

my version: Sympa 5.4.6

the error
####
Scenario::verify() error rule syntaxe: unknown condition
CustomCondition::ingroup->verify([sender], "usertype=Student)")

Scenario::request_action() error in CustomCondition::ingroup->verify([sender],
"(usertype=Student)"),md5,do_it
##



/home/sympa/etc/scenari/send.customldap
##############################################
title.gettext NJIT Students only

CustomCondition::ingroup([sender], "(usertype=Student)") smtp,smime,md5 ->
do_it
true() smtp,smime -> reject
##############

/home/sympa/etc/ingroup.pm
############################################
#!/usr/bin/perl

package CustomCondition::ingroup;

use strict;
use warnings;
use Data::Dumper;
use Net::LDAP;


our @ISA = qw(Exporter);

our %EXPORT_TAGS = (
all => [ qw(
verify
&user_in_group
) ],
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

sub verify{
my ($class, $email, $query) = @_;
my $isvaliduser = $class->user_in_group($email, $query);
if(defined $isvaliduser and $isvaliduser == 1){
return 1;
}
return 0;
}

sub user_in_group{
my ($class, $user, $query) = @_;
my $ldap = Net::LDAP->new("ldapserver.domain.com");
my $mesg = $ldap->bind();
$mesg->is_error and die "bind failed: ",$mesg->error;
my $filter = "(&(|(mail=$user)(mailAlternateAddress=$user))($query))";
$mesg = $ldap->search(
base => "ou=people,o=njit,c=us",
filter => $filter,
attrs => ["mail"]
);
$mesg->code and die "search failed: ", $mesg->error;
my @entries = $mesg->entries;
if(@entries){
return 1;
}
return undef;
}

1;
##

thanks.


  • [sympa-users] custom condition errors, Chris Pax, 07/22/2009

Archive powered by MHonArc 2.6.19+.

Top of Page