BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.sbin / named / xfer / named-xfer.c
index bb742b0..d7bfd75 100644 (file)
@@ -2,19 +2,33 @@
  * Copyright (c) 1988, 1990 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1988, 1990 The Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement:  ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * Neither the name of the University nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  * The original version of xfer by Kevin Dunlap.
  * Completed and integrated with named by David Waitzman
  *
  * The original version of xfer by Kevin Dunlap.
  * Completed and integrated with named by David Waitzman
@@ -29,11 +43,12 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)named-xfer.c       4.15 (Berkeley) 7/24/90";
+static char sccsid[] = "@(#)named-xfer.c       4.18 (Berkeley) 3/7/91";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/file.h>
 #include <sys/file.h>
+#include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
@@ -66,12 +81,15 @@ int read_interrupted = 0;
 struct zoneinfo zones;         /* zone information */
 struct timeval tt;
 
 struct zoneinfo zones;         /* zone information */
 struct timeval tt;
 
-static char *ddtfile = _PATH_TMPXFER;
+static char ddtfilename[] = _PATH_TMPXFER;
+static char *ddtfile = ddtfilename;
 static char *tmpname;
 FILE   *fp = 0, *ddt, *dbfp;
 char   *domain;                        /* domain being xfered */
 int    domain_len;                     /* strlen(domain) */
 
 static char *tmpname;
 FILE   *fp = 0, *ddt, *dbfp;
 char   *domain;                        /* domain being xfered */
 int    domain_len;                     /* strlen(domain) */
 
+extern int errno;
+
 main(argc, argv)
        int argc;
        char *argv[];
 main(argc, argv)
        int argc;
        char *argv[];
@@ -330,7 +348,7 @@ getzone(zp, serial_no, port)
        struct sockaddr_in sin;
        struct zoneinfo zp_start, zp_finish;
        struct itimerval ival, zeroival;
        struct sockaddr_in sin;
        struct zoneinfo zp_start, zp_finish;
        struct itimerval ival, zeroival;
-       extern VOID read_alarm();
+       extern SIG_FN read_alarm();
        struct sigvec sv, osv;
        int ancount, aucount;
 #ifdef DEBUG
        struct sigvec sv, osv;
        int ancount, aucount;
 #ifdef DEBUG
@@ -384,7 +402,7 @@ getzone(zp, serial_no, port)
                        continue;
                }       
                if ((n = res_mkquery(QUERY, zp->z_origin, C_IN,
                        continue;
                }       
                if ((n = res_mkquery(QUERY, zp->z_origin, C_IN,
-                   T_SOA, (char *)NULL, 0, NULL, buf, bufsize)) < 0) {
+                   T_SOA, (char *)NULL, 0, NULL, (char *)buf, bufsize)) < 0) {
                        if (!quiet)
                            syslog(LOG_ERR, "zone %s: res_mkquery T_SOA failed",
                                zp->z_origin);
                        if (!quiet)
                            syslog(LOG_ERR, "zone %s: res_mkquery T_SOA failed",
                                zp->z_origin);
@@ -560,7 +578,7 @@ getzone(zp, serial_no, port)
                        if (soacnt == 0) {
                            if ((n = res_mkquery(QUERY, zp->z_origin, C_IN,
                              T_AXFR, (char *)NULL, 0, NULL,
                        if (soacnt == 0) {
                            if ((n = res_mkquery(QUERY, zp->z_origin, C_IN,
                              T_AXFR, (char *)NULL, 0, NULL,
-                             buf, bufsize)) < 0) {
+                             (char *)buf, bufsize)) < 0) {
                                if (!quiet)
                                    syslog(LOG_ERR,
                                        "zone %s: res_mkquery T_AXFR failed",
                                if (!quiet)
                                    syslog(LOG_ERR,
                                        "zone %s: res_mkquery T_AXFR failed",
@@ -796,7 +814,7 @@ getzone(zp, serial_no, port)
  * Set flag saying to read was interrupted
  * used for a read timer
  */
  * Set flag saying to read was interrupted
  * used for a read timer
  */
-VOID
+SIG_FN
 read_alarm()
 {
        extern int read_interrupted;
 read_alarm()
 {
        extern int read_interrupted;