diff options
| author | fukachan <fukachan> | 2004-04-28 04:10:35 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-04-28 04:10:35 +0000 |
| commit | 8cf3342dc0773e309f80a73057d77cfd1bbd1569 (patch) | |
| tree | 91729d6396ceb89d3ae31dcf477f175f833e7c72 /fml/lib/FML/Command/Admin/chaddr.pm | |
| parent | 483bef87b2fbaef948d041c103d3d502564265ce (diff) | |
| download | fml8-8cf3342dc0773e309f80a73057d77cfd1bbd1569.tar.gz fml8-8cf3342dc0773e309f80a73057d77cfd1bbd1569.tar.bz2 fml8-8cf3342dc0773e309f80a73057d77cfd1bbd1569.zip | |
implement verify_syntax() using FML::Command::Syntax
Diffstat (limited to 'fml/lib/FML/Command/Admin/chaddr.pm')
| -rw-r--r-- | fml/lib/FML/Command/Admin/chaddr.pm | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm index dbfa4508..e56ba3f5 100644 --- a/fml/lib/FML/Command/Admin/chaddr.pm +++ b/fml/lib/FML/Command/Admin/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.24 2004/02/15 04:38:27 fukachan Exp $ +# $FML: chaddr.pm,v 1.25 2004/04/23 04:10:28 fukachan Exp $ # package FML::Command::Admin::chaddr; @@ -61,6 +61,52 @@ sub need_lock { 1;} sub lock_channel { return 'command_serialize';} +# Descriptions: verify the syntax command string. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: none +# Return Value: NUM(1 or 0) +sub verify_syntax +{ + my ($self, $curproc, $command_args) = @_; + my $comname = $command_args->{ comname } || ''; + my $comsubname = $command_args->{ comsubname } || ''; + my $options = $command_args->{ options } || []; + my @test = ($comname); + my $command = $options->[ 0 ] || ''; + my $oldaddr = $options->[ 1 ] || ''; + my $newaddr = $options->[ 2 ] || ''; + push(@test, $command); + + my $ok = 0; + + use FML::Restriction::Base; + my $dispatch = new FML::Restriction::Base; + if ($dispatch->regexp_match('address', $oldaddr)) { + $ok++; + } + else { + $curproc->logerror("insecure address: <$oldaddr>"); + return 0; + } + + if ($dispatch->regexp_match('address', $newaddr)) { + $ok++; + } + else { + $curproc->logerror("insecure address: <$newaddr>"); + return 0; + } + + use FML::Command; + $dispatch = new FML::Command; + if ($dispatch->safe_regexp_match($curproc, $command_args, \@test)) { + $ok++; + } + + return( $ok == 3 ? 1 : 0 ); +} + + # Descriptions: change address from old one to new one. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map |
