Index: sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/master.cf
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/master.cf	(revision 5797)
+++ sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/master.cf	(revision 8265)
@@ -75,2 +75,6 @@
   ${nexthop} ${user}
 
+# Script para controle de envio nas listas de discussÃ£o
+scl  unix    -       n       n       -       0       spawn
+        user=nobody argv=/usr/bin/perl /etc/postfix/scl.pl
+
Index: sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/main.cf
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/main.cf	(revision 8137)
+++ sandbox/2.5.1-evolucao/INSTALL/debian/squeeze/etc/postfix/main.cf	(revision 8265)
@@ -108,5 +108,5 @@
 cra_maillists_chase_referral = 0
 cra_maillists_search_base = $ldapbase
-cra_maillists_query_filter = (&(mail=%s)(phpgwAccountType=l)(accountRestrictive=mailListRestriction))
+cra_maillists_query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(phpgwAccountType=l)(accountRestrictive=mailListRestriction))
 cra_maillists_result_attribute = accountRestrictive
 cra_maillists_domain = hash:/etc/postfix/expresso-dominios
@@ -166,6 +166,4 @@
 #SCL - Sender Control List - Restricoes para envio nas listas
 smtpd_restriction_classes = mailListRestriction
-mailListRestriction = check_sender_access ldap:csa_maillists,
-			reject
+mailListRestriction = check_policy_service unix:private/scl
 
-
Index: sandbox/2.5.1-evolucao/INSTALL/arquivos/expresso-cron
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/arquivos/expresso-cron	(revision 8137)
+++ sandbox/2.5.1-evolucao/INSTALL/arquivos/expresso-cron	(revision 8265)
@@ -5,23 +5,26 @@
 
 # Utilizado para verificar se ha algum alarme, por e-mail, do modulo ExpressoCalendar
-#CENTOS*/1 * 	* * *	apache	 php	EXPRESSO_DIR/prototype/modules/calendar/alarms.php 1>& /dev/null
-#DEBIAN*/1 * 	* * *	www-data php5	EXPRESSO_DIR/prototype/modules/calendar/alarms.php 1>& /dev/null
+#CENTOS*/1 * 	* * *	apache      php	 EXPRESSO_DIR/prototype/modules/calendar/alarms.php 1>& /dev/null
+#DEBIAN*/1 * 	* * *	www-data    php5 EXPRESSO_DIR/prototype/modules/calendar/alarms.php 1>& /dev/null
 
 # Utilizado para limpar a tabela, temporaria, que contem os e-mails (rascunhos) antes de
 #  serem salvos no IMAP.
-#CENTOS00 02 	* * *	apache		php	EXPRESSO_DIR/prototype/modules/mail/cleanMailAttachments.php 
-#DEBIAN00 02 	* * *	www-data	php5	EXPRESSO_DIR/prototype/modules/mail/cleanMailAttachments.php 
+#CENTOS00 02 	* * *	apache		php	 EXPRESSO_DIR/prototype/modules/mail/cleanMailAttachments.php 
+#DEBIAN00 02 	* * *	www-data	php5 EXPRESSO_DIR/prototype/modules/mail/cleanMailAttachments.php 
 
 # Utilizado para limpar a tabela de registros de acesso, sessoes, do Expresso (phpgw_access_log)
-#CENTOS00 22 	* * *	apache		php	EXPRESSO_DIR/phpgwapi/cron/clean_phpgw_tables.php
-#DEBIAN00 22 	* * *	www-data	php5	EXPRESSO_DIR/phpgwapi/cron/clean_phpgw_tables.php
+#CENTOS00 22 	* * *	apache		php	 EXPRESSO_DIR/phpgwapi/cron/clean_phpgw_tables.php
+#DEBIAN00 22 	* * *	www-data	php5 EXPRESSO_DIR/phpgwapi/cron/clean_phpgw_tables.php
 
 # Utilizado para limpar os arquivos de sessao do PHP
-#*/31 *  * * *   root                    find /dev/shm -type f -name "sess_*" -cmin 240 -print0 | xargs -n 200 -r -0 rm
-*/31 *  * * *   root                    find /dev/shm -type f -name "sess_*" -cmin +240 -delete
+#*/31 *         * * *   root        find /dev/shm -type f -name "sess_*" -cmin 240 -print0 | xargs -n 200 -r -0 rm
+*/31 *          * * *   root        find /dev/shm -type f -name "sess_*" -cmin +240 -delete
 
 # Utilizado para limpar os arquivos, eml, criados ao exportar mensagens
-#13 */4 * * * root			find /tmp/ -iname "*.eml" -amin +60 -exec rm -f '{}' \;
-13 */4 	* * * root			find /tmp/ -iname "*.eml" -cmin +60 -delete
+#13 */4         * * *   root		find /tmp/ -iname "*.eml" -amin +60 -exec rm -f '{}' \;
+13 */4 	        * * *   root		find /tmp/ -iname "*.eml" -cmin +60 -delete
+
+# Para o DSPAM
+#*/15 *         * * *   root        pidof dspam 1&> /dev/null ; [ $? -ne 0 ] && service dspam restart
 
 #
Index: sandbox/2.5.1-evolucao/INSTALL/arquivos/scripts/smtp.sh
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/arquivos/scripts/smtp.sh	(revision 7503)
+++ sandbox/2.5.1-evolucao/INSTALL/arquivos/scripts/smtp.sh	(revision 8265)
@@ -11,4 +11,6 @@
 	sed -e "s/DOMAIN/$DOMAIN/g" $DIR_POSTFIX/transport > /etc/postfix/transport
 	cp $DIR_POSTFIX/master.cf /etc/postfix/
+	sed -e "s/LDAP_DN/$LDAP_DN/g" $ARQS/scl.pl > /etc/postfix/scl.pl
+    chmod a+x /etc/postfix/scl.pl
 
 	postmap /etc/postfix/expresso-dominios
@@ -20,5 +22,5 @@
 smtp_rhel ()
 {
-	yum -y install postfix
+	yum -y install postfix perl-LDAP
 
 	smtp $1 
@@ -36,5 +38,5 @@
 smtp_debian ()
 {
-	apt-get -y install postfix postfix-ldap
+	apt-get -y install postfix postfix-ldap libnet-ldap-perl
 
 	smtp $1
Index: sandbox/2.5.1-evolucao/INSTALL/arquivos/scl.pl
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/arquivos/scl.pl	(revision 8265)
+++ sandbox/2.5.1-evolucao/INSTALL/arquivos/scl.pl	(revision 8265)
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+# Versao 5, ldapS
+
+#use strict;
+use warnings;
+use Fcntl;
+#use Net::LDAP qw(:all);
+use Net::LDAP;
+use Sys::Syslog qw(:DEFAULT setlogsock);
+
+my $ldap_host = "127.0.0.1";
+my $base_dn = "LDAP_DN";
+
+#my $ldap_host = "ldaps://LDAP_SERVER:636";
+#my $base_dn = "BASE_DN";
+
+my $syslog_socktype = 'unix'; # inet, unix, stream, console
+my $syslog_facility="mail";
+my $syslog_options="pid";
+my $syslog_priority="info";
+
+setlogsock $syslog_socktype;
+openlog $0, $syslog_options, $syslog_facility;
+
+select((select(STDOUT), $| = 1)[0]);
+
+sub fatal_exit {
+    my($first) = shift(@_);
+    syslog "err", "fatal: $first", @_;
+    exit 1;
+}
+
+#
+# Receive a bunch of attributes, evaluate the policy, send the result.
+#
+while (<STDIN>) {
+
+	if (/([^=]+)=(.*)\n/) {
+		$attr{substr($1, 0, 512)} = substr($2, 0, 512);
+	}
+	elsif ($_ eq "\n")
+	{
+		#for (keys %attr) {
+		#	syslog $syslog_priority, "Attribute: %s=%s", $_, $attr{$_};
+		#}
+
+		fatal_exit "unrecognized request type: '%s'", $attr{request}
+			unless $attr{"request"} eq "smtpd_access_policy";
+
+
+		my $ldap = Net::LDAP->new($ldap_host, version => 3);
+        my $mesg = $ldap->bind ;    # an anonymous bind
+		#my $mesg = $ldap->bind ( 'cn=admin,dc=expresso,dc=com,dc=br', password=>'SENHA');
+	
+		my $filter = "(|(\&(mail=$attr{recipient})(mailSenderAddress=$attr{sender})(phpgwAccountType=l))(\&(mail=$attr{recipient})(participantCanSendMail=TRUE)(mailForwardingAddress=$attr{sender})(phpgwAccountType=l)))";
+		
+		my $search = $ldap->search(filter=>"$filter",
+					   base=>"$base_dn",
+					   attrs=> ['uid'] );
+
+		if ( $search->code ) 
+		{
+			syslog $syslog_priority, "Erro na conexao com ldap.";
+			print STDOUT "action=reject\n\n";
+			exit 0;
+		}
+
+		if ($search->count)
+		{
+			syslog $syslog_priority, "Lista Restrita: DUNNO: %s->%s", $attr{sender}, $attr{recipient}, $filter;
+			print STDOUT "action=DUNNO\n\n";
+		}
+		else
+		{
+			syslog $syslog_priority, "Lista Restrita: Denied: %s->%s", $attr{sender}, $attr{recipient}, $filter;
+			print STDOUT "action=reject\n\n";
+		}
+
+		%attr = ();
+		$ldap->disconnect();
+	}
+	else
+	{
+		chop;
+		syslog $syslog_priority, "warning: ignoring garbage: %.100s", $_;
+	}
+}
Index: sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/master.cf
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/master.cf	(revision 5797)
+++ sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/master.cf	(revision 8265)
@@ -78,2 +78,7 @@
 bsmtp     unix  -       n       n       -       -       pipe
   flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
+
+# Script para controle de envio nas listas de discussÃ£o
+scl  unix    -       n       n       -       0       spawn
+        user=nobody argv=/usr/bin/perl /etc/postfix/scl.pl
+
Index: sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/main.cf
===================================================================
--- sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/main.cf	(revision 8137)
+++ sandbox/2.5.1-evolucao/INSTALL/rhel/6/etc/postfix/main.cf	(revision 8265)
@@ -166,6 +166,5 @@
 #SCL - Sender Control List - Restricoes para envio nas listas
 smtpd_restriction_classes = mailListRestriction
-mailListRestriction = check_sender_access ldap:csa_maillists,
-			reject
+mailListRestriction = check_policy_service unix:private/scl
 
 # LOCAL PATHNAME INFORMATION
