~ubuntu-branches/ubuntu/saucy/maradns/saucy

« back to all changes in this revision

Viewing changes to parse/Csv2_parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Kai Hendry
  • Date: 2006-10-09 17:44:21 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061009174421-yb151elg3m4t5shl
Tags: 1.2.12.03-1
* New upstream release with many new doc tweaks. Though most of the changes
  are with the webpages which I have chosen not to distribute as you can
  read them all rather online at http://maradns.org/
* The diffs in the Makefiles are due to upstream's configure script
* Added bind2csv2.py as an example from upstream's tools/
  There is a lot of little scripts in tools/ which can probably join this

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        return (in >= '0' && in <= '9');
62
62
}
63
63
 
 
64
/* This function is designed to tell us if the character in question 
 
65
 * is a number or slash */
 
66
 
 
67
int csv2_is_number_orslash(int32 in) {
 
68
        return (in >= '0' && in <= '9') || in == '/';
 
69
}
 
70
 
64
71
/* This function is designed to tell us if the character in question is
65
72
 * an uppercase letter */
66
73
 
543
550
        return (csv2_is_text(in) || in == '%');
544
551
}
545
552
 
 
553
/* Match on [0-9a-zA-Z\-\_\.] or anything utf-8 */
 
554
int csv2_is_fchar(int32 in) {
 
555
        return (csv2_is_text(in) || in == '.');
 
556
}
 
557
 
546
558
/* Match on [0-9a-zA-Z\-\_\*\%] or anything utf-8 */
547
559
int csv2_is_starwhitis(int32 in) {
548
560
        return (csv2_is_text(in) || in == '*' || in == '%');
549
561
}
550
562
 
 
563
/* Match on [0-9a-zA-Z\-\_\*\%\/] or anything utf-8 */
 
564
int csv2_is_starwhitis_orslash(int32 in) {
 
565
        return (csv2_is_text(in) || in == '*' || in == '%' || in == '/');
 
566
}
 
567
 
551
568
/* Process number: Process a number that is coming in on the input stream
552
569
 * Input: The stream we want to get the number from (we've already seen
553
570
 *        the first digit of said number)
899
916
        if(js_qissame("fqdn4",text_rtype) == 1) {
900
917
                return 65765;
901
918
        }
 
919
        /* Obscure RR types follow */
 
920
        /* Obscure RFC1035 RR types */
 
921
        if(js_qissame("hinfo",text_rtype) == 1) {
 
922
                return RR_HINFO;
 
923
        }
 
924
        if(js_qissame("wks",text_rtype) == 1) {
 
925
                return RR_WKS;
 
926
        }
 
927
        if(js_qissame("mb",text_rtype) == 1) {
 
928
                return RR_MB;
 
929
        }
 
930
        if(js_qissame("md",text_rtype) == 1) {
 
931
                return RR_MD;
 
932
        }
 
933
        if(js_qissame("mf",text_rtype) == 1) {
 
934
                return RR_MF;
 
935
        }
 
936
        if(js_qissame("mg",text_rtype) == 1) {
 
937
                return RR_MG;
 
938
        }
 
939
        if(js_qissame("mr",text_rtype) == 1) {
 
940
                return RR_MR;
 
941
        }
 
942
        if(js_qissame("minfo",text_rtype) == 1) {
 
943
                return RR_MINFO;
 
944
        }
 
945
        /* Obscure RFC1183 data types follow */
 
946
        if(js_qissame("afsdb",text_rtype) == 1) {
 
947
                return RR_AFSDB;
 
948
        }
 
949
        if(js_qissame("rp",text_rtype) == 1) {
 
950
                return RR_RP;
 
951
        }
 
952
        if(js_qissame("x25",text_rtype) == 1) {
 
953
                return RR_X25;
 
954
        }
 
955
        if(js_qissame("isdn",text_rtype) == 1) {
 
956
                return RR_ISDN;
 
957
        }
 
958
        if(js_qissame("rt",text_rtype) == 1) {
 
959
                return RR_RT;
 
960
        }
 
