summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-02-04 14:42:14 +0000
committerfukachan <fukachan>2004-02-04 14:42:14 +0000
commitbabbe67e4bd11bcc3404100773779c3968648ad1 (patch)
tree3ea88c385da4dd03f7b6a67ac6cb3c7e1c8759a4
parentbd3c4a759b1e2c4bbc9d55c5031e71d4552e7ad1 (diff)
downloadfml8-babbe67e4bd11bcc3404100773779c3968648ad1.tar.gz
fml8-babbe67e4bd11bcc3404100773779c3968648ad1.tar.bz2
fml8-babbe67e4bd11bcc3404100773779c3968648ad1.zip
vaildate address type variables.
-rw-r--r--fml/lib/FML/Command/User/chaddr.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/fml/lib/FML/Command/User/chaddr.pm b/fml/lib/FML/Command/User/chaddr.pm
index 3c8e7243..165c35d6 100644
--- a/fml/lib/FML/Command/User/chaddr.pm
+++ b/fml/lib/FML/Command/User/chaddr.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: chaddr.pm,v 1.25 2003/12/30 03:07:54 fukachan Exp $
+# $FML: chaddr.pm,v 1.26 2003/12/31 04:05:45 fukachan Exp $
#
package FML::Command::User::chaddr;
@@ -99,7 +99,6 @@ sub process
my $compare_level = $cred->get_compare_level();
$cred->set_compare_level( 100 );
- # XXX-TODO: syntax checks of addresses
# addresses we check and send back confirmation messages to
my $optargs = {};
my $x = $command_args->{ command };
@@ -107,6 +106,18 @@ sub process
my ($old_addr, $new_addr) = split(/\s+/, $x);
$optargs->{ recipient } = [ $sender, $old_addr, $new_addr ];
+ # simple checks.
+ use FML::Restriction::Base;
+ my $safe = new FML::Restriction::Base;
+ unless ($safe->regexp_match('address', $old_addr)) {
+ $curproc->logerror("chaddr: unsafe address <$old_addr>");
+ croak("chaddr: unsafe address");
+ }
+ unless ($safe->regexp_match('address', $new_addr)) {
+ $curproc->logerror("chaddr: unsafe address <$new_addr>");
+ croak("chaddr: unsafe address");
+ }
+
# prompt again (since recipient differs)
my $prompt = $config->{ command_mail_reply_prompt } || '>>>';
$curproc->reply_message("\n$prompt $command", $optargs);