diff options
| author | fukachan <fukachan> | 2002-04-06 02:42:39 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-04-06 02:42:39 +0000 |
| commit | 6ce075709c206fedbec72d84770f985e145277f0 (patch) | |
| tree | cb83225b8d778ffa433844e450c860c1c4e9c844 /fml | |
| parent | 42ca031adba5c555f8fcdbf6100df169c68ab27d (diff) | |
| download | fml8-6ce075709c206fedbec72d84770f985e145277f0.tar.gz fml8-6ce075709c206fedbec72d84770f985e145277f0.tar.bz2 fml8-6ce075709c206fedbec72d84770f985e145277f0.zip | |
show list in debug mode
clean up
define $user_regexp, $domain_regexp and redefine regexp table by using them
Diffstat (limited to 'fml')
| -rw-r--r-- | fml/lib/FML/Restriction/Base.pm | 58 | ||||
| -rw-r--r-- | fml/lib/FML/Restriction/CGI.pm | 26 |
2 files changed, 69 insertions, 15 deletions
diff --git a/fml/lib/FML/Restriction/Base.pm b/fml/lib/FML/Restriction/Base.pm index cffe50a2..c5fd2f49 100644 --- a/fml/lib/FML/Restriction/Base.pm +++ b/fml/lib/FML/Restriction/Base.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001,2002 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Base.pm,v 1.6 2002/03/24 11:18:09 fukachan Exp $ +# $FML: Base.pm,v 1.7 2002/03/26 03:59:44 fukachan Exp $ # package FML::Restriction::Base; @@ -14,7 +14,7 @@ use Carp; =head1 NAME -FML::Restriction::Base -- define safe data class +FML::Restriction::Base -- define safe data representations =head1 SYNOPSIS @@ -24,7 +24,7 @@ FML::Restriction::Base -- define safe data class =head1 DESCRIPTION -FML::Restriction::Base provides data type considered as safe. +FML::Restriction::Base provides data regexp considered as safe. =head1 METHODS @@ -51,24 +51,48 @@ sub new =head1 Basic Parameter Definition for common use - %basic_variable +We permit the variable name representation as a subset of RFC +definitions for conveninece and security. -=cut +=head2 domain name + +A domain name is case insensitive (see RFC). For example, + fml.org + FML.org + 123.f-m-l.org + +=head2 user + +Very restricted since strict 822 or 2822 representation is very +difficult and may be insecure in some cases. + +By the way, "_" is derived from lotus notes ? Anyway we permit "_" for +convenience. + +=head2 mail address + +off cource, "user@domain", described above. +=cut +my $domain_regexp = '[-A-Za-z0-9\.]+'; +my $user_regexp = '[-A-Za-z0-9\._]+'; my %basic_variable = ( - 'address' => '[-A-Za-z0-9_\.]+\@[-A-Za-z0-9\.]+', - 'address_specified' => '[-A-Za-z0-9_\.]+\@[-A-Za-z0-9\.]+', - 'address_selected' => '[-A-Za-z0-9_\.]+\@[-A-Za-z0-9\.]+', - - 'user' => '[-A-Za-z0-9_\.]+', - 'ml_name' => '[-A-Za-z0-9_\.]+', + # address, user and domain et.al. + 'address' => $user_regexp.'\@'.$domain_regexp, + 'address_specified' => $user_regexp.'\@'.$domain_regexp, + 'address_selected' => $user_regexp.'\@'.$domain_regexp, + 'domain' => $domain_regexp, + 'user' => $user_regexp, + 'ml_name' => $user_regexp, + + # fml specific parameters 'action' => '[-A-Za-z_]+', 'command' => '[-A-Za-z_]+', 'article_id' => '\d+', - # directory + # file, directory et.al. 'directory' => '[-a-zA-Z0-9]+', 'file' => '[-a-zA-Z0-9]+', ); @@ -84,6 +108,16 @@ sub basic_variable } +# +# debug +# +if ($0 eq __FILE__) { + for my $k (keys %basic_variable) { + printf "%-20s => %s\n", $k, $basic_variable{ $k }; + } +} + + =head1 AUTHOR Ken'ichi Fukamachi diff --git a/fml/lib/FML/Restriction/CGI.pm b/fml/lib/FML/Restriction/CGI.pm index 9db44e55..a8c7ea6a 100644 --- a/fml/lib/FML/Restriction/CGI.pm +++ b/fml/lib/FML/Restriction/CGI.pm @@ -3,7 +3,7 @@ # Copyright (C) 2001 Ken'ichi Fukamachi # All rights reserved. # -# $FML: CGI.pm,v 1.3 2001/12/22 09:21:11 fukachan Exp $ +# $FML: CGI.pm,v 1.4 2001/12/23 12:19:14 fukachan Exp $ # package FML::Restriction::CGI; @@ -17,13 +17,13 @@ use FML::Restriction::Base; =head1 NAME -FML::Restriction::CGI -- define safe data class for CGI module +FML::Restriction::CGI -- define safe data regexp for CGI module =head1 SYNOPSIS use FML::Restriction::CGI; $safe = new FML::Restriction::CGI; - my $regexp = $safe->regexp(); + my $regexp = $safe->method_regexp(); =head1 DESCRIPTION @@ -88,6 +88,26 @@ sub method_regexp } +# +# debug +# +if ($0 eq __FILE__) { + my $safe = new FML::Restriction::CGI; + my $regexp = $safe->param_regexp(); + + print "-- safe parameter regexp\n"; + for my $k (keys %$regexp) { + printf "%-20s => %s\n", $k, $regexp->{ $k }; + } + + $regexp = $safe->method_regexp(); + print "\n-- safe method regexp\n"; + for my $k (keys %$regexp) { + printf "%-20s => %s\n", $k, $regexp->{ $k }; + } +} + + =head1 AUTHOR Ken'ichi Fukamachi |
