Commit 92a9d000 authored by sikeda's avatar sikeda
Browse files

[dev] Enforcing "strict" and "warnings" pragma to all sources.

Fixed compilation errors and warnings exposed by this change.
Additionally, removed unused modules from each source.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@10691 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 4c67ad56
......@@ -24,12 +24,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--modulesdir--';
use strict;
use warnings;
use Getopt::Long;
use Conf;
use Sympa::Constants;
use List;
use Log;
use Getopt::Long;
my %month_idx = qw(jan 1
fev 2
......@@ -120,6 +121,8 @@ if ($opt{'input-directory'}) {
opendir DIR, $opt{'input-directory'} || die;
foreach my $file ( sort grep (!/^\.\.?$/,readdir(DIR))) {
my @msgs; #FIXME: Not used anymore.
open ARCFILE, $opt{'input-directory'}.'/'.$file;
my @msg = <ARCFILE>;
push @msgs, \@msg;
......@@ -259,7 +262,7 @@ sub store_messages {
last;
}
}
close MSG;
# Unknown date format/No date
if ($incorrect || ! $month || ! $year) {
$year = 'UN';
......
......@@ -5,6 +5,8 @@
## This script will detect incorrectly archived messages and move them back
## in the archiving spool (outgoing)
use strict;
unless ($#ARGV >= 0) {
die "Usage: $0 <path_to_outgoing_dir> <path_to_web_archives>";
}
......
......@@ -23,18 +23,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--modulesdir--';
use strict;
use warnings;
use lib '--modulesdir--';
unless (require Crypt::CipherSaber) {
die "Crypt::CipherSaber not installed ; cannot crypt passwords";
}
require tools;
use List;
use Conf;
use SDM;
use Log;
use tools;
die "Crypt::CipherSaber not installed ; cannot crypt passwords"
unless tools::ciphersaber_installed();
## Load sympa config
Conf::load(Sympa::Constants::CONFIG) or die 'config_error';
......
......@@ -23,13 +23,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use lib '--modulesdir--';
use strict;
use warnings;
use Conf;
use Sympa::Constants;
use List;
use SDM;
use Log;
## Load sympa config
Conf::load(Sympa::Constants::CONFIG) or die 'config_error';
......
......@@ -8,10 +8,13 @@
## This script will create all missing HTML files in the moderation spool
use lib '--modulesdir--';
use Conf; # to load Sympa conf which is needed by List.pm
use List;
use Log; # if you want to get logs of List.pm
use strict;
use warnings;
use Conf;
use Sympa::Constants;
use List;
use Log;
unless (Conf::load(Sympa::Constants::CONFIG)) {
die "Can't load Sympa configuration file";
......@@ -36,8 +39,7 @@ unless (opendir SPOOL, $Conf{'queuemod'}) {
die "Unable to read spool";
}
foreach $msg ( sort grep(!/^\./, readdir SPOOL )) {
foreach my $msg ( sort grep(!/^\./, readdir SPOOL )) {
next if ($msg =~ /^\./);
$msg =~ /^(.*)\_([^\_]+)$/;
......
......@@ -23,17 +23,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use lib '--modulesdir--';
use strict;
use warnings;
use Getopt::Long;
use Sympa::Constants;
my $sympa_conf_file = Sympa::Constants::CONFIG;
use Conf;
use Sympa::Constants;
use List;
my $sympa_conf_file = Sympa::Constants::CONFIG;
## Load sympa config
unless (&Conf::load($sympa_conf_file)) {
die 'config_error';
......
......@@ -23,36 +23,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--modulesdir--';
use strict;
use warnings;
use Getopt::Long;
use HTTP::Cookies;
#use SOAP::Lite +trace;
use SOAP::Lite;
use HTTP::Cookies;
use URI;
use Getopt::Long;
use lib '--modulesdir--';
# use Conf;
use Commands;
use Conf;
use Auth;
use SympaSession;
use Log;
use mail;
use MIME::QuotedPrint;
use List;
use Message;
use admin;
use Config_XML;
use Family;
use report;
use File::Copy;
use tools;
use Sympa::Constants;
use tools;
my ($reponse, @ret, $val, %fault);
my $usage = "$0 is a perl soap client for Sympa for TEST ONLY. Use it to illustrate how to
code access to features of Sympa soap server. Authentication can be done via
user/password or user cookie or as a trusted remote application
......@@ -161,7 +144,11 @@ sub play_soap_as_trusted{
$soap->proxy($soap_url);
my @parameters;
@parameters= split(/,/,$service_parameters) if (defined $service_parameters);
if (defined $service_parameters) {
@parameters = split /,/, $service_parameters;
} else {
@parameters = ();
}
my $p= join(',',@parameters);
printf "calling authenticateRemoteAppAndRun( $trusted_application, $trusted_application_password, $proxy_vars,$service,$p)\n";
......@@ -248,11 +235,11 @@ sub play_soap{
&print_result($reponse);
$session_id = $reponse->result;
}
## Don't use authenticateAndRun for lists command
## Split parameters
my @parameters=split /,/,$service_parameters;
## Split parameters
@parameters = split /,/, $service_parameters;
if ($service eq 'lists') {
printf "\n\nlists....\n";
......
......@@ -23,6 +23,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use warnings;
use Getopt::Long;
my %opt;
......@@ -41,6 +43,10 @@ printf "host : $opt{'host'}\nsuffix : $opt{'suffix'}\nfilter: $opt{'filter'}\n";
my %arg;
$arg{'scope'} = $opt{'scope'};
my $ldap;
my $mesg;
my $res;
my $dn;
if ($opt{'ssl'} eq 'on') {
eval "require Net::LDAPS";
......@@ -76,6 +82,7 @@ $res = $mesg->as_struct ;
# printf "\t%s => %s\n", $k, $res->{$k};
#}
my $cpt = 0;
foreach $dn (keys %$res) {
my $hash = $res->{$dn};
......
......@@ -23,14 +23,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use strict;
use lib '--modulesdir--';
use strict;
use warnings;
use Getopt::Long;
use Conf;
use Log;
my %options;
&GetOptions(\%main::options, 'debug|d', 'log_level=s', 'config|f=s');
......
......@@ -24,10 +24,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--modulesdir--';
use strict;
use warnings;
use Conf;
use Sympa::Language;
use tt2;
use Sympa::Constants;
use Sympa::Language;
use List;
use Log;
......
......@@ -23,30 +23,25 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
use lib '--modulesdir--';
use strict;
use warnings;
use Getopt::Long;
use SOAP::Lite;
# Use this line for more debug facility
#use SOAP::Lite +trace;
use SOAP::Transport::HTTP;
use lib '--modulesdir--';
## Defines SOAP::Transport::HTTP::FCGI::Sympa with a modified handle()
use SympaTransport;
use Getopt::Long;
use strict;
## Sympa API
use List;
use mail;
use Conf;
use List;
use Log;
use mail;
use sympasoap;
## WWSympa librairies
use cookielib;
my $birthday = time ;
## Load sympa config
......
......@@ -42,41 +42,35 @@ This fcgi script completely handles all aspects of the Sympa web interface
 
=cut
 
use strict;
##use warnings;
use lib '--modulesdir--';
 
use Getopt::Long;
use Archive::Zip;
use Archive::Zip qw();
use DateTime::Format::Mail;
use strict 'vars';
use MIME::Parser;
use Time::Local;
use Data::Dumper;
 
## Sympa API
use List;
use mail;
use admin;
use Auth;
use Conf;
use confdef;
use Commands;
use Sympa::Language;
use Sympa::Constants;
use cookielib;
use List;
use Log;
use Auth;
use admin;
use SharedDocument;
use Sympa::Language;
use LDAPSource;
use mail;
use Marc::Search;
use report;
use SharedDocument;
use SympaSession;
use Log;
use tools;
use Sympa::Constants;
use wwslib;
use cookielib;
use tt2;
use tracking;
#use open ':utf8'; ## Default is to consider files utf8
use Mail::Header;
use Mail::Address;
use wwslib;
 
my $crypt_openssl_x509_ok;
BEGIN {
......@@ -1443,7 +1437,8 @@ Log::do_log(info => "WWSympa started, process $$");
 
## Execute the action ##
if (defined $action) {
$action = &{$comm{$action}}();
no strict 'refs';
$action = $comm{$action}->();
}
unless (defined $action) {
......@@ -5524,7 +5519,7 @@ sub do_family_signoff {
}
 
## No passwd
&init_passwd($in{'email'}, {'lang' => $param->{'lang'} });
wwslib::init_passwd($robot, $in{'email'}, {'lang' => $param->{'lang'} });
 
$param->{'user'}{'email'} = $in{'email'};
}
......@@ -8096,7 +8091,6 @@ sub do_arc {
if ($arc =~ /^(\d)+$/) {
my %msg_info;
 
use MIME::Parser;
my $parser = new MIME::Parser;
$parser->output_to_core(1);
......@@ -8112,7 +8106,6 @@ sub do_arc {
next;
}
 
use Mail::Header;
my $hdr = $message->head;
unless (defined $hdr) {
......@@ -8525,8 +8518,6 @@ sub do_remove_arc {
## Access control
return undef unless (defined &check_authz('do_arcsearch', 'web_archive.access'));
 
use Marc::Search;
my $search = new Marc::Search;
$search->search_base (&Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_list_id());
$search->base_href (&Conf::get_robot_conf($robot, 'wwsympa_url') . '/arc/' . $param->{'list'});
......@@ -8662,8 +8653,6 @@ sub do_remove_arc {
## Access control
return undef unless (defined &check_authz('do_arcsearch_id', 'web_archive.access'));
 
use Marc::Search;
my $search = new Marc::Search;
$search->search_base (&Conf::get_robot_conf($robot, 'arc_path') . '/' . $list->get_list_id());
$search->base_href (&Conf::get_robot_conf($robot, 'wwsympa_url') . '/arc/' . $param->{'list'});
......@@ -14194,7 +14183,7 @@ sub d_unzip_shared_file {
 
my $az = $zip->read( "$zip_abs_dir/$fname" );
unless ($az == AZ_OK){
unless ($az == Archive::Zip::AZ_OK()){
&wwslog('err',"unzip_shared_file : Unable to read the zip file $zip_abs_dir/$fname : $az");
&web_db_log({'robot' => $robot,'list' => $list->{'name'},'action' => $param->{'action'},'parameters' => "$zip_abs_dir,$fname",'target_email' => "",'msg_id' => '','status' => 'error','error_type' => 'internal','user_email' => $param->{'user'}{'email'},'client' => $ip,'daemon' => $daemon_name});
return undef;
......@@ -14204,7 +14193,7 @@ sub d_unzip_shared_file {
foreach my $name (@memberNames) {
my $az = $zip->extractMember($name, $zip_abs_dir.'/zip/'.$name);
unless ($az == AZ_OK) {
unless ($az == Archive::Zip::AZ_OK()) {
&wwslog('err',"unzip_shared_file : Unable to extract member $name of the zip file $zip_abs_dir/$fname : $az");
&web_db_log({'robot' => $robot,'list' => $list->{'name'},'action' => $param->{'action'},'parameters' => "$zip_abs_dir,$fname",'target_email' => "",'msg_id' => '','status' => 'error','error_type' => 'internal','user_email' => $param->{'user'}{'email'},'client' => $ip,'daemon' => $daemon_name});
$status = 0;
......@@ -17306,7 +17295,7 @@ sub do_arc_download {
return undef;
}
##writing zip file
unless ($zip->writeToFileNamed($zip_abs_file) == AZ_OK){
unless ($zip->writeToFileNamed($zip_abs_file) == Archive::Zip::AZ_OK()){
&report::reject_report_web('intern','write_file_zip',{'zipfile'=>$zip_abs_file},$param->{'action'},'',$param->{'user'}{'email'},$robot);
&wwslog ('info', 'Error while writing Zip File %s\n',$zip_file_name);
&web_db_log({'robot' => $robot,'list' => $list->{'name'},'action' => $param->{'action'},'parameters' => "$in{'list'}",'target_email' => "",'msg_id' => '','status' => 'error','error_type' => 'internal','user_email' => $param->{'user'}{'email'},'client' => $ip,'daemon' => $daemon_name});
......
......@@ -25,6 +25,7 @@
package Archive;
use strict;
use warnings;
use Carp qw(croak);
use Cwd qw(getcwd);
use Encode qw(decode_utf8 encode_utf8);
......@@ -390,7 +391,7 @@ sub convert_single_message {
close OUT;
# mhonarc require du change workdir so this proc must retore it
my $pwd = getcwd;
my $pwd = getcwd();
## generate HTML
unless (chdir $destination_dir) {
......
......@@ -24,12 +24,14 @@
package Auth;
use Digest::MD5;
use strict;
use warnings;
use POSIX qw();
use Log;
use Conf;
use LDAPSource;
use List;
use Log;
use report;
use SDM;
......@@ -164,6 +166,7 @@ sub authentication {
&report::reject_report_web('user','incorrect_passwd',{}) unless ($ENV{'SYMPA_SOAP'});
&Log::do_log('err','authentication: incorrect password for user %s', $email);
my $param; #FIXME FIXME: not used.
$param->{'init_email'} = $email;
$param->{'escaped_init_email'} = &tools::escape_chars($email);
return undef;
......@@ -308,7 +311,7 @@ sub get_email_by_net_id {
$netid_cookie =~ s/(\w+)/$attributes->{$1}/ig;
$email = &List::get_netidtoemail_db($robot, $netid_cookie, $Conf{'auth_services'}{$robot}[$auth_id]{'service_id'});
my $email = &List::get_netidtoemail_db($robot, $netid_cookie, $Conf{'auth_services'}{$robot}[$auth_id]{'service_id'});
return $email;
}
......@@ -338,7 +341,8 @@ sub get_email_by_net_id {
my $count = $emails->count();
if ($emails->count() == 0) {
&Log::do_log('notice',"No entry in the Ldap Directory Tree of %s", $host);
Log::do_log('notice', "No entry in the Ldap Directory Tree of %s",
$ldap->{'ldap_host'});
$ds->disconnect();
return undef;
}
......
......@@ -25,7 +25,7 @@
package Bounce;
use strict;
use warnings;
use MIME::Parser;
use Exporter;
......
......@@ -25,35 +25,21 @@
package Bulk;
use strict;
use warnings;
use Encode;
use Fcntl qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN);
use Carp;
use IO::Scalar;
use Storable;
use Mail::Header;
use Mail::Address;
use Time::HiRes qw(time);
use Time::Local;
use MIME::Entity;
use MIME::EncWords;
use MIME::Parser;
use MIME::Base64;
use Term::ProgressBar;
use URI::Escape;
use constant MAX => 100_000;
use Task;
use Fetch;
use WebAgent;
use tools;
use tt2;
use Sympa::Language;
use Log;
use Conf;
use mail;
use Ldap;
use Message;
use List;
use SDM;
......
......@@ -26,10 +26,9 @@
package Conf;
use strict "vars";
use strict;
use warnings;
use Exporter;
use Carp;
use Storable;
use confdef;
......
......@@ -25,7 +25,7 @@
package Config_XML;
use strict;
use warnings;
use XML::LibXML;
use Log;
......
......@@ -25,12 +25,11 @@
package DBManipulatorDefault;
use strict;
use warnings;
use Carp;
use Log;
use Log;
use SQLSource;
use Data::Dumper;
our @ISA = qw(SQLSource);
......
......@@ -25,12 +25,11 @@
package DBManipulatorInformix;
use strict;
use warnings;
use Carp;
use Log;
use DBManipulatorDefault;
our @ISA = qw(DBManipulatorDefault);
sub build_connect_string{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment