diff options
author | Joey Hess <joey@kitenet.net> | 2013-07-08 11:49:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-07-08 11:49:38 -0400 |
commit | 533793ee462552dd0b782a69e2cfe48c8f93dedc (patch) | |
tree | 2502390f3fe2d30d227a990ac098d0195ff2dc24 /IkiWiki.pm | |
parent | 9eea60f0cbd2a25f06adae1636d41a4936c3e8a2 (diff) | |
download | ikiwiki-533793ee462552dd0b782a69e2cfe48c8f93dedc.tar ikiwiki-533793ee462552dd0b782a69e2cfe48c8f93dedc.tar.gz |
The ip() pagespec can now contain glob characters to match eg, a subnet full of spammers.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 0570c8bc5..c497dd38f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2776,12 +2776,12 @@ sub match_user ($$;@) { my $user=shift; my %params=@_; - my $regexp=IkiWiki::glob2re($user); - if (! exists $params{user}) { return IkiWiki::ErrorReason->new("no user specified"); } + my $regexp=IkiWiki::glob2re($user); + if (defined $params{user} && $params{user}=~$regexp) { return IkiWiki::SuccessReason->new("user is $user"); } @@ -2821,8 +2821,10 @@ sub match_ip ($$;@) { if (! exists $params{ip}) { return IkiWiki::ErrorReason->new("no IP specified"); } + + my $regexp=IkiWiki::glob2re(lc $ip); - if (defined $params{ip} && lc $params{ip} eq lc $ip) { + if (defined $params{ip} && lc $params{ip}=~$regexp) { return IkiWiki::SuccessReason->new("IP is $ip"); } else { |