summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJakob Schlyter <jakob@cvs.openbsd.org>2001-08-16 07:04:29 +0000
committerJakob Schlyter <jakob@cvs.openbsd.org>2001-08-16 07:04:29 +0000
commitafb4090a5360082317f43449b92e8cd78d7ff6d1 (patch)
treed6f14a87d4eb5a727230a9d57eb5df6bae7843d2 /sbin
parent71596218b1883e024afa8cb640fbe1e3d584b85e (diff)
add support for getrrsetbyname(3) from libc. ok ho@.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/dnssec.c34
-rw-r--r--sbin/isakmpd/dnssec.h16
-rw-r--r--sbin/isakmpd/features/dnssec6
3 files changed, 37 insertions, 19 deletions
diff --git a/sbin/isakmpd/dnssec.c b/sbin/isakmpd/dnssec.c
index c62def0378d..f6f6e233ae0 100644
--- a/sbin/isakmpd/dnssec.c
+++ b/sbin/isakmpd/dnssec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dnssec.c,v 1.7 2001/07/01 06:03:34 angelos Exp $ */
+/* $OpenBSD: dnssec.c,v 1.8 2001/08/16 07:04:28 jakob Exp $ */
/*
* Copyright (c) 2001 Håkan Olsson. All rights reserved.
@@ -33,9 +33,13 @@
#include <stdlib.h>
#include <openssl/rsa.h>
-#include <dns/keyvalues.h>
-#include <lwres/lwres.h>
+
+#ifdef LWRES
#include <lwres/netdb.h>
+#include <dns/keyvalues.h>
+#else
+#include <netdb.h>
+#endif
#include "sysdep.h"
@@ -96,13 +100,13 @@ dns_get_key (int type, struct message *msg, int *keylen)
{
case AF_INET:
hostent =
- lwres_gethostbyaddr ((char *)&((struct sockaddr_in *)dst)->sin_addr,
- sizeof (struct in_addr), PF_INET);
+ gethostbyaddr ((char *)&((struct sockaddr_in *)dst)->sin_addr,
+ sizeof (struct in_addr), PF_INET);
break;
case AF_INET6:
hostent =
- lwres_gethostbyaddr ((char *)&((struct sockaddr_in6 *)dst)->sin6_addr,
- sizeof (struct in6_addr), PF_INET6);
+ gethostbyaddr ((char *)&((struct sockaddr_in6 *)dst)->sin6_addr,
+ sizeof (struct in6_addr), PF_INET6);
break;
default:
log_print ("dns_get_key: unsupported protocol family %d",
@@ -119,8 +123,8 @@ dns_get_key (int type, struct message *msg, int *keylen)
dst_str = 0;
LOG_DBG ((LOG_MISC, 30,
- "dns_get_key: lwres_gethostbyaddr (%s) failed: %s",
- dst_str ? dst_str : "<???>", lwres_hstrerror (lwres_h_errno)));
+ "dns_get_key: gethostbyaddr (%s) failed: %s",
+ dst_str ? dst_str : "<???>", hstrerror (h_errno)));
if (dst_str)
free (dst_str);
@@ -131,7 +135,7 @@ dns_get_key (int type, struct message *msg, int *keylen)
/* Try host official name */
LOG_DBG ((LOG_MISC, 50, "dns_get_key: trying KEY RR for %s",
hostent->h_name));
- ret = lwres_getrrsetbyname (hostent->h_name, C_IN, T_KEY, 0, &rr);
+ ret = getrrsetbyname (hostent->h_name, C_IN, T_KEY, 0, &rr);
if (ret)
{
/* Try host aliases */
@@ -140,7 +144,7 @@ dns_get_key (int type, struct message *msg, int *keylen)
{
LOG_DBG ((LOG_MISC, 50, "dns_get_key: trying KEY RR for alias %s",
hostent->h_aliases[i]));
- ret = lwres_getrrsetbyname (hostent->h_aliases[i], C_IN, T_KEY, 0,
+ ret = getrrsetbyname (hostent->h_aliases[i], C_IN, T_KEY, 0,
&rr);
i++;
}
@@ -162,7 +166,7 @@ dns_get_key (int type, struct message *msg, int *keylen)
if (!(rr->rri_flags & RRSET_VALIDATED))
{
LOG_DBG ((LOG_MISC, 10, "dns_get_key: got unvalidated response"));
- lwres_freerrset (rr);
+ freerrset (rr);
return 0;
}
@@ -170,7 +174,7 @@ dns_get_key (int type, struct message *msg, int *keylen)
if (rr->rri_nrdatas == 0 || rr->rri_rdtype != T_KEY)
{
LOG_DBG ((LOG_MISC, 30, "dns_get_key: no KEY RRs recieved"));
- lwres_freerrset (rr);
+ freerrset (rr);
return 0;
}
@@ -211,14 +215,14 @@ dns_get_key (int type, struct message *msg, int *keylen)
if (!key_rr.data)
{
log_error ("dns_get_key: malloc (%d) failed", key_rr.datalen);
- lwres_freerrset (rr);
+ freerrset (rr);
return 0;
}
memcpy (key_rr.data, rr->rri_rdatas[i].rdi_data + 4, key_rr.datalen);
*keylen = key_rr.datalen;
}
- lwres_freerrset (rr);
+ freerrset (rr);
if (key_rr.datalen)
return key_rr.data;
diff --git a/sbin/isakmpd/dnssec.h b/sbin/isakmpd/dnssec.h
index 561fade546a..c5465f43764 100644
--- a/sbin/isakmpd/dnssec.h
+++ b/sbin/isakmpd/dnssec.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dnssec.h,v 1.3 2001/01/27 15:39:54 ho Exp $ */
+/* $OpenBSD: dnssec.h,v 1.4 2001/08/16 07:04:28 jakob Exp $ */
/*
* Copyright (c) 2001 Håkan Olsson. All rights reserved.
@@ -32,3 +32,17 @@
void *dns_get_key (int, struct message *, int *);
int dns_RSA_dns_to_x509 (u_int8_t *, int, RSA **);
+#ifndef DNS_KEYALG_RSA
+#define DNS_KEYALG_RSA 1
+#endif
+
+#ifndef DNS_KEYPROTO_IPSEC
+#define DNS_KEYPROTO_IPSEC 4
+#endif
+#ifndef DNS_KEYALG_RSA
+#define DNS_KEYALG_RSA 1
+#endif
+
+#ifndef DNS_KEYPROTO_IPSEC
+#define DNS_KEYPROTO_IPSEC 4
+#endif
diff --git a/sbin/isakmpd/features/dnssec b/sbin/isakmpd/features/dnssec
index 8fc46e6912f..7e7f87c25a3 100644
--- a/sbin/isakmpd/features/dnssec
+++ b/sbin/isakmpd/features/dnssec
@@ -1,4 +1,4 @@
-# $OpenBSD: dnssec,v 1.1 2001/05/21 11:19:22 ho Exp $
+# $OpenBSD: dnssec,v 1.2 2001/08/16 07:04:28 jakob Exp $
#
# Copyright (c) 2001 Håkan Olsson. All rights reserved.
@@ -28,5 +28,5 @@
DNSSEC= dnssec.c
-LWRESLIB= /usr/local/lib/liblwres.a
-DNSSEC_CFLAGS= -I/usr/local/include
+#LWRESLIB= /usr/local/lib/liblwres.a
+#DNSSEC_CFLAGS= -I/usr/local/include -DLWRES