diff options
| author | fukachan <fukachan> | 2001-11-25 11:29:33 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-11-25 11:29:33 +0000 |
| commit | c10b09ef1342a3063fc688bbd10bf246e6dd17e4 (patch) | |
| tree | 8c80b0dd2eb00605516ab6b59f1feaba9f267263 /fml/lib/FML/Process | |
| parent | 8679f2ec92a231f8f66d358538b8c4b0f4e51093 (diff) | |
| download | fml8-c10b09ef1342a3063fc688bbd10bf246e6dd17e4.tar.gz fml8-c10b09ef1342a3063fc688bbd10bf246e6dd17e4.tar.bz2 fml8-c10b09ef1342a3063fc688bbd10bf246e6dd17e4.zip | |
modified to use FML::Restriction
Diffstat (limited to 'fml/lib/FML/Process')
| -rw-r--r-- | fml/lib/FML/Process/CGI/Param.pm | 18 | ||||
| -rw-r--r-- | fml/lib/FML/Process/SafeData.pm | 144 |
2 files changed, 9 insertions, 153 deletions
diff --git a/fml/lib/FML/Process/CGI/Param.pm b/fml/lib/FML/Process/CGI/Param.pm index 8722d40e..fe164522 100644 --- a/fml/lib/FML/Process/CGI/Param.pm +++ b/fml/lib/FML/Process/CGI/Param.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Param.pm,v 1.7 2001/11/13 15:19:18 fukachan Exp $ +# $FML: Param.pm,v 1.8 2001/11/25 09:12:58 fukachan Exp $ # package FML::Process::CGI::Param; @@ -52,10 +52,10 @@ sub safe_param { my ($self, $key) = @_; - use FML::Process::SafeData; - my $safe = new FML::Process::SafeData; - my $safe_param_regexp = $safe->cgi_param_regexp(); - my $safe_method_regexp = $safe->cgi_method_regexp(); + use FML::Restriction::CGI; + my $safe = new FML::Restriction::CGI; + my $safe_param_regexp = $safe->param_regexp(); + my $safe_method_regexp = $safe->method_regexp(); print STDERR "\n<!-- check param $key -->\n" if $debug; @@ -92,10 +92,10 @@ sub safe_paramlist my ($self, $numregexp, $key) = @_; my (@list) = (); - use FML::Process::SafeData; - my $safe = new FML::Process::SafeData; - my $safe_param_regexp = $safe->cgi_param_regexp(); - my $safe_method_regexp = $safe->cgi_method_regexp(); + use FML::Restriction::CGI; + my $safe = new FML::Restriction::CGI; + my $safe_param_regexp = $safe->param_regexp(); + my $safe_method_regexp = $safe->method_regexp(); # match method and return HASH ARRAY with matching values $key = $safe_method_regexp->{ $key }; diff --git a/fml/lib/FML/Process/SafeData.pm b/fml/lib/FML/Process/SafeData.pm deleted file mode 100644 index 356316dd..00000000 --- a/fml/lib/FML/Process/SafeData.pm +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/local/bin/perl -w -#-*- perl -*- -# -# Copyright (C) 2001 Ken'ichi Fukamachi -# All rights reserved. -# -# $FML: SafeData.pm,v 1.5 2001/11/23 02:52:24 fukachan Exp $ -# - -package FML::Process::SafeData; - -use vars qw($debug @ISA @EXPORT @EXPORT_OK); -use strict; -use Carp; - -=head1 NAME - -FML::Process::SafeData -- define safe data class - -=head1 SYNOPSIS - - use FML::Process::SafeData; - $safe = new FML::Process::SafeData; - my $regexp = $safe->regexp(); - -=head1 DESCRIPTION - -FML::Process::SafeData provides data type considered as safe. - -=head1 METHODS - -=head2 C<new($args)> - -usual constructor. - -=cut - - -# avoid default fml new() since we do not need it. -sub new -{ - my ($self) = @_; - my ($type) = ref($self) || $self; - my $me = {}; - return bless $me, $type; -} - - -=head1 Basic Parameter Definition for common use - - %basic_variable - -=cut - - -my %basic_variable = - ( - 'address' => '[-a-z0-9_]+\@[-A-Za-z0-9\.]+', - 'ml_name' => '[-a-z0-9_]+', - 'action' => '[-a-z_]+', - 'command' => '[-a-z_]+', - 'user' => '[-a-z0-9_]+', - 'article_id' => '\d+', - ); - - -=head1 Safe Parameter Definition for programs kicked by MTA - -not defined yet. - -Please extract regexp hash { varname => allowed_regexp } as HASH -REFERENCE via the following access method: - - ? - -=head1 Safe Parameter Definition for CGI use - -Please extract regexp hash { varname => allowed_regexp } as HASH -REFERENCE via the following access method: - - cgi_param_regexp() - cgi_method_regexp() - -=cut - - -my %cgi_methond = - ( - 'threadcgi_change_status' => 'change_status\.(__ml_name_regexp__)\/(\d+)', - ); - - - -sub cgi_param_regexp -{ - my ($self) = @_; - - return \%basic_variable; -} - - -sub cgi_method_regexp -{ - my ($self) = @_; - - # expand __var__regexp__ to regular expression defined in other hash - for my $key (keys %cgi_methond) { - my $value = $cgi_methond{ $key }; - if ($value =~ /__/o) { - - # expand variables defined in %basic_variable HASH - for my $regexpkey (keys %basic_variable) { - my $x = "__${regexpkey}_regexp__"; - my $y = $basic_variable{$regexpkey}; - $value =~ s/$x/$y/g; - $cgi_methond{ $key } = $value; - } - } - } - - return \%cgi_methond; -} - - -=head1 AUTHOR - -Ken'ichi Fukamachi - -=head1 COPYRIGHT - -Copyright (C) 2001 Ken'ichi Fukamachi - -All rights reserved. This program is free software; you can -redistribute it and/or modify it under the same terms as Perl itself. - -=head1 HISTORY - -FML::Process::Configure appeared in fml5 mailing list driver package. -See C<http://www.fml.org/> for more details. - -=cut - - -1; |
