[BACK]Return to named-checkzone.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / mpl / bind / dist / bin / check

Annotation of src/external/mpl/bind/dist/bin/check/named-checkzone.c, Revision 1.1

1.1     ! christos    1: /*     $NetBSD$        */
        !             2:
        !             3: /*
        !             4:  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
        !             5:  *
        !             6:  * This Source Code Form is subject to the terms of the Mozilla Public
        !             7:  * License, v. 2.0. If a copy of the MPL was not distributed with this
        !             8:  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
        !             9:  *
        !            10:  * See the COPYRIGHT file distributed with this work for additional
        !            11:  * information regarding copyright ownership.
        !            12:  */
        !            13:
        !            14:
        !            15: /*! \file */
        !            16:
        !            17: #include <config.h>
        !            18:
        !            19: #include <stdlib.h>
        !            20:
        !            21: #include <isc/app.h>
        !            22: #include <isc/commandline.h>
        !            23: #include <isc/dir.h>
        !            24: #include <isc/entropy.h>
        !            25: #include <isc/hash.h>
        !            26: #include <isc/log.h>
        !            27: #include <isc/mem.h>
        !            28: #include <isc/print.h>
        !            29: #include <isc/socket.h>
        !            30: #include <isc/string.h>
        !            31: #include <isc/task.h>
        !            32: #include <isc/timer.h>
        !            33: #include <isc/util.h>
        !            34:
        !            35: #include <dns/db.h>
        !            36: #include <dns/fixedname.h>
        !            37: #include <dns/log.h>
        !            38: #include <dns/master.h>
        !            39: #include <dns/masterdump.h>
        !            40: #include <dns/name.h>
        !            41: #include <dns/rdataclass.h>
        !            42: #include <dns/rdataset.h>
        !            43: #include <dns/result.h>
        !            44: #include <dns/types.h>
        !            45: #include <dns/zone.h>
        !            46:
        !            47: #include "check-tool.h"
        !            48:
        !            49: static int quiet = 0;
        !            50: static isc_mem_t *mctx = NULL;
        !            51: static isc_entropy_t *ectx = NULL;
        !            52: dns_zone_t *zone = NULL;
        !            53: dns_zonetype_t zonetype = dns_zone_master;
        !            54: static int dumpzone = 0;
        !            55: static const char *output_filename;
        !            56: static const char *prog_name = NULL;
        !            57: static const dns_master_style_t *outputstyle = NULL;
        !            58: static enum { progmode_check, progmode_compile } progmode;
        !            59:
        !            60: #define ERRRET(result, function) \
        !            61:        do { \
        !            62:                if (result != ISC_R_SUCCESS) { \
        !            63:                        if (!quiet) \
        !            64:                                fprintf(stderr, "%s() returned %s\n", \
        !            65:                                        function, dns_result_totext(result)); \
        !            66:                        return (result); \
        !            67:                } \
        !            68:        } while (0)
        !            69:
        !            70: ISC_PLATFORM_NORETURN_PRE static void
        !            71: usage(void) ISC_PLATFORM_NORETURN_POST;
        !            72:
        !            73: static void
        !            74: usage(void) {
        !            75:        fprintf(stderr,
        !            76:                "usage: %s [-djqvD] [-c class] "
        !            77:                "[-f inputformat] [-F outputformat] [-J filename] "
        !            78:                "[-t directory] [-w directory] [-k (ignore|warn|fail)] "
        !            79:                "[-n (ignore|warn|fail)] [-m (ignore|warn|fail)] "
        !            80:                "[-r (ignore|warn|fail)] "
        !            81:                "[-i (full|full-sibling|local|local-sibling|none)] "
        !            82:                "[-M (ignore|warn|fail)] [-S (ignore|warn|fail)] "
        !            83:                "[-W (ignore|warn)] "
        !            84:                "%s zonename filename\n",
        !            85:                prog_name,
        !            86:                progmode == progmode_check ? "[-o filename]" : "-o filename");
        !            87:        exit(1);
        !            88: }
        !            89:
        !            90: static void
        !            91: destroy(void) {
        !            92:        if (zone != NULL)
        !            93:                dns_zone_detach(&zone);
        !            94:        dns_name_destroy();
        !            95: }
        !            96:
        !            97: /*% main processing routine */
        !            98: int
        !            99: main(int argc, char **argv) {
        !           100:        int c;
        !           101:        char *origin = NULL;
        !           102:        char *filename = NULL;
        !           103:        isc_log_t *lctx = NULL;
        !           104:        isc_result_t result;
        !           105:        char classname_in[] = "IN";
        !           106:        char *classname = classname_in;
        !           107:        const char *workdir = NULL;
        !           108:        const char *inputformatstr = NULL;
        !           109:        const char *outputformatstr = NULL;
        !           110:        dns_masterformat_t inputformat = dns_masterformat_text;
        !           111:        dns_masterformat_t outputformat = dns_masterformat_text;
        !           112:        dns_masterrawheader_t header;
        !           113:        isc_uint32_t rawversion = 1, serialnum = 0;
        !           114:        dns_ttl_t maxttl = 0;
        !           115:        isc_boolean_t snset = ISC_FALSE;
        !           116:        isc_boolean_t logdump = ISC_FALSE;
        !           117:        FILE *errout = stdout;
        !           118:        char *endp;
        !           119:
        !           120:        /*
        !           121:         * Uncomment the following line if memory debugging is needed:
        !           122:         * isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
        !           123:         */
        !           124:
        !           125:        outputstyle = &dns_master_style_full;
        !           126:
        !           127:        prog_name = strrchr(argv[0], '/');
        !           128:        if (prog_name == NULL)
        !           129:                prog_name = strrchr(argv[0], '\\');
        !           130:        if (prog_name != NULL)
        !           131:                prog_name++;
        !           132:        else
        !           133:                prog_name = argv[0];
        !           134:        /*
        !           135:         * Libtool doesn't preserve the program name prior to final
        !           136:         * installation.  Remove the libtool prefix ("lt-").
        !           137:         */
        !           138:        if (strncmp(prog_name, "lt-", 3) == 0)
        !           139:                prog_name += 3;
        !           140:
        !           141: #define PROGCMP(X) \
        !           142:        (strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0)
        !           143:
        !           144:        if (PROGCMP("named-checkzone"))
        !           145:                progmode = progmode_check;
        !           146:        else if (PROGCMP("named-compilezone"))
        !           147:                progmode = progmode_compile;
        !           148:        else
        !           149:                INSIST(0);
        !           150:
        !           151:        /* Compilation specific defaults */
        !           152:        if (progmode == progmode_compile) {
        !           153:                zone_options |= (DNS_ZONEOPT_CHECKNS |
        !           154:                                 DNS_ZONEOPT_FATALNS |
        !           155:                                 DNS_ZONEOPT_CHECKSPF |
        !           156:                                 DNS_ZONEOPT_CHECKDUPRR |
        !           157:                                 DNS_ZONEOPT_CHECKNAMES |
        !           158:                                 DNS_ZONEOPT_CHECKNAMESFAIL |
        !           159:                                 DNS_ZONEOPT_CHECKWILDCARD);
        !           160:        } else
        !           161:                zone_options |= (DNS_ZONEOPT_CHECKDUPRR |
        !           162:                                 DNS_ZONEOPT_CHECKSPF);
        !           163:
        !           164: #define ARGCMP(X) (strcmp(isc_commandline_argument, X) == 0)
        !           165:
        !           166:        isc_commandline_errprint = ISC_FALSE;
        !           167:
        !           168:        while ((c = isc_commandline_parse(argc, argv,
        !           169:                               "c:df:hi:jJ:k:L:l:m:n:qr:s:t:o:vw:DF:M:S:T:W:"))
        !           170:               != EOF) {
        !           171:                switch (c) {
        !           172:                case 'c':
        !           173:                        classname = isc_commandline_argument;
        !           174:                        break;
        !           175:
        !           176:                case 'd':
        !           177:                        debug++;
        !           178:                        break;
        !           179:
        !           180:                case 'i':
        !           181:                        if (ARGCMP("full")) {
        !           182:                                zone_options |= DNS_ZONEOPT_CHECKINTEGRITY |
        !           183:                                                DNS_ZONEOPT_CHECKSIBLING;
        !           184:                                docheckmx = ISC_TRUE;
        !           185:                                docheckns = ISC_TRUE;
        !           186:                                dochecksrv = ISC_TRUE;
        !           187:                        } else if (ARGCMP("full-sibling")) {
        !           188:                                zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
        !           189:                                zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
        !           190:                                docheckmx = ISC_TRUE;
        !           191:                                docheckns = ISC_TRUE;
        !           192:                                dochecksrv = ISC_TRUE;
        !           193:                        } else if (ARGCMP("local")) {
        !           194:                                zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
        !           195:                                zone_options |= DNS_ZONEOPT_CHECKSIBLING;
        !           196:                                docheckmx = ISC_FALSE;
        !           197:                                docheckns = ISC_FALSE;
        !           198:                                dochecksrv = ISC_FALSE;
        !           199:                        } else if (ARGCMP("local-sibling")) {
        !           200:                                zone_options |= DNS_ZONEOPT_CHECKINTEGRITY;
        !           201:                                zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
        !           202:                                docheckmx = ISC_FALSE;
        !           203:                                docheckns = ISC_FALSE;
        !           204:                                dochecksrv = ISC_FALSE;
        !           205:                        } else if (ARGCMP("none")) {
        !           206:                                zone_options &= ~DNS_ZONEOPT_CHECKINTEGRITY;
        !           207:                                zone_options &= ~DNS_ZONEOPT_CHECKSIBLING;
        !           208:                                docheckmx = ISC_FALSE;
        !           209:                                docheckns = ISC_FALSE;
        !           210:                                dochecksrv = ISC_FALSE;
        !           211:                        } else {
        !           212:                                fprintf(stderr, "invalid argument to -i: %s\n",
        !           213:                                        isc_commandline_argument);
        !           214:                                exit(1);
        !           215:                        }
        !           216:                        break;
        !           217:
        !           218:                case 'f':
        !           219:                        inputformatstr = isc_commandline_argument;
        !           220:                        break;
        !           221:
        !           222:                case 'F':
        !           223:                        outputformatstr = isc_commandline_argument;
        !           224:                        break;
        !           225:
        !           226:                case 'j':
        !           227:                        nomerge = ISC_FALSE;
        !           228:                        break;
        !           229:
        !           230:                case 'J':
        !           231:                        journal = isc_commandline_argument;
        !           232:                        nomerge = ISC_FALSE;
        !           233:                        break;
        !           234:
        !           235:                case 'k':
        !           236:                        if (ARGCMP("warn")) {
        !           237:                                zone_options |= DNS_ZONEOPT_CHECKNAMES;
        !           238:                                zone_options &= ~DNS_ZONEOPT_CHECKNAMESFAIL;
        !           239:                        } else if (ARGCMP("fail")) {
        !           240:                                zone_options |= DNS_ZONEOPT_CHECKNAMES |
        !           241:                                                DNS_ZONEOPT_CHECKNAMESFAIL;
        !           242:                        } else if (ARGCMP("ignore")) {
        !           243:                                zone_options &= ~(DNS_ZONEOPT_CHECKNAMES |
        !           244:                                                  DNS_ZONEOPT_CHECKNAMESFAIL);
        !           245:                        } else {
        !           246:                                fprintf(stderr, "invalid argument to -k: %s\n",
        !           247:                                        isc_commandline_argument);
        !           248:                                exit(1);
        !           249:                        }
        !           250:                        break;
        !           251:
        !           252:                case 'L':
        !           253:                        snset = ISC_TRUE;
        !           254:                        endp = NULL;
        !           255:                        serialnum = strtol(isc_commandline_argument, &endp, 0);
        !           256:                        if (*endp != '\0') {
        !           257:                                fprintf(stderr, "source serial number "
        !           258:                                                "must be numeric");
        !           259:                                exit(1);
        !           260:                        }
        !           261:                        break;
        !           262:
        !           263:                case 'l':
        !           264:                        zone_options2 |= DNS_ZONEOPT2_CHECKTTL;
        !           265:                        endp = NULL;
        !           266:                        maxttl = strtol(isc_commandline_argument, &endp, 0);
        !           267:                        if (*endp != '\0') {
        !           268:                                fprintf(stderr, "maximum TTL "
        !           269:                                                "must be numeric");
        !           270:                                exit(1);
        !           271:                        }
        !           272:                        break;
        !           273:
        !           274:
        !           275:                case 'n':
        !           276:                        if (ARGCMP("ignore")) {
        !           277:                                zone_options &= ~(DNS_ZONEOPT_CHECKNS|
        !           278:                                                  DNS_ZONEOPT_FATALNS);
        !           279:                        } else if (ARGCMP("warn")) {
        !           280:                                zone_options |= DNS_ZONEOPT_CHECKNS;
        !           281:                                zone_options &= ~DNS_ZONEOPT_FATALNS;
        !           282:                        } else if (ARGCMP("fail")) {
        !           283:                                zone_options |= DNS_ZONEOPT_CHECKNS|
        !           284:                                                DNS_ZONEOPT_FATALNS;
        !           285:                        } else {
        !           286:                                fprintf(stderr, "invalid argument to -n: %s\n",
        !           287:                                        isc_commandline_argument);
        !           288:                                exit(1);
        !           289:                        }
        !           290:                        break;
        !           291:
        !           292:                case 'm':
        !           293:                        if (ARGCMP("warn")) {
        !           294:                                zone_options |= DNS_ZONEOPT_CHECKMX;
        !           295:                                zone_options &= ~DNS_ZONEOPT_CHECKMXFAIL;
        !           296:                        } else if (ARGCMP("fail")) {
        !           297:                                zone_options |= DNS_ZONEOPT_CHECKMX |
        !           298:                                                DNS_ZONEOPT_CHECKMXFAIL;
        !           299:                        } else if (ARGCMP("ignore")) {
        !           300:                                zone_options &= ~(DNS_ZONEOPT_CHECKMX |
        !           301:                                                  DNS_ZONEOPT_CHECKMXFAIL);
        !           302:                        } else {
        !           303:                                fprintf(stderr, "invalid argument to -m: %s\n",
        !           304:                                        isc_commandline_argument);
        !           305:                                exit(1);
        !           306:                        }
        !           307:                        break;
        !           308:
        !           309:                case 'o':
        !           310:                        output_filename = isc_commandline_argument;
        !           311:                        break;
        !           312:
        !           313:                case 'q':
        !           314:                        quiet++;
        !           315:                        break;
        !           316:
        !           317:                case 'r':
        !           318:                        if (ARGCMP("warn")) {
        !           319:                                zone_options |= DNS_ZONEOPT_CHECKDUPRR;
        !           320:                                zone_options &= ~DNS_ZONEOPT_CHECKDUPRRFAIL;
        !           321:                        } else if (ARGCMP("fail")) {
        !           322:                                zone_options |= DNS_ZONEOPT_CHECKDUPRR |
        !           323:                                                DNS_ZONEOPT_CHECKDUPRRFAIL;
        !           324:                        } else if (ARGCMP("ignore")) {
        !           325:                                zone_options &= ~(DNS_ZONEOPT_CHECKDUPRR |
        !           326:                                                  DNS_ZONEOPT_CHECKDUPRRFAIL);
        !           327:                        } else {
        !           328:                                fprintf(stderr, "invalid argument to -r: %s\n",
        !           329:                                        isc_commandline_argument);
        !           330:                                exit(1);
        !           331:                        }
        !           332:                        break;
        !           333:
        !           334:                case 's':
        !           335:                        if (ARGCMP("full"))
        !           336:                                outputstyle = &dns_master_style_full;
        !           337:                        else if (ARGCMP("relative")) {
        !           338:                                outputstyle = &dns_master_style_default;
        !           339:                        } else {
        !           340:                                fprintf(stderr,
        !           341:                                        "unknown or unsupported style: %s\n",
        !           342:                                        isc_commandline_argument);
        !           343:                                exit(1);
        !           344:                        }
        !           345:                        break;
        !           346:
        !           347:                case 't':
        !           348:                        result = isc_dir_chroot(isc_commandline_argument);
        !           349:                        if (result != ISC_R_SUCCESS) {
        !           350:                                fprintf(stderr, "isc_dir_chroot: %s: %s\n",
        !           351:                                        isc_commandline_argument,
        !           352:                                        isc_result_totext(result));
        !           353:                                exit(1);
        !           354:                        }
        !           355:                        break;
        !           356:
        !           357:                case 'v':
        !           358:                        printf(VERSION "\n");
        !           359:                        exit(0);
        !           360:
        !           361:                case 'w':
        !           362:                        workdir = isc_commandline_argument;
        !           363:                        break;
        !           364:
        !           365:                case 'D':
        !           366:                        dumpzone++;
        !           367:                        break;
        !           368:
        !           369:                case 'M':
        !           370:                        if (ARGCMP("fail")) {
        !           371:                                zone_options &= ~DNS_ZONEOPT_WARNMXCNAME;
        !           372:                                zone_options &= ~DNS_ZONEOPT_IGNOREMXCNAME;
        !           373:                        } else if (ARGCMP("warn")) {
        !           374:                                zone_options |= DNS_ZONEOPT_WARNMXCNAME;
        !           375:                                zone_options &= ~DNS_ZONEOPT_IGNOREMXCNAME;
        !           376:                        } else if (ARGCMP("ignore")) {
        !           377:                                zone_options |= DNS_ZONEOPT_WARNMXCNAME;
        !           378:                                zone_options |= DNS_ZONEOPT_IGNOREMXCNAME;
        !           379:                        } else {
        !           380:                                fprintf(stderr, "invalid argument to -M: %s\n",
        !           381:                                        isc_commandline_argument);
        !           382:                                exit(1);
        !           383:                        }
        !           384:                        break;
        !           385:
        !           386:                case 'S':
        !           387:                        if (ARGCMP("fail")) {
        !           388:                                zone_options &= ~DNS_ZONEOPT_WARNSRVCNAME;
        !           389:                                zone_options &= ~DNS_ZONEOPT_IGNORESRVCNAME;
        !           390:                        } else if (ARGCMP("warn")) {
        !           391:                                zone_options |= DNS_ZONEOPT_WARNSRVCNAME;
        !           392:                                zone_options &= ~DNS_ZONEOPT_IGNORESRVCNAME;
        !           393:                        } else if (ARGCMP("ignore")) {
        !           394:                                zone_options |= DNS_ZONEOPT_WARNSRVCNAME;
        !           395:                                zone_options |= DNS_ZONEOPT_IGNORESRVCNAME;
        !           396:                        } else {
        !           397:                                fprintf(stderr, "invalid argument to -S: %s\n",
        !           398:                                        isc_commandline_argument);
        !           399:                                exit(1);
        !           400:                        }
        !           401:                        break;
        !           402:
        !           403:                case 'T':
        !           404:                        if (ARGCMP("warn")) {
        !           405:                                zone_options |= DNS_ZONEOPT_CHECKSPF;
        !           406:                        } else if (ARGCMP("ignore")) {
        !           407:                                zone_options &= ~DNS_ZONEOPT_CHECKSPF;
        !           408:                        } else {
        !           409:                                fprintf(stderr, "invalid argument to -T: %s\n",
        !           410:                                        isc_commandline_argument);
        !           411:                                exit(1);
        !           412:                        }
        !           413:                        break;
        !           414:
        !           415:                case 'W':
        !           416:                        if (ARGCMP("warn"))
        !           417:                                zone_options |= DNS_ZONEOPT_CHECKWILDCARD;
        !           418:                        else if (ARGCMP("ignore"))
        !           419:                                zone_options &= ~DNS_ZONEOPT_CHECKWILDCARD;
        !           420:                        break;
        !           421:
        !           422:                case '?':
        !           423:                        if (isc_commandline_option != '?')
        !           424:                                fprintf(stderr, "%s: invalid argument -%c\n",
        !           425:                                        prog_name, isc_commandline_option);
        !           426:                        /* FALLTHROUGH */
        !           427:                case 'h':
        !           428:                        usage();
        !           429:
        !           430:                default:
        !           431:                        fprintf(stderr, "%s: unhandled option -%c\n",
        !           432:                                prog_name, isc_commandline_option);
        !           433:                        exit(1);
        !           434:                }
        !           435:        }
        !           436:
        !           437:        if (workdir != NULL) {
        !           438:                result = isc_dir_chdir(workdir);
        !           439:                if (result != ISC_R_SUCCESS) {
        !           440:                        fprintf(stderr, "isc_dir_chdir: %s: %s\n",
        !           441:                                workdir, isc_result_totext(result));
        !           442:                        exit(1);
        !           443:                }
        !           444:        }
        !           445:
        !           446:        if (inputformatstr != NULL) {
        !           447:                if (strcasecmp(inputformatstr, "text") == 0)
        !           448:                        inputformat = dns_masterformat_text;
        !           449:                else if (strcasecmp(inputformatstr, "raw") == 0)
        !           450:                        inputformat = dns_masterformat_raw;
        !           451:                else if (strncasecmp(inputformatstr, "raw=", 4) == 0) {
        !           452:                        inputformat = dns_masterformat_raw;
        !           453:                        fprintf(stderr,
        !           454:                                "WARNING: input format raw, version ignored\n");
        !           455:                } else if (strcasecmp(inputformatstr, "map") == 0) {
        !           456:                        inputformat = dns_masterformat_map;
        !           457:                } else {
        !           458:                        fprintf(stderr, "unknown file format: %s\n",
        !           459:                            inputformatstr);
        !           460:                        exit(1);
        !           461:                }
        !           462:        }
        !           463:
        !           464:        if (outputformatstr != NULL) {
        !           465:                if (strcasecmp(outputformatstr, "text") == 0) {
        !           466:                        outputformat = dns_masterformat_text;
        !           467:                } else if (strcasecmp(outputformatstr, "raw") == 0) {
        !           468:                        outputformat = dns_masterformat_raw;
        !           469:                } else if (strncasecmp(outputformatstr, "raw=", 4) == 0) {
        !           470:                        char *end;
        !           471:
        !           472:                        outputformat = dns_masterformat_raw;
        !           473:                        rawversion = strtol(outputformatstr + 4, &end, 10);
        !           474:                        if (end == outputformatstr + 4 || *end != '\0' ||
        !           475:                            rawversion > 1U) {
        !           476:                                fprintf(stderr,
        !           477:                                        "unknown raw format version\n");
        !           478:                                exit(1);
        !           479:                        }
        !           480:                } else if (strcasecmp(outputformatstr, "map") == 0) {
        !           481:                        outputformat = dns_masterformat_map;
        !           482:                } else {
        !           483:                        fprintf(stderr, "unknown file format: %s\n",
        !           484:                                outputformatstr);
        !           485:                        exit(1);
        !           486:                }
        !           487:        }
        !           488:
        !           489:        if (progmode == progmode_compile) {
        !           490:                dumpzone = 1;   /* always dump */
        !           491:                logdump = !quiet;
        !           492:                if (output_filename == NULL) {
        !           493:                        fprintf(stderr,
        !           494:                                "output file required, but not specified\n");
        !           495:                        usage();
        !           496:                }
        !           497:        }
        !           498:
        !           499:        if (output_filename != NULL)
        !           500:                dumpzone = 1;
        !           501:
        !           502:        /*
        !           503:         * If we are outputing to stdout then send the informational
        !           504:         * output to stderr.
        !           505:         */
        !           506:        if (dumpzone &&
        !           507:            (output_filename == NULL ||
        !           508:             strcmp(output_filename, "-") == 0 ||
        !           509:             strcmp(output_filename, "/dev/fd/1") == 0 ||
        !           510:             strcmp(output_filename, "/dev/stdout") == 0)) {
        !           511:                errout = stderr;
        !           512:                logdump = ISC_FALSE;
        !           513:        }
        !           514:
        !           515:        if (isc_commandline_index + 2 != argc)
        !           516:                usage();
        !           517:
        !           518: #ifdef _WIN32
        !           519:        InitSockets();
        !           520: #endif
        !           521:
        !           522:        RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
        !           523:        if (!quiet)
        !           524:                RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
        !           525:                              == ISC_R_SUCCESS);
        !           526:        RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
        !           527:        RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)
        !           528:                      == ISC_R_SUCCESS);
        !           529:
        !           530:        dns_result_register();
        !           531:
        !           532:        origin = argv[isc_commandline_index++];
        !           533:        filename = argv[isc_commandline_index++];
        !           534:        result = load_zone(mctx, origin, filename, inputformat, classname,
        !           535:                           maxttl, &zone);
        !           536:
        !           537:        if (snset) {
        !           538:                dns_master_initrawheader(&header);
        !           539:                header.flags = DNS_MASTERRAW_SOURCESERIALSET;
        !           540:                header.sourceserial = serialnum;
        !           541:                dns_zone_setrawdata(zone, &header);
        !           542:        }
        !           543:
        !           544:        if (result == ISC_R_SUCCESS && dumpzone) {
        !           545:                if (logdump) {
        !           546:                        fprintf(errout, "dump zone to %s...", output_filename);
        !           547:                        fflush(errout);
        !           548:                }
        !           549:                result = dump_zone(origin, zone, output_filename,
        !           550:                                   outputformat, outputstyle, rawversion);
        !           551:                if (logdump)
        !           552:                        fprintf(errout, "done\n");
        !           553:        }
        !           554:
        !           555:        if (!quiet && result == ISC_R_SUCCESS)
        !           556:                fprintf(errout, "OK\n");
        !           557:        destroy();
        !           558:        if (lctx != NULL)
        !           559:                isc_log_destroy(&lctx);
        !           560:        isc_hash_destroy();
        !           561:        isc_entropy_detach(&ectx);
        !           562:        isc_mem_destroy(&mctx);
        !           563: #ifdef _WIN32
        !           564:        DestroySockets();
        !           565: #endif
        !           566:        return ((result == ISC_R_SUCCESS) ? 0 : 1);
        !           567: }

CVSweb <webmaster@jp.NetBSD.org>