Commit f96e8859 authored by sikeda's avatar sikeda
Browse files

[-dev] Copyedits.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12652 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent b505c4bd
......@@ -90,7 +90,6 @@ sub _load {
$message->{context}, $message->{listtype});
# FIXME: at this point $message->{'dkim_pass'} does not verify that
# Subject: is part of the signature. It SHOULD !
my $auth_level = $message->{'dkim_pass'} ? 'dkim' : undef;
return [
Sympa::Request->new_from_tuples(
action => $action,
......@@ -99,26 +98,21 @@ sub _load {
context => $list,
email => $message->{sender},
message => $message,
sender => $message->{sender},
sign_mod => $auth_level,
#FIXME: smime_signed?
(map { $_ => $message->{$_} } qw(sender dkim_pass)),
)
];
}
my $auth_level =
$message->{'smime_signed'} ? 'smime'
: $message->{'dkim_pass'} ? 'dkim'
: undef;
## Process the Subject of the message
## Search and process a command in the Subject field
# Process the Subject of the message.
# Search and process a command in the Subject field.
my $subject_field = $message->{'decoded_subject'};
$subject_field = '' unless defined $subject_field;
$subject_field =~ s/\n//mg; ## multiline subjects
my $re_regexp = Sympa::Regexps::re();
$subject_field =~ s/^\s*(?:$re_regexp)?\s*(.*)\s*$/$1/i;
if ($subject_field =~ /\S/) {
my $request = _parse($robot, $subject_field, $auth_level, $message);
my $request = _parse($robot, $subject_field, $message);
return [$request] unless $request->{action} eq 'unknown';
}
......@@ -138,7 +132,7 @@ sub _load {
next unless length $line; # Skip empty lines.
next if $line =~ /^\s*\#/;
my $request = _parse($robot, $line, $auth_level, $message);
my $request = _parse($robot, $line, $message);
if ($request) {
if (@requests or $request->{action} ne 'unknown') {
push @requests, $request;
......@@ -157,7 +151,6 @@ sub _parse {
$log->syslog('debug2', '(%s, %s, %s, %s)', @_);
my $robot = shift;
my $line = shift;
my $sign_mod = shift;
my $message = shift;
$log->syslog('notice', "Parsing: %s", $line);
......@@ -215,8 +208,8 @@ sub _parse {
error => 'syntax_error',
message => $message,
quiet => $quiet,
sender => $message->{sender},
sign_mod => $sign_mod,
(map { $_ => $message->{$_} }
qw(sender dkim_pass smime_signed)),
);
}
......@@ -228,8 +221,7 @@ sub _parse {
context => $context,
message => $message,
quiet => $quiet,
sender => $message->{sender},
sign_mod => $sign_mod,
(map { $_ => $message->{$_} } qw(sender dkim_pass smime_signed)),
);
if ($args{localpart} and ref $request->{context} ne 'Sympa::List') {
......@@ -248,8 +240,7 @@ sub _parse {
cmd_line => $line,
context => $robot,
message => $message,
sender => $message->{sender},
sign_mod => $sign_mod,
(map { $_ => $message->{$_} } qw(sender dkim_pass smime_signed)),
);
}
......
......@@ -72,12 +72,17 @@ sub _twist {
# Authorize requests.
return 'wrong_auth'
unless defined _get_auth_method($self, $request);
my $action;
my $result;
my $auth_method = _get_auth_method($self, $request);
return 'wrong_auth'
unless defined $auth_method;
my $auth_method =
$request->{smime_signed} ? 'smime'
: $request->{md5_check} ? 'md5'
: $request->{dkim_pass} ? 'dkim'
: 'smtp';
$result = Sympa::Scenario::request_action($that, $scenario, $auth_method,
$context);
......@@ -168,8 +173,7 @@ sub _get_auth_method {
my $self = shift;
my $request = shift;
my $list = $request->{context};
my $sign_mod = $request->{sign_mod};
my $that = $request->{context};
my $sender = $request->{sender};
my $cmd = $request->{action};
......@@ -177,32 +181,27 @@ sub _get_auth_method {
my $auth = $request->{auth};
my $that;
my $auth_method;
if ($sign_mod and $sign_mod eq 'smime') {
$auth_method = 'smime';
if ($request->{smime_signed}) {
;
} elsif ($auth) {
$log->syslog('debug', 'Auth received from %s: %s', $sender, $auth);
my $compute;
if (ref $list eq 'Sympa::List') {
if (ref $that eq 'Sympa::List') {
$compute = Sympa::compute_auth(
context => $list,
context => $that,
email => $email,
action => $cmd
);
$that = $list->{'domain'}; # Robot
} else {
$compute = Sympa::compute_auth(
context => '*',
email => $email,
action => $cmd
);
$that = '*'; # Site
}
if ($auth eq $compute) {
$auth_method = 'md5';
$request->{md5_check} = 1;
} else {
$log->syslog('debug2', 'Auth should be %s', $compute);
if (grep { $cmd eq $_ } qw(add del invite signoff subscribe)) {
......@@ -210,7 +209,7 @@ sub _get_auth_method {
'wrong_email_confirm', {command => $cmd});
} else {
Sympa::send_notify_to_listmaster(
$list,
$that,
'mail_intern_error',
{ error => 'The authentication process failed',
who => $sender,
......@@ -223,12 +222,9 @@ sub _get_auth_method {
$request->{cmd_line}, $sender);
return undef;
}
} else {
$auth_method = 'smtp';
$auth_method = 'dkim' if $sign_mod and $sign_mod eq 'dkim';
}
return $auth_method;
return 1;
}
1;
......@@ -692,21 +692,18 @@ sub verify {
my $list = $request->{context};
my $listname = $list->{'name'};
my $robot = $list->{'domain'};
my $sign_mod = $request->{sign_mod};
my $sender = $request->{sender};
$language->set_lang($list->{'admin'}{'lang'});
if ($sign_mod) {
if ($request->{smime_signed} or $request->{dkim_pass}) {
$log->syslog(
'info', 'VERIFY successful from %s (%.2f seconds)',
$sender, Time::HiRes::time() - $self->{start_time}
);
if ($sign_mod eq 'smime') {
##$auth_method='smime';
if ($request->{smime_signed}) {
$self->add_stash($request, 'notice', 'smime');
} elsif ($sign_mod eq 'dkim') {
##$auth_method='dkim';
} elsif ($request->{dkim_pass}) {
$self->add_stash($request, 'notice', 'dkim');
}
} else {
......
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