diff options
| author | fukachan <fukachan> | 2004-06-27 07:56:17 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-06-27 07:56:17 +0000 |
| commit | 6626ab2e3f6a6727a4d38d45294efc9c225612fe (patch) | |
| tree | bd212d2dca9ed8318ee6713326cf233539af6c3b /fml/lib | |
| parent | fc5896bc5c2354da51560ce9da446288ace831fc (diff) | |
| download | fml8-6626ab2e3f6a6727a4d38d45294efc9c225612fe.tar.gz fml8-6626ab2e3f6a6727a4d38d45294efc9c225612fe.tar.bz2 fml8-6626ab2e3f6a6727a4d38d45294efc9c225612fe.zip | |
bug fix: implement verify_syntax().
Diffstat (limited to 'fml/lib')
| -rw-r--r-- | fml/lib/FML/Command/User/chaddr.pm | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/fml/lib/FML/Command/User/chaddr.pm b/fml/lib/FML/Command/User/chaddr.pm index 01e0b5ab..1fc4b844 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.30 2004/04/23 04:10:31 fukachan Exp $ +# $FML: chaddr.pm,v 1.31 2004/06/26 11:47:57 fukachan Exp $ # package FML::Command::User::chaddr; @@ -64,6 +64,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 $options = $command_args->{ options } || []; + my $command = $comname; + my $oldaddr = $options->[ 0 ] || ''; + my $newaddr = $options->[ 1 ] || ''; + my (@test) = ($command); + + $curproc->log("command = $command, old = $oldaddr, new = $newaddr"); + + 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: chaddr adapter: confirm before real chaddr operation. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update database for confirmation. |