961
        /* Obscure RFC1706 RRs follow */
 
962
        if(js_qissame("nsap",text_rtype) == 1) {
 
963
                return RR_NSAP;
 
964
        }
 
965
        if(js_qissame("nsap-ptr",text_rtype) == 1) {
 
966
                return RR_NSAP_PTR;
 
967
        }
 
968
        /* Obscure RFC2163 RR */
 
969
        if(js_qissame("px",text_rtype) == 1) {
 
970
                return RR_PX;
 
971
        }
 
972
        /* Obscure RFC1712 RR */
 
973
        if(js_qissame("gpos",text_rtype) == 1) {
 
974
                return RR_GPOS;
 
975
        }
 
976
        /* Almost obscure RFC1876 RR */
 
977
        if(js_qissame("loc",text_rtype) == 1) {
 
978
                return RR_LOC;
 
979
        }
902
980
        return -1;
903
981
}
904
982
 
924
1002
                                return -1;
925
1003
                        }
926
1004
                        ret = csv2_get_num(stream);
927
 
                        if(ret == -1) {
 
1005
                        if(ret < 0) {
928
1006
                                return -1;
929
1007
                        }
930
1008
                        ret += 100000;
939
1017
        return ret;
940
1018
}       
941
1019
 
942
 
/* Get a number from the stream; return a -1 on error */
 
1020
/* Get a number from the stream; return a -1 on error, -2 if they
 
1021
 * specified '/serial' */
943
1022
int32 csv2_get_num(csv2_read *stream) {
944
1023
        js_string *num;
945
1024
        int32 ret;
946
1025
 
947
 
        if(csv2_get_1st(stream,csv2_is_number,0) != JS_SUCCESS) {
 
1026
        if(csv2_get_1st(stream,csv2_is_number_orslash,0) != JS_SUCCESS) {
948
1027
                return -1;
949
1028
        }
 
1029
 
 
1030
        /* '/serial' gets special treatment and returns -2 */
 
1031
        if(csv2_justread(stream) == '/') {
 
1032
                if(csv2_read_unicode(stream) != 's') {
 
1033
                        return -1;
 
1034
                }
 
1035
                if(csv2_read_unicode(stream) != 'e') {
 
1036
                        return -1;
 
1037
                }
 
1038
                if(csv2_read_unicode(stream) != 'r') {
 
1039
                        return -1;
 
1040
                }
 
1041
                if(csv2_read_unicode(stream) != 'i') {
 
1042
                        return -1;
 
1043
                }
 
1044
                if(csv2_read_unicode(stream) != 'a') {
 
1045
                        return -1;
 
1046
                }
 
1047
                if(csv2_read_unicode(stream) != 'l') {
 
1048
                        return -1;
 
1049
                }
 
1050
                if(!csv2_is_delimiter(csv2_read_unicode(stream))) {
 
1051
                        return -1;
 
1052
                }
 
1053
                return -2;
 
1054
        }
 
1055
                        
950
1056
        if((num = process_number(stream)) == 0) {
951
1057
                return -1;
952
1058
        }
963
1069
        return ret;
964
1070
}
965
1071
 
 
1072
/* Your generic swiss-army-knife "get a stream of characters from the
 
1073
 * file and make a js_string out of it function"; bascially, we use
 
1074
 * a pointer to the is_ok function to determine what characters we put
 
1075
 * in the output string, then we get that string from the stream (skipping
 
1076
 * whitespace, etc.) */
 
1077
 
 
1078
js_string *csv2_get_something(csv2_read *stream, int (*is_ok)(int32 in)) {
 
1079
        js_string *o;
 
1080
        
 
1081
        if(csv2_get_1st(stream,is_ok,0) != JS_SUCCESS) {
 
1082
                return 0;
 
1083
        }
 
1084
 
 
1085
        if((o = process_something(stream,is_ok)) == 0) {
 
1086
                return 0;
 
1087
        }
 
1088
 
 
1089
        return o;
 
1090
}
 
1091
 
 
1092
/* We can use the above function to get things like filenames */
 
1093
js_string *csv2_get_filename(csv2_read *stream) {
 
1094
        return csv2_get_something(stream,csv2_is_fchar);
 
1095
}
 
1096
        
966
1097
/* Get a record that is in DNAME form; 0 is error;
967
1098
 * this function is currently *not* called anywhere
968
1099
 */
978
1109
        return csv2_get_hostname(stream,0,1);
979
1110
}
980
1111
 
