aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm8
-rw-r--r--debian/changelog2
-rw-r--r--doc/ikiwiki/pagespec.mdwn3
3 files changed, 9 insertions, 4 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 {
diff --git a/debian/changelog b/debian/changelog
index 587a375b9..04feaffcb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ ikiwiki (3.20130519) UNRELEASED; urgency=low
(smcv)
* openid: Automatically upgrade openid_realm to https when
accessed via https.
+ * The ip() pagespec can now contain glob characters to match eg, a subnet
+ full of spammers.
-- Joey Hess <joeyh@debian.org> Sun, 23 Jun 2013 14:02:01 -0400
diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn
index fe1af4c15..0f298ad78 100644
--- a/doc/ikiwiki/pagespec.mdwn
+++ b/doc/ikiwiki/pagespec.mdwn
@@ -51,7 +51,8 @@ Some more elaborate limits can be added to what matches using these functions:
* "`admin()`" - tests whether a modification is being made by one of the
wiki admins.
* "`ip(address)`" - tests whether a modification is being made from the
- specified IP address.
+ specified IP address. Glob patterns can be used in the address. For
+ example, `ip(127.0.0.*)`
* "`comment(glob)`" - matches comments to a page matching the glob.
* "`comment_pending(glob)`" - matches unmoderated, pending comments.
* "`postcomment(glob)`" - matches only when comments are being