bind9mgr 0.3.16 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/bind9mgr.rb +1 -1
- data/lib/resource_record.rb +2 -2
- data/spec/resource_record_spec.rb +5 -5
- metadata +1 -1
data/History.txt
CHANGED
data/lib/bind9mgr.rb
CHANGED
data/lib/resource_record.rb
CHANGED
@@ -17,8 +17,8 @@ module Bind9mgr
|
|
17
17
|
def valid?
|
18
18
|
@errors = []
|
19
19
|
(@errors << "Base type_and_rdata_shouldnt_be_blank"; return false) unless @type && @rdata
|
20
|
-
(@errors << "Rdata rdata_shouldnt_be_blank_string"; return false) if @rdata.kind_of?(String) && @rdata.length < 1
|
21
|
-
(@errors << "Owner invalid") if @owner && ( !@owner.kind_of?(String) || (@owner
|
20
|
+
(@errors << "Rdata rdata_shouldnt_be_blank_string"; return false) if @rdata.kind_of?(String) && (@rdata.length < 1 || !@rdata.match(/[^\.\;\,]/))
|
21
|
+
(@errors << "Owner invalid") if @owner && ( !@owner.kind_of?(String) || (@owner == 'localhost') )
|
22
22
|
(@errors << "Class invalid") if !klass.nil? && !KLASSES.include?( klass )
|
23
23
|
(@errors << "Type not_supported") unless ALLOWED_TYPES.include?( type )
|
24
24
|
|
@@ -56,13 +56,13 @@ describe Bind9mgr::ResourceRecord do
|
|
56
56
|
it( "with nil owner" ) { subject.new( nil, nil, 'IN', 'A', '192.168.1.1' ).should be_valid }
|
57
57
|
|
58
58
|
it( "with '1' in all fields" ) { subject.new( '1', '1', '1', 'A', '1' ).should_not be_valid }
|
59
|
-
|
60
|
-
|
59
|
+
# bind ignores this, so we are # it( "with digit in owner" ) { subject.new( '1', nil, 'IN', 'A', '192.168.1.1' ).should_not be_valid }
|
60
|
+
# bind ignores this, so we are # it( "with double digit in owner" ) { subject.new( '11', nil, 'IN', 'A', '192.168.1.1' ).should_not be_valid }
|
61
61
|
it( "with blank rdata" ) { subject.new( 'sub', nil, 'IN', 'A', '' ).should_not be_valid }
|
62
62
|
it( "with nil rdata" ) { subject.new( 'sub', nil, 'IN', 'A', nil ).should_not be_valid }
|
63
|
-
it( "with digit in rdata" ) { subject.new( '
|
64
|
-
it( "with char in rdata" ) { subject.new( '
|
65
|
-
it( "with punctuation in rdata" ) { subject.new( '
|
63
|
+
# it( "with digit in rdata" ) { subject.new( 'qwe', nil, 'IN', 'A', '1' ).should_not be_valid }
|
64
|
+
# it( "with char in rdata" ) { subject.new( 'qwe', nil, 'IN', 'A', 's' ).should_not be_valid }
|
65
|
+
it( "with punctuation in rdata" ) { subject.new( 'qwe', nil, 'IN', 'A', ',;;;' ).should_not be_valid }
|
66
66
|
it( "with wrong class" ) { subject.new( 'sub', nil, 'IN222', 'A', '192.168.1.1' ).should_not be_valid }
|
67
67
|
end
|
68
68
|
|