Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
70c9373a
Commit
70c9373a
authored
Apr 09, 2019
by
IKEDA Soji
Browse files
Refactoring. Use constants for regexps to check scenario names.
parent
b6314019
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cgi/wwsympa.fcgi.in
View file @
70c9373a
...
...
@@ -927,9 +927,9 @@ our %in_regexp = (
'remote_addr' => Sympa::Regexps::host(),
## Scenario name
'scenario' => Sympa::Regexps::scenario(),
'read_access' => Sympa::Regexps::scenario(),
'edit_access' => Sympa::Regexps::scenario(),
'scenario' => Sympa::Regexps::scenario
_name
(),
'read_access' => Sympa::Regexps::scenario
_name
(),
'edit_access' => Sympa::Regexps::scenario
_name
(),
## RSS URL or blank
'active_lists' => '.*',
'latest_lists' => '.*',
...
...
src/lib/Sympa/ListDef.pm
View file @
70c9373a
...
...
@@ -2740,7 +2740,7 @@ sub cleanup {
$v
->
{
format
}
=
$format
;
}
elsif
(
$v
->
{'
scenario
'})
{
# Scenario format
$v
->
{'
format
'}
=
Sympa::Regexps::
scenario
();
$v
->
{'
format
'}
=
Sympa::Regexps::
scenario
_config
();
#XXX$v->{'default'} = 'default';
}
elsif
(
$v
->
{'
task
'})
{
# Task format
...
...
@@ -2789,7 +2789,7 @@ sub cleanup {
$v
->
{'
format
'}{
$k
}{
format
}
=
$format
;
}
elsif
(
$v
->
{'
format
'}{
$k
}{'
scenario
'})
{
# Scenario format
$v
->
{'
format
'}{
$k
}{'
format
'}
=
Sympa::Regexps::
scenario
();
$v
->
{'
format
'}{
$k
}{'
format
'}
=
Sympa::Regexps::
scenario
_config
();
#XXX$v->{'format'}{$k}{'default'} = 'default'
#XXX unless ($p eq 'web_archive' and $k eq 'access')
#XXX or ($p eq 'archive' and $k eq 'web_access');
...
...
src/lib/Sympa/Regexps.pm
View file @
70c9373a
...
...
@@ -57,7 +57,11 @@ use constant listname => qr'[a-z0-9][a-z0-9\-\.\+_]*';
use constant ldap_attrdesc => qr'
\
w[-
\
w]*(?:;[-
\
w]+)*'; # RFC2251, 4.1.5
use constant sql_query => qr'(SELECT|select).*';
use constant scenario => qr'[
\
w,
\
.
\
-]+';
#
"
scenario
"
was deprecated. Use
"
scenario_name
"
.
#
"
scenario_config
"
is used for compatibility to earlier list config files.
use constant scenario_config => qr'[-.,
\
w]+';
use constant scenario_name => qr'[-.
\
w]+';
use constant task => qr'
\
w+';
use constant datasource => qr'[
\
w-]+';
use constant uid => qr'[
\
w
\
-
\
.
\
+]+';
...
...
src/lib/Sympa/Scenario.pm
View file @
70c9373a
...
...
@@ -41,6 +41,7 @@ use Sympa::Database;
use
Sympa::
Language
;
use
Sympa::
List
;
use
Sympa::
Log
;
use
Sympa::
Regexps
;
use
Sympa::
Robot
;
use
Sympa::Tools::
Data
;
use
Sympa::Tools::
File
;
...
...
@@ -107,10 +108,12 @@ sub new {
my
$function
=
shift
;
my
%options
=
@_
;
my
$scenario_name_re
=
Sympa::Regexps::
scenario_name
();
# Compatibility for obsoleted use of parameter names.
$function
=
$compat_function_maps
{
$function
}
||
$function
;
die
'
bug in logic. Ask developer
'
unless
defined
$function
and
$function
=~
/\A
[-.\w]+
\z/
;
unless
defined
$function
and
$function
=~
/\A
$scenario_name_re
\z/
;
# Determine parameter to get the name of scenario.
# 'include' and 'topics_visibility' functions are special: They don't
...
...
@@ -151,7 +154,7 @@ sub new {
unless
(
defined
$name
and
(
$function
eq
'
include
'
and
$name
=~
m{\A[^/]+\z}
or
$name
=~
/\A
[-\w\.]+
\z/
)
or
$name
=~
/\A
$scenario_name_re
\z/
)
)
{
$log
->
syslog
('
err
',
'
Unknown or undefined scenario function "%s", scenario name "%s"
',
$function
,
$name
);
...
...
@@ -1593,7 +1596,7 @@ sub get_scenarios {
my
@paths
=
@
{
Sympa::
get_search_path
(
$that
,
subdir
=>
'
scenari
')};
#XXXunshift @list_of_scenario_dir, $that->{'dir'} . '/scenari';
my
$scenario_re
=
Sympa::Regexps::
scenario
();
my
$scenario_re
=
Sympa::Regexps::
scenario
_name
();
foreach
my
$dir
(
@paths
)
{
next
unless
-
d
$dir
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment