summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-12-21 16:45:54 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-12-24 00:04:05 +1100
commite4bb5294d9e13d73a87b79c65039e2f6a15b2815 (patch)
treea38e5702fbdb714432c403bf03ae87b097e12d91 /spec
parent776be7c8fe96bc2505d60470eedea220aa60d276 (diff)
Fix for #2967 (RFC-1123 problem and regression on wildcarded domains)
The core bug here was a regression introduced by my IPv6 patch. Wildcarded domains are stored as ["com","reductivelabs","*"] but the code in question was assuming it was in normal order. Added tests to prevet recurrence. Signed-off-by: Markus Roberts <Markus@reality.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/network/authstore.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/network/authstore.rb b/spec/unit/network/authstore.rb
index c822c9002..58eb92693 100644
--- a/spec/unit/network/authstore.rb
+++ b/spec/unit/network/authstore.rb
@@ -278,6 +278,28 @@ describe Puppet::Network::AuthStore::Declaration do
end
}
+ ['abc.12seps.edu.phisher.biz','www.google.com','slashdot.org'].each { |host|
+ (1...(host.split('.').length)).each { |n|
+ describe "when the pattern is #{"*."+host.split('.')[-n,n].join('.')}" do
+ before :each do
+ @pattern = "*."+host.split('.')[-n,n].join('.')
+ @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,@pattern)
+ end
+ it "should match #{host}" do
+ @declaration.should be_match(host,'1.2.3.4')
+ end
+ it "should not match www.testsite.gov" do
+ @declaration.should_not be_match('www.testsite.gov','200.101.99.98')
+ end
+ it "should not match hosts that differ in the first non-wildcard segment" do
+ other = host.split('.')
+ other[-n].succ!
+ @declaration.should_not be_match(other.join('.'),'1.2.3.4')
+ end
+ end
+ }
+ }
+
describe "when the pattern is a FQDN" do
before :each do
@host = 'spirit.mars.nasa.gov.'