@@ -665,3 +665,59 @@ void been_there_done_that(void **state)
665
665
free (include );
666
666
assert_int_equal (code , ZONE_SYNTAX_ERROR );
667
667
}
668
+
669
+ /*!cmocka */
670
+ void bad_a_rrs (void * * state )
671
+ {
672
+ (void )state ;
673
+
674
+ int32_t code ;
675
+ size_t count = 0 ;
676
+ static const char * no_a = PAD ("foo. A ; no-address" );
677
+ static const char * double_a = PAD ("foo. A 192.168.0.1 192.168.0.2" );
678
+ static const char * bad_a = PAD ("foo. A 192.168.0.256" );
679
+
680
+ code = parse (no_a , & count );
681
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
682
+ code = parse (double_a , & count );
683
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
684
+ code = parse (bad_a , & count );
685
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
686
+ }
687
+
688
+ /*!cmocka */
689
+ void bad_ttls (void * * state )
690
+ {
691
+ (void )state ;
692
+
693
+ int32_t code ;
694
+ size_t count = 0 ;
695
+
696
+ static const char * too_little = PAD ("$TTL ; no time" );
697
+ static const char * too_late = PAD ("$TTL 2147483648" ); // one second too much
698
+ static const char * too_much = PAD ("$TTL 1 2" ); // trailing data
699
+
700
+ code = parse (too_little , & count );
701
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
702
+ code = parse (too_late , & count );
703
+ assert_int_equal (code , ZONE_SEMANTIC_ERROR );
704
+ code = parse (too_much , & count );
705
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
706
+ }
707
+
708
+ /*!cmocka */
709
+ void bad_origins (void * * state )
710
+ {
711
+ (void )state ;
712
+
713
+ int32_t code ;
714
+ size_t count = 0 ;
715
+
716
+ static const char * no_origin = PAD ("$ORIGIN ; no origin" );
717
+ static const char * extra_origin = PAD ("$ORIGIN a. b." );
718
+
719
+ code = parse (no_origin , & count );
720
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
721
+ code = parse (extra_origin , & count );
722
+ assert_int_equal (code , ZONE_SYNTAX_ERROR );
723
+ }
0 commit comments