981
 
/* Get a mx record; 0 is error */
 
1112
/* Get a mx record; 0 is error.  Pref makes this record more flexible;
 
1113
 * if this number is 0 or higher, instead of reading the pref from the
 
1114
 * zone file, the pref is set to the value given the function.  If pref
 
1115
 * is -1, this is treated as a normal MX record.  Is pref is -2, we read
 
1116
 * two instead of one host label (for the obscure PX record) */
982
1117
 
983
 
js_string *csv2_get_mx(csv2_read *stream, js_string *zone) {
 
1118
js_string *csv2_get_mx(csv2_read *stream, js_string *zone, int pref) {
984
1119
        js_string *out;
985
 
        js_string *name;
986
1120
        int num;
 
1121
        int hlabels = 1;
987
1122
 
988
1123
        /* Get the priority */
989
 
        if((num = csv2_get_num(stream)) < 0) {
990
 
                return 0;
 
1124
        if(pref < 0) {
 
1125
                if((num = csv2_get_num(stream)) < 0) {
 
1126
                        return 0;
 
1127
                }
 
1128
        } else {
 
1129
                num = pref;
991
1130
        }
992
1131
        if((out = js_create(256,1)) == 0) {
993
1132
                return 0;
997
1136
                return 0;
998
1137
        }
999
1138
 
 
1139
        if(pref == -2) {
 
1140
                hlabels = 2;
 
1141
        }
 
1142
 
1000
1143
        /* And the MX host name */
1001
 
        if(csv2_get_1st(stream,csv2_is_dchar,0) != JS_SUCCESS) {
1002
 
                js_destroy(out); 
1003
 
                return 0;
1004
 
        }
1005
 
        if((name = csv2_get_hostname(stream,zone,3)) == 0) {
1006
 
                js_destroy(out); 
1007
 
                return 0;
1008
 
        }
1009
 
        if(js_append(name,out) == JS_ERROR) {
 
1144
        while(hlabels > 0) {
 
1145
                js_string *name;
 
1146
                if(csv2_get_1st(stream,csv2_is_dchar,0) != JS_SUCCESS) {
 
1147
                        js_destroy(out); 
 
1148
                        return 0;
 
1149
                }
 
1150
                if((name = csv2_get_hostname(stream,zone,3)) == 0) {
 
1151
                        js_destroy(out); 
 
1152
                        return 0;
 
1153
                }
 
1154
                if(js_append(name,out) == JS_ERROR) {
 
1155
                        js_destroy(name);
 
1156
                        js_destroy(out);
 
1157
                        return 0;
 
1158
                }
1010
1159
                js_destroy(name);
1011
 
                js_destroy(out);
1012
 
                return 0;
 
1160
                hlabels--;
1013
1161
        }
1014
1162
 
1015
 
        js_destroy(name);
1016
1163
        return out;
1017
1164
 
1018
1165
}
1071
1218
        int32 ttl = 86400;
1072
1219
        int32 rtype;
1073
1220
        int q;
 
1221
        int slash_command = 0;
1074
1222
 
1075
1223
        /* Sanity checks */
1076
1224
        if(state->bighash == 0 && state->add_method == 1) {
1079
1227
        if(state->zone == 0) {
1080
1228
                return JS_ERROR;
1081
1229
        }
1082
 
 
1083
 
        zone = state->zone;
1084
 
 
1085
 
        /* The host name must be at the begining of a line (or the file) */
1086
 
        q = csv2_get_1st(stream, csv2_is_starwhitis,1);
1087
 
 
1088
 
        if(q == -2) {
1089
 
                return -2;
1090
 
        }
1091
 
 
1092
 
        if(q == JS_ERROR) {
1093
 
                return -1;
1094
 
        }
 
1230
        if(state->origin == 0) {
 
1231
                return JS_ERROR;
 
1232
        }
 
1233
 
 
1234
        zone = state->origin;
 
1235
 
 
1236
        /* We read look for the beginning of the host name; this is made
 
1237
         * more complicated that the "host name" may actually be a
 
1238
         * special command, such as on that changes the origin (hostname
 
1239
         * to substitute '%' with) or TTL */
 
1240
 
 
1241
        do {
 
1242
                slash_command = 0;
 
1243
 
 
1244
                /* The host name must be at the begining of a line 
 
1245
                 * (or the file) */
 
1246
                q = csv2_get_1st(stream, csv2_is_starwhitis_orslash,1);
 
1247
 
 
1248
                if(q == -2) {
 
1249
                        return -2;
 
1250
                }
 
1251
 
 
1252
                if(q == JS_ERROR) {
 
1253
                        return -1;
 
1254
                }
 
1255
 
 
1256
                /* Process the slash commands (currently only '/origin' and
 
1257
                 * '/ttl') */
 
1258
                if(csv2_justread(stream) == '/') {
 
1259
                        int32 look, cmd;
 
1260
                        slash_command = 1;
 
1261
                        look = csv2_read_unicode(stream);
 
1262
                        if(look == 't') {
 
1263
                                cmd = 1; /* ttl */
 
1264
                        } else if(look == 'o') {
 
1265
                                cmd = 2; /* origin */
 
1266
                        } else if(look == 'r') {
 
1267
                                cmd = 5; /* read */
 
1268
                        } else {
 
1269
                                csv2_error(stream,"Invalid slash command");
 
1270
                                return -1; /* error */
 
1271
                        }
 
1272
 
 
1273
                        look = csv2_read_unicode(stream);
 
1274
                        if(cmd == 2 && look == 'p') { /* opush/opop */
 
1275
                                cmd = 3; /* opush */
 
1276
                        } else if((cmd == 1 && look != 't') || (cmd == 2 &&
 
1277
                            look != 'r') || (cmd == 5 && look != 'e')) {
 
1278
                                csv2_error(stream,"Invalid slash command");
 
1279
                                return -1;
 
1280
                        }
 
1281
                        
 
1282
                        look = csv2_read_unicode(stream);
 
1283
                        if(cmd == 3 && look == 'o') {
 
1284
                                cmd = 4; /* opop */
 
1285
                        } else if((cmd == 1 && look != 'l') || (cmd == 2 &&
 
1286
                            look != 'i') || (cmd == 3 && look != 'u') ||
 
1287
                            (cmd == 5 && look != 'a')) {
 
1288
                                csv2_error(stream,"Invalid slash command");
 
1289
                                return -1;
 
1290
                        }
 
1291
 
 
1292
                        look = csv2_read_unicode(stream);
 
1293
                        if(cmd == 1 && csv2_is_delimiter(look)) {
 
1294
                                int newttl;
 
1295
                                newttl = csv2_get_num(stream);
 
1296
                                if(newttl < 0) {
 
1297
                                        csv2_error(stream,
 
1298
                                            "Invalid slash command");
 
1299
                                        return -1;
 
1300
                                }
 
1301
                                state->default_ttl = newttl;
 
1302
                        } else if(cmd == 2 && look == 'g') {
 
1303
                                js_string *n;
 
1304
                                if(csv2_read_unicode(stream) != 'i') {
 
1305
                                        csv2_error(stream,
 
1306
                                            "Invalid slash command");
 
1307
                                        return -1;
 
1308
                                }
 
1309
                                if(csv2_read_unicode(stream) != 'n') {
 
1310
                                        csv2_error(stream,
 
1311
                                            "Invalid slash command");
 
1312
                                        return -1;
 
1313
                                }
 
1314
                                look = csv2_read_unicode(stream);
 
1315
                                if(!csv2_is_delimiter(look)) {
 
1316
                                        csv2_error(stream,
 
1317
                                            "Invalid slash command");
 
1318
                                        return -1;
 
1319
                                }
 
1320
                                if(csv2_get_1st(stream,csv2_is_dchar,0) !=
 
1321
                                    JS_SUCCESS) {
 
1322
                                        csv2_error(stream, 
 
1323
                                        "Invalid argument for /origin");
 
1324
                                        return -1;
 
1325
                                }
 
1326
                                n = process_1stchar(stream,
 
1327
                                        csv2_is_starwhitis,0);
 
1328
                                if(n == 0) {
 
1329
                                        csv2_error(stream, 
 
1330
                                        "Error processing /origin");
 
1331
                                        return -1;
 
1332
                                }
 
1333
                                n = js_append_dname(n, stream, 3);
 
1334
                                if(csv2_convert_percent(n,state->origin) 
 
1335
                                    == 0) {
 
1336
                                        csv2_error(stream,
 
1337
                                        "Problem running convert_percent");
 
1338
                                        return -1;
 
1339
                                }
 
1340
                                if(n == 0) {
 
1341
                                        csv2_error(stream, 
 
1342
                                        "Invalid argument for /origin");
 
1343
                                        return -1;
 
1344
                                }
 
1345
                                js_destroy(state->origin);
 
1346
                                state->origin = n;
 
1347
                                zone = n;
 
1348
                        } else if(cmd == 3 && look == 's') {
 
1349
                                js_string *n;
 
1350
                                csv2_origin *c, *o;
 
1351
                                if(csv2_read_unicode(stream) != 'h') {
 
1352
                                        csv2_error(stream,
 
1353
                                            "Invalid slash command");
 
1354
                                        return -1;
 
1355
                                }       
 
1356
                                look = csv2_read_unicode(stream);
 
1357
                                if(!csv2_is_delimiter(look)) {
 
1358
                                        csv2_error(stream,
 
1359
                                            "Invalid slash command");
 
1360
                                        return -1;
 
1361
                                }       
 
1362
                                if(csv2_get_1st(stream,csv2_is_dchar,0) !=
 
1363
                                    JS_SUCCESS) {
 
1364
                                        csv2_error(stream, 
 
1365
                                        "Invalid argument for /opush");
 
1366
                                        return -1;
 
1367
                                }
 
1368
                                n = process_1stchar(stream,
 
1369
                                        csv2_is_starwhitis,0);
 
1370
                                if(n == 0) {
 
1371
                                        csv2_error(stream, 
 
1372
                                        "Error processing /opush");
 
1373
                                        return -1;
 
1374
                                }
 
1375
                                n = js_append_dname(n, stream, 3);
 
1376
                                if(csv2_convert_percent(n,state->origin) 
 
1377
                                    == 0) {
 
1378
                                        csv2_error(stream,
 
1379
                                        "Problem running convert_percent");
 
1380
                                        return -1;
 
1381
                                }
 
1382
                                if(n == 0) {
 
1383
                                        csv2_error(stream, 
 
1384
                                        "Invalid argument for /opush");
 
1385
                                        return -1;
 
1386
                                }
 
1387
                                /* Now, see if there is room on the stack */
 
1388
                                if(state->ostack_height > 7 ||
 
1389
                                   state->ostack_height < 0) {
 
1390
                                        csv2_error(stream, 
 
1391
                                        "origin stack too high");
 
1392
                                        return -1;
 
1393
                                }
 
1394
                                /* OK, there is room; push the current
 
1395
                                 * origin on the stack and replace it with
 
1396
                                 * the new value */
 
1397
                                state->ostack_height++;
 
1398
                                o = state->ostack;
 
1399
                                c = js_alloc(1,sizeof(csv2_origin));
 
1400
                                if(c == 0) {
 
1401
                                        csv2_error(stream,
 
1402
                                        "js_alloc error");
 
1403
                                        return -1;
 
1404
                                }
 
1405
                                c->origin = state->origin;
 
1406
                                c->next = o;
 
1407
                                state->ostack = c;
 
1408
                                state->origin = n;
 
1409
                                zone = state->origin;
 
1410
                        } else if(cmd == 4 && look == 'p') {
 
1411
                                csv2_origin *o;
 
1412
                                look = csv2_read_unicode(stream);
 
1413
                                if(!csv2_is_delimiter(look)) {
 
1414
                                        csv2_error(stream,
 
1415
                                            "Invalid slash command");
 
1416
                                        return -1;
 
1417
                                }
 
1418
                                if(state->ostack_height < 1 || 
 
1419
                                   state->ostack_height > 8) {
 
1420
                                       csv2_error(stream,
 
1421
                                           "origin stack too low");
 
1422
                                        return -1;
 
1423
                                }
 
1424
                                if(state->ostack == 0) {
 
1425
                                        csv2_error(stream,
 
1426
                                            "origin stack empty");
 
1427
                                        return -1;
 
1428
                                }
 
1429
                                /* OK, pop the top value from the origin
 
1430
                                 * stack and make it the origin value */
 
1431
                                o = state->ostack;
 
1432
                                js_destroy(state->origin);
 
1433
                                state->ostack = o->next;
 
1434
                                state->origin = o->origin;
 
1435
                                zone = state->origin;
 
1436
                                js_dealloc(o);
 
1437
                        } else if(cmd == 5 && look == 'd') {
 
1438
                                js_string *filename;
 
1439
                                look = csv2_read_unicode(stream);
 
1440
                                if(!csv2_is_delimiter(look)) {
 
1441
                                        csv2_error(stream,
 
1442
                                            "Invalid slash command");
 
1443
                                        return -1;
 
1444
                                }
 
1445
                                filename = csv2_get_filename(stream);
 
1446
                                csv2_push_file(stream,filename);
 
1447
                                js_destroy(filename);
 
1448
                        } else {
 
1449
                                csv2_error(stream,"Invalid slash command");
 
1450
                                return -1;
 
1451
                        }
 
1452
                        
 
1453
                }
 
1454
 
 
1455
        } while(slash_command == 1);
1095
1456
 
1096
1457
        /* If star records are allowed at the end of
1097
1458
         * hostnames, we make the third argument of csv2_get_hostname have
1121
1482
                return -1;
1122
1483
        }
1123
1484
 
1124
 
        ttl = 86400;
 
1485
        ttl = state->default_ttl;
1125
1486
        /* If we saw a +, process this field as a TTL */
1126
1487
        if(csv2_justread(stream) == '+') {
1127
1488
                if(csv2_read_unicode(stream) < 0) {
1129
1490
                        csv2_error(stream, "Unexpected char around +");
1130
1491
                        return -1;
1131
1492
                }
1132
 
                if((ttl = csv2_get_num(stream)) == -1) {
 
1493
                if((ttl = csv2_get_num(stream)) < 0) {
1133
1494
                        js_destroy(name);
1134
1495
                        csv2_error(stream,"Problem getting TTL");
1135
1496
                        return -1;
1181
1542
                        rddata = csv2_get_aaaa(stream);
1182
1543
                        break;
1183
1544
                case RR_SOA:
1184
 
                        rddata = csv2_get_soa(stream,zone);
 
1545
                        rddata = csv2_get_soa(stream,zone,state);
1185
1546
                        break;
1186
1547
                case RR_MX:
1187
 
                        rddata = csv2_get_mx(stream,zone);
 
1548
                case RR_AFSDB:
 
1549
                case RR_RT:
 
1550
                        rddata = csv2_get_mx(stream,zone,-1);
1188
1551
                        break;
1189
1552
                case RR_SRV:
1190
1553
                        rddata = csv2_get_srv(stream,zone);
1191
1554
                        break;
1192
1555
                case RR_TXT:
 
1556
                case RR_X25:
 
1557
                case RR_ISDN:
1193
1558
                case RR_SPF:
1194
 
                        rddata = csv2_get_txt(stream);
 
1559
                        rddata = csv2_get_txt(stream,0);
 
1560
                        break;
 
1561
                case RR_MG:
 
1562
                case RR_MR:
 
1563
                        rddata = csv2_get_mbox(stream,zone,1);
 
1564
                        break;
 
1565
                case RR_MINFO:
 
1566
                case RR_RP:
 
1567
                        rddata = csv2_get_mbox(stream,zone,2);
1195
1568
                        break;
1196
1569
                case RR_NS:
1197
1570
                case RR_CNAME:
1198
1571
                case RR_PTR:
 
1572
                case RR_NSAP_PTR:
 
1573
                case RR_MB:
1199
1574
                        if(csv2_get_1st(stream,csv2_is_dchar,0) != 
1200
1575
                                        JS_SUCCESS) {
1201
1576
                                return -1;
1207
1582
                             * PTR record */
1208
1583
                        rddata = csv2_get_a(stream);
1209
1584
                        break;
 
1585
                /* Obscure RRs follow */
 
1586
                case RR_HINFO:
 
1587
                        rddata = csv2_get_txt(stream,2);
 
1588
                        break;
 
1589
                case RR_WKS:
 
1590
                        rddata = csv2_get_wks(stream);
 
1591
                        break;
 
1592
                case RR_MD:
 
1593
                        /* As per RFC1035 §3.3.4; handle this as an MX with
 
1594
                         * priority 0 */
 
1595
                        rddata = csv2_get_mx(stream,zone,0);
 
1596
                        rtype = RR_MX;
 
1597
                        break;
 
1598
                case RR_MF:
 
1599
                        /* As per RFC1035 §3.3.5; handle this as an MX with
 
1600
                         * priority 10 */
 
1601
                        rddata = csv2_get_mx(stream,zone,10);
 
1602
                        rtype = RR_MX;
 
1603
                        break;
 
1604
                case RR_NSAP:
 
1605
                        rddata = csv2_get_hex(stream);
 
1606
                        break;
 
1607
                case RR_PX:
 
1608
                        rddata = csv2_get_mx(stream,zone,-2);
 
1609
                        break;
 
1610
                case RR_GPOS:
 
1611
                        rddata = csv2_get_txt(stream,3);
 
1612
                        break;
 
1613
                case RR_LOC:
 
1614
                        rddata = csv2_get_loc(stream);
 
1615
                        break;
1210
1616
                default:
 
1617
                        /* RAW rtype */
1211
1618
                        if(rtype >= 100000 && rtype <= 165535) {
1212
1619
                                rtype -= 100000;
1213
1620
                                if(rtype == RR_ANY) {
1214
1621
                                        csv2_error(stream,
1215
1622
                                  "ANY (255) record type isn't for data");
1216
 
                                } else if(rtype == 251) {
 
1623
                                } else if(rtype == RR_IXFR) {
1217
1624
                                        csv2_error(stream,
1218
1625
                                  "IXFR (251) record type isn't for data");
1219
 
                                } else if(rtype == 252) {
 
1626
                                } else if(rtype == RR_AXFR) {
1220
1627
                                        csv2_error(stream,
1221
1628
                                  "AXFR (252) record type isn't for data");
 
1629
                                } else if(rtype == RR_MAILB) {
 
1630
                                        csv2_error(stream,
 
1631
                                  "MAILB record type isn't for data");
 
1632
                                } else if(rtype == RR_MAILA) {
 
1633
                                        csv2_error(stream,
 
1634
                                  "MAILA record type isn't for data");
 
1635
                                } else if(rtype == RR_A6) {
 
1636
                                        csv2_error(stream,
 
1637
                                  "MaraDNS doesn't allow A6 records");
 
1638
                                } else if(rtype == RR_DNAME) {
 
1639
                                        csv2_error(stream,
 
1640
                                  "MaraDNS doesn't allow DNAME records");
 
1641
                                } else if(rtype == RR_OPT) {
 
1642
                                        csv2_error(stream,
 
1643
                                  "OPT record type isn't for zone files");
1222
1644
                                } else {
1223
1645
                                    rddata = csv2_get_raw(stream);
1224
1646
                                }