Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src Pull up following revision(s) (requested by manu in ticke...
details: https://anonhg.NetBSD.org/src/rev/e65a5eb34ca3
branches: netbsd-6
changeset: 776410:e65a5eb34ca3
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Jul 30 08:17:48 2013 +0000
description:
Pull up following revision(s) (requested by manu in ticket #887):
lib/libc/nameser/ns_samedomain.c 1.7
lib/libresolv/Makefile 1.12
lib/libresolv/dst_api.c 1.1
lib/libresolv/dst_internal.h 1.1
liib/libresolv/hmac_link.c 1.1
lib/libresolv/ns_date.c 1.1
lib/libresolv/ns_sign.c 1.1
lib/libresolv/ns_verify.c 1.1
lib/libresolv/res_findzonecut.c 1.1
lib/libresolv/res_mkupdate.c 1.1
lib/libresolv/res_mkupdate.h 1.1
lib/libresolv/res_private.h 1.1
lib/libresolv/res_sendsigned.c 1.1
lib/libresolv/res_update.c 1.1
lib/libresolv/support.c 1.1
include/res_update.h 1.8
lib/libresolv/dst_api.c 1.2
lib/libresolv/dst_internal.h 1.2
lib/libresolv/dst_api.c 1.3
lib/libresolv/hmac_link.c 1.2
lib/libresolv/ns_verify.c 1.2
lib/libresolv/res_mkupdate.c 1.2
lib/libc/nameser/ns_samedomain.c 1.8
Restore libresolv missing bits, including NS updates.
diffstat:
include/res_update.h | 8 +-
lib/libc/nameser/ns_samedomain.c | 28 +-
lib/libresolv/Makefile | 19 +-
lib/libresolv/dst_api.c | 1058 ++++++++++++++++++++++++++++++++++
lib/libresolv/dst_internal.h | 166 +++++
lib/libresolv/hmac_link.c | 472 +++++++++++++++
lib/libresolv/ns_date.c | 134 ++++
lib/libresolv/ns_sign.c | 393 ++++++++++++
lib/libresolv/ns_verify.c | 486 +++++++++++++++
lib/libresolv/res_findzonecut.c | 723 +++++++++++++++++++++++
lib/libresolv/res_mkupdate.c | 1169 ++++++++++++++++++++++++++++++++++++++
lib/libresolv/res_mkupdate.h | 27 +
lib/libresolv/res_private.h | 24 +
lib/libresolv/res_sendsigned.c | 173 +++++
lib/libresolv/res_update.c | 219 +++++++
lib/libresolv/support.c | 347 +++++++++++
16 files changed, 5424 insertions(+), 22 deletions(-)
diffs (truncated from 5610 to 300 lines):
diff -r 1e5c3a7c7f07 -r e65a5eb34ca3 include/res_update.h
--- a/include/res_update.h Tue Jul 30 07:00:06 2013 +0000
+++ b/include/res_update.h Tue Jul 30 08:17:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: res_update.h,v 1.7.10.2 2013/06/14 04:17:36 msaitoh Exp $ */
+/* $NetBSD: res_update.h,v 1.7.10.3 2013/07/30 08:17:48 msaitoh Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -26,14 +26,14 @@
#include <sys/types.h>
#include <arpa/nameser.h>
-#include <isc/list.h>
+#include <sys/queue.h>
#include <resolv.h>
/*%
* This RR-like structure is particular to UPDATE.
*/
struct ns_updrec {
- LINK(struct ns_updrec) r_link, r_glink;
+ TAILQ_ENTRY(ns_updrec) r_link, r_glink;
ns_sect r_section; /*%< ZONE/PREREQUISITE/UPDATE */
char * r_dname; /*%< owner of the RR */
ns_class r_class; /*%< class number */
@@ -48,7 +48,7 @@
u_int r_zone; /*%< zone number on server */
};
typedef struct ns_updrec ns_updrec;
-typedef LIST(ns_updrec) ns_updque;
+typedef TAILQ_HEAD(ns_updqueu, ns_updrec) ns_updque;
#define res_mkupdate __res_mkupdate
#define res_update __res_update
diff -r 1e5c3a7c7f07 -r e65a5eb34ca3 lib/libc/nameser/ns_samedomain.c
--- a/lib/libc/nameser/ns_samedomain.c Tue Jul 30 07:00:06 2013 +0000
+++ b/lib/libc/nameser/ns_samedomain.c Tue Jul 30 08:17:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_samedomain.c,v 1.6.8.2 2013/06/14 04:17:36 msaitoh Exp $ */
+/* $NetBSD: ns_samedomain.c,v 1.6.8.3 2013/07/30 08:17:48 msaitoh Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -22,7 +22,7 @@
#ifdef notdef
static const char rcsid[] = "Id: ns_samedomain.c,v 1.6 2005/04/27 04:56:40 sra Exp";
#else
-__RCSID("$NetBSD: ns_samedomain.c,v 1.6.8.2 2013/06/14 04:17:36 msaitoh Exp $");
+__RCSID("$NetBSD: ns_samedomain.c,v 1.6.8.3 2013/07/30 08:17:48 msaitoh Exp $");
#endif
#endif
@@ -35,7 +35,7 @@
#include "port_after.h"
-#ifndef _LIBC
+#ifdef _LIBRESOLV
/*%
* Check whether a name belongs to a domain.
*
@@ -57,8 +57,8 @@
int
ns_samedomain(const char *a, const char *b) {
- size_t la, lb;
- int diff, i, escaped;
+ size_t la, lb, i;
+ int diff, escaped;
const char *cp;
la = strlen(a);
@@ -68,8 +68,8 @@
if (la != 0U && a[la - 1] == '.') {
escaped = 0;
/* Note this loop doesn't get executed if la==1. */
- for (i = la - 2; i >= 0; i--)
- if (a[i] == '\\') {
+ for (i = la - 1; i > 0; i--)
+ if (a[i - 1] == '\\') {
if (escaped)
escaped = 0;
else
@@ -84,8 +84,8 @@
if (lb != 0U && b[lb - 1] == '.') {
escaped = 0;
/* note this loop doesn't get executed if lb==1 */
- for (i = lb - 2; i >= 0; i--)
- if (b[i] == '\\') {
+ for (i = lb - 1; i > 0; i--)
+ if (b[i - 1] == '\\') {
if (escaped)
escaped = 0;
else
@@ -110,7 +110,7 @@
/* Ok, we know la > lb. */
- diff = la - lb;
+ diff = (int)(la - lb);
/*
* If 'a' is only 1 character longer than 'b', then it can't be
@@ -133,8 +133,8 @@
* and thus not a really a label separator.
*/
escaped = 0;
- for (i = diff - 2; i >= 0; i--)
- if (a[i] == '\\') {
+ for (i = diff - 1; i > 0; i--)
+ if (a[i - 1] == '\\') {
if (escaped)
escaped = 0;
else
@@ -157,7 +157,7 @@
return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
}
#endif
-
+#ifdef _LIBC
/*%
* make a canonical copy of domain name "src"
*
@@ -212,5 +212,5 @@
else
return (0);
}
-
+#endif
/*! \file */
diff -r 1e5c3a7c7f07 -r e65a5eb34ca3 lib/libresolv/Makefile
--- a/lib/libresolv/Makefile Tue Jul 30 07:00:06 2013 +0000
+++ b/lib/libresolv/Makefile Tue Jul 30 08:17:48 2013 +0000
@@ -1,17 +1,28 @@
-# $NetBSD: Makefile,v 1.11.50.2 2013/06/14 04:17:36 msaitoh Exp $
+# $NetBSD: Makefile,v 1.11.50.3 2013/07/30 08:17:48 msaitoh Exp $
# from: @(#)Makefile 5.1 (Berkeley) 6/5/90
.include <bsd.own.mk>
+LIBC= ${NETBSDSRCDIR}/lib/libc
+
LIB=resolv
-CPPFLAGS+=-DLIBC_SCCS -I${NETBSDSRCDIR}/lib/libc/include -D_LIBC
+CPPFLAGS+=-I${LIBC}/include -I${LIBC}/resolv -D_LIBRESOLV
.if (${USE_INET6} != "no")
CPPFLAGS+=-DINET6
.endif
-.PATH: ${NETBSDSRCDIR}/lib/libc/net ${NETBSDSRCDIR}/lib/libc/resolv
+.PATH: ${LIBC}/net ${LIBC}/resolv ${LIBC}/nameser
-SRCS=gethnamaddr.c res_mkquery.c res_query.c res_send.c
+SRCS+= res_update.c res_findzonecut.c res_mkupdate.c
+SRCS+= res_sendsigned.c
+SRCS+= ns_date.c ns_samedomain.c ns_sign.c ns_verify.c
+SRCS+= dst_api.c support.c hmac_link.c
+
+# LIBC
+# CPPFLAGS+=-D_LIBC -DCOMPAT__RES -DUSE_POLL -DLIBC_SCCS
+# SRCS+= res_comp.c res_send.c res_data.c res_debug.c res_mkquery.c
+# SRCS+= res_query.c res_mkupdate.c res_init.c res_state.c
+# SRCS+= ns_netint.c ns_name.c ns_print.c ns_parse.c ns_ttl.c ns_samedomain.c
.include <bsd.lib.mk>
diff -r 1e5c3a7c7f07 -r e65a5eb34ca3 lib/libresolv/dst_api.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libresolv/dst_api.c Tue Jul 30 08:17:48 2013 +0000
@@ -0,0 +1,1058 @@
+/* $NetBSD: dst_api.c,v 1.3.10.4 2013/07/30 08:17:48 msaitoh Exp $ */
+
+/*
+ * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND TRUSTED INFORMATION SYSTEMS
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ */
+/*
+ * This file contains the interface between the DST API and the crypto API.
+ * This is the only file that needs to be changed if the crypto system is
+ * changed. Exported functions are:
+ * void dst_init() Initialize the toolkit
+ * int dst_check_algorithm() Function to determines if alg is suppored.
+ * int dst_compare_keys() Function to compare two keys for equality.
+ * int dst_sign_data() Incremental signing routine.
+ * int dst_verify_data() Incremental verify routine.
+ * int dst_generate_key() Function to generate new KEY
+ * DST_KEY *dst_read_key() Function to retrieve private/public KEY.
+ * void dst_write_key() Function to write out a key.
+ * DST_KEY *dst_dnskey_to_key() Function to convert DNS KEY RR to a DST
+ * KEY structure.
+ * int dst_key_to_dnskey() Function to return a public key in DNS
+ * format binary
+ * DST_KEY *dst_buffer_to_key() Converst a data in buffer to KEY
+ * int *dst_key_to_buffer() Writes out DST_KEY key matterial in buffer
+ * void dst_free_key() Releases all memory referenced by key structure
+ */
+#include <sys/cdefs.h>
+#if 0
+static const char rcsid[] = "Header: /proj/cvs/prod/libbind/dst/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp ";
+#else
+__RCSID("$NetBSD: dst_api.c,v 1.3.10.4 2013/07/30 08:17:48 msaitoh Exp $");
+#endif
+
+
+#include "port_before.h"
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <memory.h>
+#include <ctype.h>
+#include <time.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+
+#include "dst_internal.h"
+#include "port_after.h"
+
+/* static variables */
+static int done_init = 0;
+dst_func *dst_t_func[DST_MAX_ALGS];
+const char *dst_path = "";
+
+/* internal I/O functions */
+static DST_KEY *dst_s_read_public_key(const char *in_name,
+ const u_int16_t in_id, int in_alg);
+static int dst_s_read_private_key_file(char *name, DST_KEY *pk_key,
+ u_int16_t in_id, int in_alg);
+static int dst_s_write_public_key(const DST_KEY *key);
+static int dst_s_write_private_key(const DST_KEY *key);
+
+/* internal function to set up data structure */
+static DST_KEY *dst_s_get_key_struct(const char *name, const int alg,
+ const int flags, const int protocol,
+ const int bits);
+
+/*%
+ * dst_init
+ * This function initializes the Digital Signature Toolkit.
+ * Right now, it just checks the DSTKEYPATH environment variable.
+ * Parameters
+ * none
+ * Returns
+ * none
+ */
+void
+dst_init(void)
+{
+ char *s;
+ size_t len;
+
+ if (done_init != 0)
+ return;
+ done_init = 1;
+
+ s = getenv("DSTKEYPATH");
+ len = 0;
+ if (s) {
+ struct stat statbuf;
+
+ len = strlen(s);
+ if (len > PATH_MAX) {
+ EREPORT(("%s: %s is longer than %d characters,"
+ " ignoring\n", __func__, s, PATH_MAX));
+ } else if (stat(s, &statbuf) != 0 ||
+ !S_ISDIR(statbuf.st_mode)) {
+ EREPORT(("%s: %s is not a valid directory\n",
+ __func__, s));
+ } else {
+ char *tmp;
+ tmp = (char *) malloc(len + 2);
+ memcpy(tmp, s, len + 1);
+ if (tmp[strlen(tmp) - 1] != '/') {
+ tmp[strlen(tmp) + 1] = 0;
+ tmp[strlen(tmp)] = '/';
+ }
+ dst_path = tmp;
+ }
+ }
+ memset(dst_t_func, 0, sizeof(dst_t_func));
+ /* first one is selected */
Home |
Main Index |
Thread Index |
Old Index