Annotation of 43BSDReno/usr.sbin/named/db_reload.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1986, 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted provided
        !             6:  * that: (1) source distributions retain this entire copyright notice and
        !             7:  * comment, and (2) distributions including binaries display the following
        !             8:  * acknowledgement:  ``This product includes software developed by the
        !             9:  * University of California, Berkeley and its contributors'' in the
        !            10:  * documentation or other materials provided with the distribution and in
        !            11:  * all advertising materials mentioning features or use of this software.
        !            12:  * Neither the name of the University nor the names of its contributors may
        !            13:  * be used to endorse or promote products derived from this software without
        !            14:  * specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            16:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            17:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)db_reload.c        4.21 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: #include <sys/types.h>
        !            25: #include <sys/time.h>
        !            26: #include <netinet/in.h>
        !            27: #include <stdio.h>
        !            28: #include <syslog.h>
        !            29: #include <arpa/nameser.h>
        !            30: #include "ns.h"
        !            31: #include "db.h"
        !            32: 
        !            33: extern time_t  resettime;
        !            34: 
        !            35: /*
        !            36:  * Flush and reload data base.
        !            37:  */
        !            38: 
        !            39: db_reload()
        !            40: {
        !            41:        extern char *bootfile;
        !            42: 
        !            43: #ifdef DEBUG
        !            44:        if (debug >= 3)
        !            45:                fprintf(ddt,"reload()\n");
        !            46: #endif
        !            47:        syslog(LOG_NOTICE, "reloading nameserver\n");
        !            48: 
        !            49:        qflush();
        !            50:        sqflush();
        !            51:        fwdtab_free();
        !            52:        free_sort_list();
        !            53:        getnetconf();
        !            54:        ns_init(bootfile);
        !            55:        time(&resettime);
        !            56: }
        !            57: 
        !            58: db_free(htp)
        !            59:        struct hashbuf *htp;
        !            60: {
        !            61:        register struct databuf *dp, *nextdp;
        !            62:        register struct namebuf *np, *nextnp;
        !            63:        struct namebuf **npp, **nppend;
        !            64: 
        !            65:        npp = htp->h_tab;
        !            66:        nppend = npp + htp->h_size;
        !            67:        while (npp < nppend) {
        !            68:            for (np = *npp++; np != NULL; np = nextnp) {
        !            69:                if (np->n_hash != NULL)
        !            70:                        db_free(np->n_hash);
        !            71:                (void) free((char *)np->n_dname);
        !            72:                for (dp = np->n_data; dp != NULL; ) {
        !            73:                        nextdp = dp->d_next;
        !            74:                        (void) free((char *)dp);
        !            75:                        dp = nextdp;
        !            76:                }
        !            77:                nextnp = np->n_next;
        !            78:                free((char *)np);
        !            79:            }
        !            80:        }
        !            81:        (void) free((char *)htp);
        !            82: }
        !            83: 
        !            84: db_inv_free()
        !            85: {
        !            86:        register struct invbuf *ip;
        !            87:        register int i, j;
        !            88: 
        !            89:        for (i = 0; i < INVHASHSZ; i++)
        !            90:                for (ip = invtab[i]; ip != NULL; ip = ip->i_next)
        !            91:                        for (j = 0; j < INVBLKSZ; j++)
        !            92:                                ip->i_dname[j] = NULL;
        !            93: }
        !            94: 
        !            95: fwdtab_free()
        !            96: {
        !            97:        extern  struct fwdinfo *fwdtab;
        !            98:        struct fwdinfo *fp, *nextfp;
        !            99: 
        !           100:        for (fp = fwdtab; fp != NULL; fp = nextfp) {
        !           101:                nextfp = fp->next;
        !           102:                free((char *)fp);
        !           103:        }
        !           104:        fwdtab = NULL;
        !           105: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.