| 1 | package CGI::Untaint::Winfilename; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | BEGIN { | ||
| 5 | use Exporter (); | ||
| 6 | use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||
| 7 | $VERSION = 0.1; | ||
| 8 | @ISA = qw (Exporter); | ||
| 9 | #Give a hoot don't pollute, do not export more than needed by default | ||
| 10 | @EXPORT = qw (); | ||
| 11 | @EXPORT_OK = qw (); | ||
| 12 | %EXPORT_TAGS = (); | ||
| 13 | } | ||
| 14 | use base 'CGI::Untaint::object'; | ||
| 15 | |||
| 16 | ########################################### main pod documentation begin ## | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | CGI::Untaint::Winfilename - CGI::Untaint::Winfilename - untaint Windows filename values from CGI programs | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | use CGI::Untaint::Winfilename; | ||
| 25 | my $handler = CGI::Untaint->new( $q->Vars() ); | ||
| 26 | my $filename = $handler->extract( -as_winfilename => 'some_feature' ); | ||
| 27 | |||
| 28 | |||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | This input handler verifies that it has a a valid (Windows) filename. It provides the regex and a subroutine for a handler. | ||
| 32 | Extensive test cases are provided. | ||
| 33 | |||
| 34 | =head1 INSTALLATION | ||
| 35 | |||
| 36 | perl Build.PL | ||
| 37 | ./Build | ||
| 38 | ./Build test | ||
| 39 | ./Build install | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | =head1 BUGS | ||
| 44 | |||
| 45 | While it is valid to end a UNIX filename with \# ! and % I haven't got those incorporated into the regular expression. | ||
| 46 | Test cases exist but are currently commented out. | ||
| 47 | |||
| 48 | Please report any fixes and other bugs to L<http://rt.cpan.org/>. | ||
| 49 | |||
| 50 | =head1 SUPPORT | ||
| 51 | |||
| 52 | Bug reports welcome, see above. | ||
| 53 | |||
| 54 | |||
| 55 | =head1 AUTHOR | ||
| 56 | |||
| 57 | Dana Hudes | ||
| 58 | CPAN ID: DHUDES | ||
| 59 | dhudes@hudes.org | ||
| 60 | http://www.hudes.org | ||
| 61 | |||
| 62 | |||
| 63 | =head1 COPYRIGHT | ||
| 64 | |||
| 65 | This program is free software; you can redistribute | ||
| 66 | it and/or modify it under the same terms as Perl itself. | ||
| 67 | |||
| 68 | The full text of the license can be found in the | ||
| 69 | LICENSE file included with this module. | ||
| 70 | |||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | perl(1). CGI::Untaint, CGI::Untaint::Filenames, Test::CGI::Untaint | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | ############################################# main pod documentation end ## | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | sub _untaint_re { | ||
| 84 | =head1 Rules | ||
| 85 | Two groups of characters: those valid anywhere and those valid only at the end of the string. | ||
| 86 | |||
| 87 | =cut | ||
| 88 | # qr/^[\w\+\[\]\^#\/_]*[\$\%!]$/ ; | ||
| 89 | qr /^(([a-zA-Z]:)?\\?[\w\+_\040\(\)\{\}\[\]\/\-\^,\.;&%@\$!\\~\#]+)$/; | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | 1; #this line is important and will help the module return a true value | ||
| 97 | __END__ |