@@ -1168,3 +1168,54 @@ void quoted_escaped_start(void** state)
1168
1168
NULL );
1169
1169
assert_int_equal (result , ZONE_SUCCESS );
1170
1170
}
1171
+
1172
+ /*!cmocka */
1173
+ void contiguous_escaped_reset (void * * state )
1174
+ {
1175
+ /* Check that the fallback parser resets the is_escaped value, so that
1176
+ * a newline is not wrongly classified in the next block. */
1177
+ char * zone = PAD (
1178
+ "$ORIGIN example.\n"
1179
+ "$TTL 3600\n"
1180
+ "@ IN SOA ns zonemaster.mail 2147483647 3600 900 1814400 900\n"
1181
+ " IN NS ns\n"
1182
+ "ns IN A 203.0.113.53\n"
1183
+ "ns IN AAAA 2001:db8:feed:beef::53\n"
1184
+ "\n"
1185
+ "0000000 IN A 192.0.2.0\n"
1186
+ "0000000 IN TYPE994 \\# 6 303132333435\n"
1187
+ "0000001 IN A 192.0.2.1\n"
1188
+ "0000001 IN TYPE994 \\# 7 30313233343536\n"
1189
+ "0000002 IN A 192.0.2.2\n"
1190
+ "0000002 IN TYPE994 \\# 8 3031323334353637\n"
1191
+ "0000003 IN A 192.0.2.3\n"
1192
+ "0000003 IN TYPE994 \\# 9 303132333435363738\n"
1193
+ "0000004 IN A 192.0.2.4\n"
1194
+ "0000004 IN TYPE994 \\# 10 30313233343536373839\n"
1195
+ "0000005 IN A 192.0.2.5\n"
1196
+ "0000005 IN TYPE994 \\# 11 3031323334353637383961\n"
1197
+ "0000006 IN A 192.0.2.6\n"
1198
+ "0000006 IN TYPE994 \\# 12 303132333435363738396162\n"
1199
+ "0000007 IN A 192.0.2.7\n"
1200
+ "0000007 IN TYPE994 \\# 13 30313233343536373839616263\n"
1201
+ );
1202
+ static uint8_t origin [] = { 0 };
1203
+ zone_parser_t parser ;
1204
+ zone_name_buffer_t name ;
1205
+ zone_rdata_buffer_t rdata ;
1206
+ zone_buffers_t buffers = { 1 , & name , & rdata };
1207
+ zone_options_t options ;
1208
+ int32_t result ;
1209
+ (void ) state ;
1210
+
1211
+ memset (& options , 0 , sizeof (options ));
1212
+ options .accept .callback = contiguous_escaped_start_cb ;
1213
+ options .origin .octets = origin ;
1214
+ options .origin .length = sizeof (origin );
1215
+ options .default_ttl = 3600 ;
1216
+ options .default_class = ZONE_CLASS_IN ;
1217
+
1218
+ result = zone_parse_string (& parser , & options , & buffers , zone , strlen (zone ),
1219
+ NULL );
1220
+ assert_int_equal (result , ZONE_SUCCESS );
1221
+ }
0 commit comments