Commit c5a3fe96 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Some fixup.

parent d5822691
......@@ -38,8 +38,8 @@ use Sympa::Alarm;
use Sympa::DatabaseManager;
use Sympa::List;
use Sympa::Log;
use Sympa::SOAP;
use Sympa::SOAP::Transport;
use Sympa::WWW::SOAP;
use Sympa::WWW::SOAP::Transport;
## Load sympa config
unless (Conf::load()) {
......@@ -81,8 +81,8 @@ my $all_lists = Sympa::List::get_lists('*');
# Soap part
##############################################################################
Sympa::SOAP::Transport->new(cookie_expire => $Conf::Conf{'cookie_expire'})
->dispatch_with({'urn:sympasoap' => 'Sympa::SOAP'})->handle;
Sympa::WWW::SOAP::Transport->new(cookie_expire => $Conf::Conf{'cookie_expire'})
->dispatch_with({'urn:sympasoap' => 'Sympa::WWW::SOAP'})->handle;
__END__
......
This diff is collapsed.
......@@ -2577,7 +2577,7 @@ sub _load_wwsconf {
return $wwsconf;
}
# MOVED: Use Sympa::Tools::WWW::update_css().
# MOVED: Use Sympa::WWW::Tools::update_css().
#sub update_css;
# lazy loading on demand
......
......@@ -8065,10 +8065,10 @@ sub get_which {
### moderation for shared
# DEPRECATED: Use {status} attribute of Sympa::SharedDocument instance.
# DEPRECATED: Use {status} attribute of Sympa::WWW::SharedDocument instance.
#sub get_shared_status;
# DEPRECATED: Use Sympa::SharedDocument::get_moderated_descendants().
# DEPRECATED: Use Sympa::WWW::SharedDocument::get_moderated_descendants().
#sub get_shared_moderated;
# DEPRECATED: Subroutine of get_shared_moderated().
......@@ -9009,7 +9009,7 @@ sub select_list_members_for_topic {
# DEPRECATED. Use Sympa::Spool::Auth::remove().
#sub delete_subscription_request;
# OBSOLETED: Use Sympa::SharedDocument::get_size().
# OBSOLETED: Use Sympa::WWW::SharedDocument::get_size().
#sub get_shared_size;
# OBSOLETED: Use Sympa::Archive::get_size().
......@@ -9185,7 +9185,7 @@ sub notify_bouncers {
return 1;
}
# DDEPRECATED: Use Sympa::SharedDocument::create().
# DDEPRECATED: Use Sympa::WWW::SharedDocument::create().
#sub create_shared;
## check if a list has include-type data sources
......
......@@ -22,7 +22,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::Auth;
package Sympa::WWW::Auth;
use strict;
use warnings;
......@@ -32,11 +32,11 @@ use Sympa;
use Conf;
use Sympa::Database;
use Sympa::Log;
use Sympa::Report;
use Sympa::Robot;
use Sympa::Tools::Data;
use Sympa::Tools::Text;
use Sympa::User;
use Sympa::WWW::Report;
my $log = Sympa::Log->instance;
......@@ -76,7 +76,7 @@ sub check_auth {
};
} else {
Sympa::Report::reject_report_web('user', 'incorrect_passwd', {})
Sympa::WWW::Report::reject_report_web('user', 'incorrect_passwd', {})
unless ($ENV{'SYMPA_SOAP'});
$log->syslog('err', "Incorrect LDAP password");
return undef;
......@@ -129,7 +129,7 @@ sub authentication {
# too many wrong login attemp
Sympa::User::update_global_user($email,
{wrong_login_count => $user->{'wrong_login_count'} + 1});
Sympa::Report::reject_report_web('user', 'too_many_wrong_login', {})
Sympa::WWW::Report::reject_report_web('user', 'too_many_wrong_login', {})
unless ($ENV{'SYMPA_SOAP'});
$log->syslog('err',
'Login is blocked: too many wrong password submission for %s',
......@@ -183,7 +183,7 @@ sub authentication {
Sympa::User::update_global_user($email,
{wrong_login_count => ($user->{'wrong_login_count'} || 0) + 1});
Sympa::Report::reject_report_web('user', 'incorrect_passwd', {})
Sympa::WWW::Report::reject_report_web('user', 'incorrect_passwd', {})
unless $ENV{'SYMPA_SOAP'};
$log->syslog('err', 'Incorrect password for user %s', $email);
......
......@@ -2,7 +2,7 @@
# vim:ft=perl:et:sw=4
# $Id$
package Sympa::Marc;
package Sympa::WWW::Marc;
use strict;
use warnings;
......
......@@ -2,7 +2,7 @@
# vim:ft=perl:et:sw=4
# $Id$
package Sympa::Marc::Search;
package Sympa::WWW::Marc::Search;
use strict;
use warnings;
......@@ -11,7 +11,7 @@ use English qw(-no_match_vars);
use File::Find qw();
use HTML::Entities qw();
use base qw(Sympa::Marc);
use base qw(Sympa::WWW::Marc);
our $VERSION = "4.3+Sympa-6.2";
our ($AUTOLOAD, @MSGFILES);
......@@ -53,7 +53,7 @@ my %fields = (
sub new {
my $class = shift;
my $self = Sympa::Marc->new(\%fields);
my $self = Sympa::WWW::Marc->new(\%fields);
bless $self, $class;
return $self;
}
......@@ -489,7 +489,7 @@ __END__
=head1 NAME
Sympa::Marc::Search - Search archives of Sympa
Sympa::WWW::Marc::Search - Search archives of Sympa
=head1 SYNOPSIS
......@@ -501,7 +501,7 @@ TBD.
=head1 HISTORY
L<Sympa::Marc::Search> was originally taken from
L<Sympa::WWW::Marc::Search> was originally taken from
L<Marc::Search> in MHonArc Search Engine by Eric D. Friedman:
L<http://www.mhonarc.org/contrib/marc-search/>.
......
......@@ -22,7 +22,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::Report;
package Sympa::WWW::Report;
use strict;
use warnings;
......
......@@ -25,24 +25,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::SOAP;
package Sympa::WWW::SOAP;
use strict;
use warnings;
use Encode qw();
use Sympa;
use Sympa::Auth;
use Conf;
use Sympa::Constants;
use Sympa::List;
use Sympa::Log;
use Sympa::Scenario;
use Sympa::Session;
use Sympa::Spindle::ProcessRequest;
use Sympa::Template;
use Sympa::Tools::Text;
use Sympa::User;
use Sympa::WWW::Auth;
use Sympa::WWW::Session;
## Define types of SOAP type listType
my %types = (
......@@ -183,7 +183,7 @@ sub login {
## Set an env var to find out if in a SOAP context
$ENV{'SYMPA_SOAP'} = 1;
my $user = Sympa::Auth::check_auth($robot, $email, $passwd);
my $user = Sympa::WWW::Auth::check_auth($robot, $email, $passwd);
unless ($user) {
$log->syslog('notice', 'Login authentication failed');
......@@ -192,9 +192,9 @@ sub login {
->faultdetail("Incorrect password for user $email or bad login");
}
## Create Sympa::Session object
my $session = Sympa::Session->new($robot,
{'cookie' => Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'})});
## Create Sympa::WWW::Session object
my $session = Sympa::WWW::Session->new($robot,
{'cookie' => Sympa::WWW::Session::encrypt_session_id($ENV{'SESSION_ID'})});
$ENV{'USER_EMAIL'} = $email;
$session->{'email'} = $email;
$session->store();
......@@ -204,7 +204,7 @@ sub login {
## Also return the cookie value
return SOAP::Data->name('result')->type('string')
->value(Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'}));
->value(Sympa::WWW::Session::encrypt_session_id($ENV{'SESSION_ID'}));
}
sub casLogin {
......@@ -273,7 +273,7 @@ sub casLogin {
## Now fetch email attribute from LDAP
unless ($email =
Sympa::Auth::get_email_by_net_id($robot, $cas_id, {'uid' => $user})) {
Sympa::WWW::Auth::get_email_by_net_id($robot, $cas_id, {'uid' => $user})) {
$log->syslog('err',
'Could not get email address from LDAP for user %s', $user);
die SOAP::Fault->faultcode('Server')
......@@ -281,9 +281,9 @@ sub casLogin {
->faultdetail("Could not get email address from LDAP directory");
}
## Create Sympa::Session object
my $session = Sympa::Session->new($robot,
{'cookie' => Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'})});
## Create Sympa::WWW::Session object
my $session = Sympa::WWW::Session->new($robot,
{'cookie' => Sympa::WWW::Session::encrypt_session_id($ENV{'SESSION_ID'})});
$ENV{'USER_EMAIL'} = $email;
$session->{'email'} = $email;
$session->store();
......@@ -293,7 +293,7 @@ sub casLogin {
## Also return the cookie value
return SOAP::Data->name('result')->type('string')
->value(Sympa::Session::encrypt_session_id($ENV{'SESSION_ID'}));
->value(Sympa::WWW::Session::encrypt_session_id($ENV{'SESSION_ID'}));
}
## Used to call a service as an authenticated user without using HTTP cookies
......@@ -319,7 +319,7 @@ sub authenticateAndRun {
## Provided email is not trusted, we fetch the user email from the
## session_table instead
my $session =
Sympa::Session->new($ENV{'SYMPA_ROBOT'}, {'cookie' => $cookie});
Sympa::WWW::Session->new($ENV{'SYMPA_ROBOT'}, {'cookie' => $cookie});
if (defined $session) {
$email = $session->{'email'};
$session_id = $session->{'id_session'};
......@@ -351,7 +351,7 @@ sub getUserEmailByCookie {
}
my $session =
Sympa::Session->new($ENV{'SYMPA_ROBOT'}, {'cookie' => $cookie});
Sympa::WWW::Session->new($ENV{'SYMPA_ROBOT'}, {'cookie' => $cookie});
unless (defined $session && ($session->{'email'} ne 'unkown')) {
$log->syslog('err', 'Failed to load session for %s', $cookie);
......@@ -388,7 +388,7 @@ sub authenticateRemoteAppAndRun {
->faultdetail('Use : <appname> <apppassword> <vars> <service>');
}
my ($proxy_vars, $set_vars) =
Sympa::Auth::remote_app_check_password($appname, $apppassword, $robot,
Sympa::WWW::Auth::remote_app_check_password($appname, $apppassword, $robot,
$service);
unless (defined $proxy_vars) {
......
......@@ -25,7 +25,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::SOAP::Transport;
package Sympa::WWW::SOAP::Transport;
use strict;
use warnings;
......@@ -33,8 +33,8 @@ use English qw(-no_match_vars);
use SOAP::Transport::HTTP;
use Sympa::Log;
use Sympa::Session;
use Sympa::Tools::WWW;
use Sympa::WWW::Session;
use Sympa::WWW::Tools;
# 'base' pragma doesn't work here
our @ISA = qw(SOAP::Transport::HTTP::FCGI);
......@@ -59,20 +59,20 @@ sub request {
if (my $request = $_[0]) {
# Select appropriate robot.
$ENV{'SYMPA_ROBOT'} =
Sympa::Tools::WWW::get_robot('soap_url_local', 'soap_url');
Sympa::WWW::Tools::get_robot('soap_url_local', 'soap_url');
my $session;
## Existing session or new one
if (Sympa::Session::get_session_cookie($ENV{'HTTP_COOKIE'})) {
$session = Sympa::Session->new(
if (Sympa::WWW::Session::get_session_cookie($ENV{'HTTP_COOKIE'})) {
$session = Sympa::WWW::Session->new(
$ENV{'SYMPA_ROBOT'},
{ 'cookie' => Sympa::Session::get_session_cookie(
{ 'cookie' => Sympa::WWW::Session::get_session_cookie(
$ENV{'HTTP_COOKIE'}
)
}
);
} else {
$session = Sympa::Session->new($ENV{'SYMPA_ROBOT'}, {});
$session = Sympa::WWW::Session->new($ENV{'SYMPA_ROBOT'}, {});
$session->store() if (defined $session);
## Note that id_session changes each time it is saved in the DB
$session->renew()
......@@ -97,7 +97,7 @@ sub response {
if (my $response = $_[0]) {
if (defined $ENV{'SESSION_ID'}) {
my $cookie =
Sympa::Session::soap_cookie2($ENV{'SESSION_ID'},
Sympa::WWW::Session::soap_cookie2($ENV{'SESSION_ID'},
$ENV{'SERVER_NAME'}, $self->{_ss_cookie_expire});
$response->headers->push_header('Set-Cookie2' => $cookie);
}
......
......@@ -22,7 +22,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::Session;
package Sympa::WWW::Session;
use strict;
use warnings;
......@@ -35,7 +35,6 @@ use Sympa::Language;
use Sympa::Log;
use Sympa::Tools::Data;
use Sympa::Tools::Password;
use Sympa::Tools::Time;
# this structure is used to define which session attributes are stored in a
# dedicated database col where others are compiled in col 'data_session'
......@@ -93,10 +92,10 @@ sub new {
return undef;
}
if ($status eq 'not_found') {
# Start a Sympa::Session->new(may be a fake cookie).
# Start a Sympa::WWW::Session->new(may be a fake cookie).
$log->syslog('info', 'Ignoring unknown session cookie "%s"',
$cookie);
return (Sympa::Session->new($robot));
return (Sympa::WWW::Session->new($robot));
}
} else {
# create a new session context
......@@ -473,91 +472,8 @@ sub renew {
return 1;
}
## remove old sessions from a particular robot or from all robots.
## delay is a parameter in seconds
sub purge_old_sessions {
$log->syslog('debug2', '(%s)', @_);
my $robot = shift;
my $delay =
Sympa::Tools::Time::duration_conv($Conf::Conf{'session_table_ttl'});
my $anonymous_delay = Sympa::Tools::Time::duration_conv(
$Conf::Conf{'anonymous_session_table_ttl'});
unless ($delay) {
$log->syslog('info', '(%s) Exit with delay null', $robot);
return;
}
unless ($anonymous_delay) {
$log->syslog('info', '(%s) Exit with anonymous delay null', $robot);
return;
}
my @sessions;
my $sth;
my $sdm = Sympa::DatabaseManager->instance;
unless ($sdm) {
$log->syslog('err', 'Unavailable database connection');
return;
}
my (@conditions, @anonymous_conditions);
push @conditions, sprintf('robot_session = %s', $sdm->quote($robot))
if $robot and $robot ne '*';
@anonymous_conditions = @conditions;
push @conditions, sprintf('%d > date_session', time - $delay) if $delay;
push @anonymous_conditions,
sprintf('%d > date_session', time - $anonymous_delay)
if $anonymous_delay;
my $condition = join ' AND ', @conditions;
my $anonymous_condition = join ' AND ', @anonymous_conditions,
"email_session = 'nobody'", 'hit_session = 1';
my $count_statement =
sprintf q{SELECT COUNT(*) FROM session_table WHERE %s}, $condition;
my $anonymous_count_statement =
sprintf q{SELECT COUNT(*) FROM session_table WHERE %s},
$anonymous_condition;
my $statement = sprintf q{DELETE FROM session_table WHERE %s}, $condition;
my $anonymous_statement = sprintf q{DELETE FROM session_table WHERE %s},
$anonymous_condition;
unless ($sth = $sdm->do_query($count_statement)) {
$log->syslog('err', 'Unable to count old session for robot %s',
$robot);
return undef;
}
my $total = $sth->fetchrow;
if ($total == 0) {
$log->syslog('debug', 'No sessions to expire');
} else {
unless ($sth = $sdm->do_query($statement)) {
$log->syslog('err', 'Unable to purge old sessions for robot %s',
$robot);
return undef;
}
}
unless ($sth = $sdm->do_query($anonymous_count_statement)) {
$log->syslog('err', 'Unable to count anonymous sessions for robot %s',
$robot);
return undef;
}
my $anonymous_total = $sth->fetchrow;
if ($anonymous_total == 0) {
$log->syslog('debug', 'No anonymous sessions to expire');
return $total;
}
unless ($sth = $sdm->do_query($anonymous_statement)) {
$log->syslog('err', 'Unable to purge anonymous sessions for robot %s',
$robot);
return undef;
}
return $total + $anonymous_total;
}
# Deprecated. Use purge_session_table() in task_manager.pl.
#sub purge_old_sessions;
# Moved to: Sympa::Ticket::purge_old_tickets().
#sub purge_old_tickets;
......@@ -615,7 +531,7 @@ sub list_sessions {
## Subroutine to get session cookie value
sub get_session_cookie {
my $http_cookie = shift;
return Sympa::Session::_generic_get_cookie($http_cookie, 'sympa_session');
return Sympa::WWW::Session::_generic_get_cookie($http_cookie, 'sympa_session');
}
## Generic subroutine to set a cookie
......@@ -759,7 +675,7 @@ sub decrypt_session_id {
# name=>NAME, value=>VALUE, expires=>EXPIRES, domain=>DOMAIN, path=>PATH);
# Sets an HTTP cookie to be sent to a SOAP client
# DEPRECATED: Use Sympa::Session::soap_cookie2().
# DEPRECATED: Use Sympa::WWW::Session::soap_cookie2().
#sub set_cookie_soap($session_id, $http_domain, $expire);
## returns Message Authentication Check code
......@@ -931,14 +847,14 @@ __END__
=head1 NAME
Sympa::Session - Web session
Sympa::WWW::Session - Web session
=head1 SYNOPSIS
use Sympa::Session;
use Sympa::WWW::Session;
my $session = Sympa::Session->new($robot,
{cookie => Sympa::Session::get_session_cookie($ENV{'HTTP_COOKIE'})}
my $session = Sympa::WWW::Session->new($robot,
{cookie => Sympa::WWW::Session::get_session_cookie($ENV{'HTTP_COOKIE'})}
);
$session->renew();
$session->store();
......@@ -962,7 +878,7 @@ Sympa::Session - Web session
=head1 DESCRIPTION
L<Sympa::Session> provides web session for Sympa web interface.
L<Sympa::WWW::Session> provides web session for Sympa web interface.
HTTP cookie is required to determine users.
Session store is used to keep users' personal data.
......@@ -1136,7 +1052,8 @@ L<Sympa::DatabaseManager>.
L<SympaSession> appeared on Sympa 5.4a3.
It was renamed to L<Sympa::Session> on Sympa 6.2a.41.
It was renamed to L<Sympa::Session> on Sympa 6.2a.41,
then L<Sympa::WWW::Session> on Sympa 6.2.26.
L</"confirm_action"> method was added on Sympa 6.2.17.
......
......@@ -25,7 +25,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::SharedDocument;
package Sympa::WWW::SharedDocument;
use strict;
use warnings;
......@@ -386,7 +386,7 @@ sub create_child {
$options{type} ||= 'directory';
if (not Sympa::SharedDocument::valid_name($new_name)) {
if (not Sympa::WWW::SharedDocument::valid_name($new_name)) {
$ERRNO = POSIX::EINVAL();
return undef;
}
......@@ -864,7 +864,7 @@ sub rename {
$ERRNO = POSIX::EPERM();
return undef;
}
if (not Sympa::SharedDocument::valid_name($new_name)
if (not Sympa::WWW::SharedDocument::valid_name($new_name)
or ($self->{type} eq 'url' and $new_name !~ /[.]url\z/)) {
$ERRNO = POSIX::EINVAL();
return undef;
......@@ -1016,13 +1016,13 @@ __END__
=head1 NAME
Sympa::SharedDocument - Shared document repository and its nodes
Sympa::WWW::SharedDocument - Shared document repository and its nodes
=head1 SYNOPSIS
use Sympa::SharedDocument;
use Sympa::WWW::SharedDocument;
$shared = Sympa::SharedDocument->new($list, $path);
$shared = Sympa::WWW::SharedDocument->new($list, $path);
%access = $shared->get_privileges('read', $email, 'md5', {...});
@children = $shared->get_children;
......@@ -1030,7 +1030,7 @@ Sympa::SharedDocument - Shared document repository and its nodes
=head1 DESCRIPTION
L<Sympa::SharedDocument> implements shared document repository of lists.
L<Sympa::WWW::SharedDocument> implements shared document repository of lists.
=head2 Methods
......@@ -1291,7 +1291,7 @@ Existing files and directories may have the name not allowed by this function.
=head2 Attributes
Instance of L<Sympa::SharedDocument> may have following attributes.
Instance of L<Sympa::WWW::SharedDocument> may have following attributes.
=over
......@@ -1356,7 +1356,7 @@ given by property description.
=item {parent}
Parent node if any. L<Sympa::SharedDocument> instance.
Parent node if any. L<Sympa::WWW::SharedDocument> instance.
=item {paths}
......@@ -1448,4 +1448,6 @@ L<SharedDocument> module appeared on Sympa 5.2b.2.
Rewritten L<Sympa::SharedDocument> began to provide OO interface on
Sympa 6.2.17.
It was renamed to L<Sympa::WWW::SharedDocument> on Sympa 6.2.26.
=cut
......@@ -25,7 +25,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package Sympa::Tools::WWW;
package Sympa::WWW::Tools;
use strict;
use warnings;
......@@ -178,7 +178,7 @@ our %bounce_status = (
#sub load_mime_types();
## Returns user information extracted from the cookie
# Deprecated. Use Sympa::Session->new etc.
# Deprecated. Use Sympa::WWW::Session->new etc.
#sub get_email_from_cookie;
# NO LONGER USED.
......@@ -330,7 +330,7 @@ sub get_http_host {
# DEPRECATED: No longer used.
#sub merge_edit;
# Moved: Use Sympa::SharedDocument::_load_desc_file().
# Moved: Use Sympa::WWW::SharedDocument::_load_desc_file().
#sub get_desc_file;
# DEPRECATED: No longer used.
......@@ -339,7 +339,7 @@ sub get_http_host {
# DEPRECATED: No longer used (a subroutine of get_directory_content()).
#sub select_my_files;
# Moved to Sympa::SharedDocument::_get_icon().
# Moved to Sympa::WWW::SharedDocument::_get_icon().
#sub get_icon;