Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist/ipsec-tools/src/racoon From M E Andersson <debia...
details: https://anonhg.NetBSD.org/src/rev/9dff362507a8
branches: trunk
changeset: 761891:9dff362507a8
user: tteras <tteras%NetBSD.org@localhost>
date: Thu Feb 10 11:17:17 2011 +0000
description:
>From M E Andersson <debian%gisladisker.se@localhost>: Fix parsing of restricted RSA
key addresses.
diffstat:
crypto/dist/ipsec-tools/src/racoon/prsa_par.y | 28 ++++++++++++++++++--------
1 files changed, 19 insertions(+), 9 deletions(-)
diffs (67 lines):
diff -r e7fea709b8e2 -r 9dff362507a8 crypto/dist/ipsec-tools/src/racoon/prsa_par.y
--- a/crypto/dist/ipsec-tools/src/racoon/prsa_par.y Thu Feb 10 11:08:23 2011 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/prsa_par.y Thu Feb 10 11:17:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prsa_par.y,v 1.4 2006/09/09 16:22:10 manu Exp $ */
+/* $NetBSD: prsa_par.y,v 1.5 2011/02/10 11:17:17 tteras Exp $ */
/* Id: prsa_par.y,v 1.3 2004/11/08 12:04:23 ludvigm Exp */
@@ -236,6 +236,7 @@
{
int err;
struct sockaddr_in *sap;
+ struct addrinfo hints, *res;
if ($2 == -1) $2 = 32;
if ($2 < 0 || $2 > 32) {
@@ -245,12 +246,16 @@
$$ = calloc (sizeof(struct netaddr), 1);
$$->prefix = $2;
sap = (struct sockaddr_in *)(&$$->sa);
- sap->sin_family = AF_INET;
- err = inet_pton(AF_INET, $1, (struct in_addr*)(&sap->sin_addr));
- if (err <= 0) {
- prsaerror("inet_pton(%s): %s\n", $1, strerror(errno));
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET;
+ hints.ai_flags = AI_NUMERICHOST;
+ err = getaddrinfo($1, NULL, &hints, &res);
+ if (err < 0) {
+ prsaerror("getaddrinfo(%s): %s\n", $1, gai_strerror(err));
YYABORT;
}
+ memcpy(sap, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
}
;
@@ -259,6 +264,7 @@
{
int err;
struct sockaddr_in6 *sap;
+ struct addrinfo hints, *res;
if ($2 == -1) $2 = 128;
if ($2 < 0 || $2 > 128) {
@@ -268,12 +274,16 @@
$$ = calloc (sizeof(struct netaddr), 1);
$$->prefix = $2;
sap = (struct sockaddr_in6 *)(&$$->sa);
- sap->sin6_family = AF_INET6;
- err = inet_pton(AF_INET6, $1, (struct in6_addr*)(&sap->sin6_addr));
- if (err <= 0) {
- prsaerror("inet_pton(%s): %s\n", $1, strerror(errno));
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET6;
+ hints.ai_flags = AI_NUMERICHOST;
+ err = getaddrinfo($1, NULL, &hints, &res);
+ if (err < 0) {
+ prsaerror("getaddrinfo(%s): %s\n", $1, gai_strerror(err));
YYABORT;
}
+ memcpy(sap, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
}
;
Home |
Main Index |
Thread Index |
Old Index